Changes on
33 changes detected
--- a/agent-teams.md
+++ b/agent-teams.md
@@ -126,6 +126,8 @@
Create a team with 4 teammates to refactor these modules in parallel.
Use Sonnet for each teammate.
+
+Teammates don’t inherit the lead’s `/model` selection by default. To change the model used when the prompt doesn’t specify one, set **Default teammate model** in `/config`. Pick **Default (leader’s model)** to have teammates follow the lead’s current model.
###
Show diff (404 lines)
--- a/agent-view.md
+++ b/agent-view.md
@@ -4,15 +4,15 @@
>
> Use this file to discover all available pages before exploring further.
-Agent view, opened with `claude agents`, is one screen for all your background sessions: what’s running, what needs your input, and what’s done. Dispatch new sessions, watch their state at a glance instead of scrolling through transcripts, and step in only when one needs you. Sessions keep running in the background without a terminal attached. Use agent view when you have several independent tasks Claude can work on at once, such as fixing a bug, reviewing a pull request, or investigating a log. When you want to work through a problem together, attach to a session and use Claude Code interactively as usual. Sessions in agent view run independently and report only to you. To compare with subagents, agent teams, and worktrees, see [Run agents in parallel](</docs/en/agents>).
-
-Agent view is a research preview and requires Claude Code v2.1.139 or later. Check your version with `claude --version`. The interface and keyboard shortcuts may change as the feature evolves, and administrators can disable agent view for an organization with the `disableAgentView` managed setting.
+Agent view, opened with `claude agents`, is one screen for all your background sessions: what’s running, what needs your input, and what’s done. Dispatch new sessions, watch their state at a glance instead of scrolling through transcripts, and step in only when one needs you. Each background session is a full Claude Code conversation that keeps running without a terminal attached, so you can open it, reply, and leave whenever you want. Use agent view when you have several independent tasks Claude can work on without you watching every step. Dispatch a bug fix, a pull request review, and a flaky-test investigation as three rows, keep working in another window, and check back when a row shows it needs you or has a result. When you want to work more directly in any agent’s session, attach to the row to enter the full conversation. To compare agent view with subagents, agent teams, and worktrees, see [Run agents in parallel](</docs/en/agents>).
+
+Agent view is in research preview and requires Claude Code v2.1.139 or later. Check your version with `claude --version`. The interface and keyboard shortcuts may change as the feature evolves.
This page covers:
- * Quick start
+ * Quick start: give Claude a task to work on in the background, check on it, and step in when needed
* Monitor sessions with agent view, including state icons, peeking and replying, attaching, organizing, and keyboard shortcuts
- * Dispatch new agents from agent view, from inside a session, or from the shell
+ * Dispatch new agents from agent view, from inside a session, or from your shell
* Manage sessions from the shell
* How background sessions are hosted by the supervisor process
@@ -22,7 +22,7 @@
Quick start
-This walkthrough opens agent view, dispatches a session, replies from the peek panel, and attaches for the full conversation.
+This walkthrough covers the core agent view loop: dispatch a task, watch its row update as Claude works, peek to check on it and reply, and attach for the full conversation. The session you dispatch keeps running after you close agent view, so you can leave and come back to it.
1
@@ -32,19 +32,19 @@
claude agents
-Agent view opens with an input at the bottom and a table that fills in as sessions start. Press `Esc` at any time to exit. Your sessions keep running.
+Agent view opens with an input at the bottom and a table that fills in as sessions start. Press `Esc` at any time to return to your shell. Your sessions keep running while you’re away and reappear the next time you open agent view.
2
Dispatch a session
-Type a prompt in the input and press `Enter`. A new session starts and appears as a row showing whether it’s working, waiting on you, or done. Repeat to run several sessions in parallel. Each one uses your subscription quota independently, so see Limitations before dispatching many at once.
+Type a prompt describing a task and press `Enter`. A new background session starts on that task and appears as a row showing whether it’s working, waiting on you, or done. The new session uses the model shown in the agent view header and the same permission mode you’d get running `claude` in that directory.Every prompt you enter here starts its own new session. Typing another prompt and pressing `Enter` launches a second session alongside the first rather than sending a follow-up to it. You can run several in parallel this way.Each session uses your subscription quota independently, so see Limitations before dispatching many at once.
3
Peek and reply
-Select a row with the arrow keys and press `Space` to see what the session is doing or what it needs from you. Type a reply and press `Enter` to send it without leaving agent view.
+Select a row with the arrow keys and press `Space` to open the peek panel. It shows the session’s most recent output, or the question it’s waiting on, rather than the full transcript. Type a reply and press `Enter` to send it without leaving agent view.
4
@@ -52,7 +52,13 @@
Press `Enter` or `→` on a row to attach when you want the full conversation. The session takes over the terminal exactly as if you had run `claude`. Press `←` on an empty prompt to detach and return to the table.
-To bring an existing interactive session into agent view, run `/bg` inside it, or press `←` on an empty prompt to background the session and open agent view in one step. The session keeps running in the background and appears as a row. To start a new background session directly from the shell, run `claude --bg "<prompt>"`. You can use `claude agents` as your primary entry point instead of `claude`: dispatch every task from agent view, attach when you want the full conversation, and press `←` to return to the table.
+5
+
+Bring an existing session in
+
+To move a session you already have open into agent view, run `/bg` inside it, or press `←` on an empty prompt to background it and open agent view in one step. The session keeps running and appears as a row alongside the ones you dispatched.
+
+You can use `claude agents` as your primary entry point instead of `claude`: dispatch every task from agent view, attach when you want the full conversation, and press `←` to return to the table.
##
@@ -60,13 +66,13 @@
Monitor sessions with agent view
-Run `claude agents` to open agent view. It takes over the full terminal and lists every session grouped by state, with pinned sessions and the ones that need you at the top. Each row shows the session’s name, current activity, and how long ago it last changed. The list covers every background session under your config directory, regardless of which project or worktree it’s working in, so a session started in one repository and another started in a different worktree both appear together. Interactive sessions you have open in other terminals don’t appear until you background them, and [subagents](</docs/en/sub-agents>) running inside a session aren’t listed as separate rows.
+Run `claude agents` to open agent view. It takes over the full terminal and lists every session grouped by state, with pinned sessions and the ones that need you at the top. Each row shows the session’s name, current activity, and how long ago it last changed. The list shows every background session you’ve started, across all your projects. A session working in one repository and another in a different worktree both appear here, regardless of which directory you opened agent view from. Interactive sessions you have open in other terminals don’t appear until you background them. [Subagents](</docs/en/sub-agents>) and [teammates](</docs/en/agent-teams>) a session spawns aren’t listed as separate rows.
Pinned
✽ clawd walk cycle Write assets/sprites/clawd-walk.png 3m
Ready for review
- ∙ jump physics github.com/anthropics/example/pull/2048 2h
+ ∙ jump physics github.com/example/game/pull/2048 ● 2h
Needs input
✻ power-up design needs input: double jump or wall climb? 1m
@@ -80,18 +86,57 @@
∙ sound effects result: 14 SFX exported to assets/audio 4h
… 6 more
-Each row’s icon carries two signals. The indicator tells you the session’s state, and the icon’s shape tells you whether the underlying process is still running. The states are:
-
-Indicator| State| What it means
+###
+
+
+
+Read session state
+
+Each row starts with an icon whose color and animation show the session’s state:
+
+State| Icon shows as| What it means
---|---|---
-Animated| Working| Claude is actively running tools or generating a response
-Yellow| Needs input| Claude is waiting for your input, usually a permission decision or an answer
-Dimmed| Idle| The session is waiting for input but isn’t blocked on a specific question
-Green| Completed| The task finished successfully
-Red| Failed| The task ended with an error
-Grey| Stopped| The session was stopped with `Ctrl+X` or `claude stop`
-
-The icon’s shape tells you whether the underlying process is still running. A `✻`, or an animated `✽` while Claude is working, means the session is alive and you can reply to it immediately. A `∙` means the process has exited, but you can still peek, reply, or attach: Claude restarts the session from where it left off. A `✢` is a [`/loop`](</docs/en/commands>) session sleeping between iterations, with the row showing its run count and a countdown to the next iteration. 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. Sessions persist on disk: closing your terminal or an auto-update doesn’t lose them, and reopening `claude agents` shows them all. If your machine sleeps or shuts down, running sessions stop; restart them with `claude respawn --all`. The one-line summary in each row is generated by your configured [Haiku-class model](</docs/en/model-config>) so the row can tell you what the session is doing, what it needs, or what it produced without opening the transcript. While a session is actively working, the summary refreshes at most once every 15 seconds, plus once when each turn ends. Each refresh is one short Haiku-class request through your normal provider, billed and handled under the same [data usage terms](</docs/en/data-usage>) as the session itself. When a session opens a pull request, the row shows the PR link and a status indicator for its CI checks. For most tasks this row is where you pick up the result: review and merge the pull request when its checks pass.
+Working| Animated| Claude is actively running tools or generating a response
+Needs input| Yellow| Claude is waiting on a specific question or permission decision from you
+Idle| Dimmed| The session has nothing to do and is ready for your next prompt
+Completed| Green| The task finished successfully
+Failed| Red| The task ended with an error
+Stopped| Grey| The session was stopped with `Ctrl+X` or `claude stop`
+
+Separately, the icon’s shape shows whether the underlying process is running:
+
+Shape| What it means
+---|---
+`✻` or animated `✽`| The session process is alive and replies immediately
+`∙`| 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
+
+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. If your machine sleeps or shuts down, running sessions stop; restart them with `claude respawn --all`.
+
+###
+
+
+
+Row summaries
+
+The one-line summary in each row is generated by a [Haiku-class model](</docs/en/model-config>) so the row can tell you what the session is doing, what it needs, or what it produced without opening the transcript. While a session is actively working, the summary refreshes at most once every 15 seconds, plus once when each turn ends. Each refresh is one short Haiku-class request through your normal provider, billed and handled under the same [data usage terms](</docs/en/data-usage>) as the session itself.
+
+###
+
+
+
+Pull request status
+
+When a session opens a pull request, a status dot appears at the right edge of the row, linked to the pull request in terminals that support hyperlinks. When the session has opened more than one pull request, the count appears before the dot and the color reflects whichever one most needs attention.
+
+Dot color| Pull request status
+---|---
+Yellow| Waiting on checks or review, or checks failed
+Green| Checks passed and no review is blocking
+Purple| Merged
+Grey| Draft or closed
+
+For most tasks this row is where you pick up the result: review and merge the pull request when the dot turns green.
###
@@ -107,7 +152,7 @@
Attach to a session
-Press `Enter` or `→` on a selected row to attach, or press `Alt+1` through `Alt+9` to attach directly to the Nth session in the focused group. Agent view is replaced by the full interactive session, exactly as if you had run `claude` in that directory. When you attach, Claude posts a short recap of what happened while you were away. While attached, the session behaves like any other Claude Code session: every [command](</docs/en/commands>), keyboard shortcut, and feature works. Press `←` on an empty prompt to detach and return to agent view. If a dialog has focus and isn’t responding to `←`, press `Ctrl+Z` to detach immediately. Detaching never stops a background session: `←`, `Ctrl+C`, `Ctrl+D`, `Ctrl+Z`, and `/exit` all leave it running. To end a session from inside it, run `/stop`. After you’ve dispatched or backgrounded a session, pressing `←` on an empty prompt works from any Claude Code session, not only ones you attached to from agent view. It backgrounds the current session and opens agent view with that session pre-selected, so you can switch sessions without leaving the terminal. You can turn this shortcut off in `/config`.
+Press `Enter` or `→` on a selected row to attach. Agent view is replaced by the full interactive session, exactly as if you had run `claude` in that directory. When you attach, Claude posts a short recap of what happened while you were away. While attached, the session behaves like any other Claude Code session: every [command](</docs/en/commands>), keyboard shortcut, and feature works. Press `←` on an empty prompt to detach and return to agent view. If a dialog has focus and isn’t responding to `←`, press `Ctrl+Z` to detach immediately. Detaching never stops a background session: `←`, `Ctrl+C`, `Ctrl+D`, `Ctrl+Z`, and `/exit` all leave it running. To end a session from inside it, run `/stop`. After you’ve dispatched or backgrounded a session, pressing `←` on an empty prompt works from any Claude Code session, not only ones you attached to from agent view. It backgrounds the current session and opens agent view with that session pre-selected, so you can switch sessions without leaving the terminal. You can turn this shortcut off in `/config`.
###
@@ -115,20 +160,27 @@
Organize the list
-Agent view groups sessions by state, with sessions that need input above sessions that are working or done. Press `Ctrl+S` to switch to grouping by directory instead. Your choice is saved across runs. Within a group, pin a session to the top with `Ctrl+T`, reorder with `Shift+↑` and `Shift+↓`, or press `Enter` on a group header to collapse it. To remove a session, press `Ctrl+X` to stop it and `Ctrl+X` again within two seconds to delete it. Pressing `Ctrl+X` on a group header deletes every session in that group after confirmation. Older completed sessions fold into a ”… N more” row to keep the list short. Failures and sessions with an open pull request always stay visible.
-
-###
-
-
-
-Filter the list
+Agent view groups sessions so the ones that need input are at the top, with `Ready for review` and `Needs input` above `Working` and `Completed`. These group names don’t map one-to-one to the states above: a session moves to `Ready for review` when it has an open pull request, and `Completed` collects finished, failed, and stopped sessions together. Press `Ctrl+S` to group by directory instead. Your choice persists across runs. Within a group:
+
+ * Press `Ctrl+T` to pin a session to the top
+ * Press `Shift+↑` or `Shift+↓` to reorder sessions
+ * Press `Ctrl+R` to rename a session
+ * Press `Enter` on a group header to collapse it
+
+To remove a session from the list, press `Ctrl+X` to stop it and `Ctrl+X` again within two seconds to delete it. Pressing `Ctrl+X` on a group header deletes every session in that group after confirmation. Deleting removes the session from agent view and cleans up its worktree, including any uncommitted changes in it, so push or commit work you want to keep before deleting. The conversation transcript stays on disk and remains available through `claude --resume`. Older completed sessions fold into a `… N more` row to keep the list short. Failures and sessions with an open pull request always stay visible.
+
+###
+
+
+
+Filter sessions
Type in the dispatch input to filter instead of dispatching:
Filter| Shows
---|---
`a:<name>`| Sessions running the named agent
-`s:<state>`| Sessions in the given state, such as `s:blocked` for sessions that need you
+`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
###
@@ -137,7 +189,7 @@
Keyboard shortcuts
-Press `?` in agent view to see every shortcut. The most common ones:
+Press `?` in agent view to see every shortcut in context. The table below summarizes them.
Shortcut| Action
---|---
@@ -146,8 +198,8 @@
`Space`| Open or close the peek panel for the selected session
`Shift+Enter`| Dispatch and attach immediately
`→`| Attach to the selected session
-`Alt+1`..`Alt+9`| Attach to the Nth session in the focused group
-`Tab`| Browse all subagents, or apply the highlighted suggestion
+`Alt+1`..`Alt+9`| Attach to session 1–9 in the current group
+`Tab`| On an empty input, browse all subagents. Otherwise apply the highlighted suggestion
`Ctrl+S`| Switch grouping between state and directory
`Ctrl+T`| Pin or unpin the selected session
`Ctrl+R`| Rename the selected session
@@ -172,7 +224,7 @@
From agent view
-Type a prompt in the input at the bottom of agent view and press `Enter` to start a new background session. The session is named automatically from the prompt. You can rename it later with `Ctrl+R`. Paste an image into the prompt to include a screenshot or diagram with the task. Prefix or mention parts of the prompt to control how the session starts:
+Type a prompt in the input at the bottom of agent view and press `Enter` to start a new background session. The session is named automatically from the prompt; rename it later with `Ctrl+R`. Paste an image into the prompt to include a screenshot or diagram with the task. Prefix or mention parts of the prompt to control how the session starts:
Input| Effect
---|---
@@ -183,7 +235,7 @@
`#<number>` or a pull request URL| If a session is already working on that PR, select it instead of dispatching
`Shift+Enter`| Dispatch and immediately attach to the new session
-Type `/` to dispatch a [skill](</docs/en/skills>). Packaging a recurring task as a skill lets you start the same workflow many times from agent view without retyping the prompt. Press `Tab` on an empty input to browse every dispatchable subagent, or to apply the highlighted suggestion when suggestions are showing. When the same `@name` matches both a subagent and a sibling repository, the subagent takes precedence. The first-word form without `@` also applies to any subagent name, so a prompt that begins with a word matching one of your subagent names dispatches that subagent. Use the `@` form when you want to be explicit.
+Packaging a recurring task as a [skill](</docs/en/skills>) lets you start the same workflow from agent view repeatedly without retyping the prompt. When the same `@name` matches both a subagent and a sibling repository, the subagent takes precedence. The bare first-word match also applies, so a prompt that happens to begin with one of your subagent names dispatches that subagent rather than treating the word as plain text. Use the `@` form when you want to be explicit, or start the prompt with a different word to avoid the match.
####
@@ -205,13 +257,13 @@
From inside a session
-Run `/background` or its alias `/bg` to detach the current conversation and keep it running. Pass a prompt such as `/bg run the test suite and fix any failures` to send one more instruction before detaching.
-
-###
-
-
-
-From the shell
+Run `/background` or its alias `/bg` to move the current conversation into a background session. Pass a prompt such as `/bg run the test suite and fix any failures` to give one more instruction first. Backgrounding from an interactive session starts a fresh process that resumes from the saved conversation, so running subagents and background commands do not transfer to it. Claude asks you to confirm before backgrounding when any are running. Once in the background, the session can start new subagents and background commands, and those keep running across later detach and reattach.
+
+###
+
+
+
+From your shell
Pass `--bg` to start a session that goes straight to the background:
@@ -235,7 +287,19 @@
How file edits are isolated
-Every background session, whether started from agent view, `/bg`, or `claude --bg`, starts in your working directory but is blocked from writing files there. When the session needs to edit files, Claude moves it into an isolated [git worktree](</docs/en/worktrees>) under `.claude/worktrees/` automatically, so parallel sessions can read the same checkout but each writes to its own. The block doesn’t apply when the session is already inside a worktree, when the working directory isn’t a git repository, or to writes outside the working directory. The worktree is removed when you delete the session, so merge or push the changes you want to keep before you delete. To find a session’s worktree path, peek the session or attach and check its working directory. To make a subagent always run in its own worktree regardless of how it was started, set [`isolation: worktree`](</docs/en/sub-agents#supported-frontmatter-fields>) in its frontmatter.
+Every background session, whether started from agent view, `/bg`, or `claude --bg`, starts in your working directory. Before editing files, Claude moves the session into an isolated [git worktree](</docs/en/worktrees>) under `.claude/worktrees/`, so parallel sessions can read the same checkout but each writes to its own. Claude skips this when the session is already under `.claude/worktrees/`, when the working directory isn’t a git repository, or for writes outside the working directory. Outside a git repository, sessions write to the working directory directly and aren’t isolated from each other, so avoid dispatching parallel sessions that edit the same files. The worktree is removed when you delete the session, so merge or push the changes you want to keep before you delete. To find a session’s worktree path, peek the session or attach and check its working directory. To make a subagent always run in its own worktree regardless of how it was started, set [`isolation: worktree`](</docs/en/sub-agents#supported-frontmatter-fields>) in its frontmatter.
+
+###
+
+
+
+Set the model
+
+The model name shown in the agent view header is the dispatch default. New sessions you start from the input use this model, which is the same setting [`/model`](</docs/en/model-config>) controls in any session. Each background session can run on a different model. To override it for one session:
+
+ * From the shell, pass `--model` with `claude --bg`.
+ * Attach to a running session and run `/model` there. The change persists if the session is respawned.
+ * Dispatch a [subagent](</docs/en/sub-agents>) whose frontmatter sets a `model` field.
###
@@ -251,7 +315,7 @@
Manage sessions from the shell
-Every background session has a short ID you can use from the shell. These commands are useful for scripting or when you don’t want to open agent view.
+Every background session has a short ID you can use from the shell. The ID is printed when you start a session with `claude --bg`, and each session’s ID is its directory name under `~/.claude/jobs/`. These commands are useful for scripting or when you don’t want to open agent view.
Command| Purpose
---|---
@@ -261,7 +325,7 @@
`claude stop <id>`| Stop a session. Also accepts `claude kill`
`claude respawn <id>`| Restart a stopped session with its conversation intact
`claude respawn --all`| Restart every stopped session
-`claude rm <id>`| Remove a session from the list
+`claude rm <id>`| Remove a session from the list. Cleans up its worktree if there are no uncommitted changes
##
@@ -269,7 +333,23 @@
How background sessions are hosted
-Background sessions are hosted by a per-user supervisor process, separate from your terminal and from agent view. It starts automatically the first time you background a session or open agent view, and you don’t manage it directly. The supervisor and its sessions authenticate with the same credentials as your interactive sessions and make no additional network connections beyond the model API. Each background session is its own Claude Code process, parented to the supervisor rather than to your terminal. A session that’s actively working, waiting for your input, or has a terminal attached keeps its process running. Once a session finishes and sits unattached for about an hour, the supervisor stops its process to free resources. The transcript and state stay on disk, and the next time you attach, peek, or reply, the supervisor starts a fresh process from where it left off. When every session has finished and no terminal is connected, the supervisor itself exits and starts again the next time you background a session or open agent view. The supervisor watches the installed Claude Code binary on disk and restarts into the new version after the regular [auto-updater](</docs/en/setup#auto-updates>) replaces it. This is a local file watch, not a network check. Background sessions are detached processes, so they keep running through the restart and the new supervisor reconnects to them. Session state is stored under your Claude Code config directory. If you set [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>), the supervisor uses that directory instead of `~/.claude` and runs as a separate instance with its own sessions.
+Every session listed in agent view is considered a background session, whether or not you’re currently attached to it. By contrast, a session started by running `claude` directly is tied to that terminal and ends when it closes, unless you send it to the background.
+
+###
+
+
+
+The supervisor process
+
+Background sessions are hosted by a per-user supervisor process, separate from your terminal and from agent view. The supervisor starts automatically the first time you background a session or open agent view, and you don’t manage it directly. The supervisor and its sessions authenticate with the same credentials as your interactive sessions and make no additional network connections beyond the model API. Each background session is its own Claude Code process, managed by the supervisor rather than tied to your terminal. A session that’s actively working, waiting for your input, or has a terminal attached keeps its process running. Once a session finishes and sits unattached for about an hour, the supervisor stops its process to free resources. The transcript and state stay on disk, and the next time you attach, peek, or reply, the supervisor starts a fresh process from where it left off. When every session has finished and no terminal is connected, the supervisor itself exits and starts again the next time you need it. The supervisor watches the installed Claude Code binary on disk and restarts into the new version after the regular [auto-updater](</docs/en/setup#auto-updates>) replaces it. This is a local file watch, not a network check. Background sessions are detached processes, so they keep running through the restart and the new supervisor reconnects to them.
+
+###
+
+
+
+Where state is stored
+
+Session state is stored under your Claude Code config directory. If you set [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>), the supervisor uses that directory instead of `~/.claude` and runs as a separate instance with its own sessions.
Path| Contents
---|---
@@ -277,6 +357,12 @@
`~/.claude/daemon/roster.json`| List of running background sessions, used to reconnect after a restart
`~/.claude/jobs/<id>/state.json`| Per-session state shown in agent view
+###
+
+
+
+Turn off agent view
+
To turn off background agents and agent view entirely, set the `disableAgentView` [setting](</docs/en/settings>) to `true` or set the `CLAUDE_CODE_DISABLE_AGENT_VIEW` environment variable. Administrators can enforce this through [managed settings](</docs/en/permissions#managed-settings>).
##
@@ -289,6 +375,14 @@
+`claude agents` lists subagents instead of opening agent view
+
+If `claude agents` prints a count followed by your configured subagents and then exits, agent view is unavailable in your environment. Earlier versions didn’t open agent view in every environment, including when connected through Bedrock, Vertex AI, or Foundry. Run `claude update` to install the latest version. If agent view still does not open after updating, check whether it has been turned off by a setting or environment variable.
+
+###
+
+
+
Agent view opens with no sessions
Agent view is empty until you dispatch your first session. Type a prompt in the input at the bottom and press `Enter`.
@@ -297,9 +391,25 @@
-Sessions show as stopped after waking your machine
-
-Background sessions don’t survive sleep or shutdown. Attach, peek, or reply to any stopped session and it restarts from where it left off. To restart all of them at once, run `claude respawn --all`.
+Cannot open agents because background tasks are running
+
+If pressing `←` to background the current session shows `Cannot open agents — N background task(s) running`, the session has in-flight work such as a subagent, a workflow, or a background shell command, and the shortcut won’t silently abandon it. Run `/tasks` to see what’s running, then `/bg` to confirm abandoning them. See From inside a session for what does and doesn’t transfer when you background.
+
+###
+
+
+
+Prompt rejected as too short
+
+The dispatch input expects a task description, not a conversational opener. A prompt shorter than four characters is rejected with a `Too short` hint so a stray keystroke doesn’t start a session. Describe what you want the session to do, such as `investigate the flaky checkout test`.
+
+###
+
+
+
+Sessions show as failed after waking your machine
+
+Background sessions don’t survive sleep or shutdown, so sessions that were running show as failed after you wake. Attach, peek, or reply to any of them and the session restarts from where it left off. To restart all of them at once, run `claude respawn --all`.
###
@@ -323,7 +433,7 @@
Limitations
-Agent view is a research preview. Current limitations to be aware of:
+Agent view is in research preview with the following limitations:
* **Rate limits apply** : background sessions consume your subscription usage the same as interactive sessions, so running ten agents in parallel uses quota roughly ten times as fast as running one.
* **Sessions are local** : background sessions run on your machine and stop if it sleeps or shuts down.
@@ -333,11 +443,10 @@
-Next steps
-
-Now that you understand agent view, explore these related features:
+Related resources
+
+For other ways to run Claude in parallel, see:
* [Run agents in parallel](</docs/en/agents>): compare agent view with subagents, agent teams, and worktrees
- * [Subagents](</docs/en/sub-agents>): define reusable agent configurations with custom prompts, tools, and isolation
* [Agent teams](</docs/en/agent-teams>): coordinate multiple sessions that message each other
* [Claude Code on the web](</docs/en/claude-code-on-the-web>): run sessions in a managed cloud environment instead of locally
--- a/changelog.md
+++ b/changelog.md
@@ -5,6 +5,26 @@
> Use this file to discover all available pages before exploring further.
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.140
+
+May 12, 2026
+
+ * Improved Agent tool `subagent_type` matching to accept case- and separator-insensitive values (e.g. `"Code Reviewer"` resolves to `code-reviewer`)
+ * Updated agent color palette
+ * Fixed `/goal` silently hanging when `disableAllHooks` or `allowManagedHooksOnly` is set — now shows a clear message instead of an indicator that never resolves
+ * Fixed a regression in settings hot-reload where symlinked settings files caused misattributed change events and spurious `ConfigChange` hooks
+ * Fixed `claude --bg` failing with “connection dropped mid-request” when the background service was about to idle-exit
+ * Fixed background service startup failing on machines with enterprise endpoint security by allowing more time
+ * Fixed remote managed settings not retrying on 401 — now retries once with a force-refreshed token
+ * Fixed managed `extraKnownMarketplaces` auto-update policy not being persisted to `known_marketplaces.json`
+ * Fixed `/loop` scheduling redundant wakeups to poll for background tasks that already notify on completion
+ * Fixed a recurring event-loop stall on Windows when a missing executable (e.g. `gh`) triggered synchronous `where.exe` re-spawns on every check
+ * Fixed `Read` tool calls failing validation when `offset` is passed as a whitespace-padded or `+`-prefixed string
+ * Fixed native terminal cursor not staying at the input caret when the terminal loses focus
+ * Plugins now warn when a default component folder (e.g. `commands/`) is silently ignored because `plugin.json` sets the matching key. Shown in `/doctor`, `claude plugin list`, and `/plugin`.
--- a/claude-code-features.md
+++ b/claude-code-features.md
@@ -41,11 +41,11 @@
Source| What it loads| Location
---|---|---
-`"project"`| Project CLAUDE.md, `.claude/rules/*.md`, project skills, project hooks, project `settings.json`| `<cwd>/.claude/` and each parent directory up to the filesystem root (stopping when a `.claude/` is found or no more parents exist)
+`"project"`| Project CLAUDE.md, `.claude/rules/*.md`, project skills, project hooks, project `settings.json`| `<cwd>/.claude/` for `settings.json` and hooks; `<cwd>` and every parent directory for CLAUDE.md and rules; `<cwd>` and every parent directory up to the repository root for skills
`"user"`| User CLAUDE.md, `~/.claude/rules/*.md`, user skills, user settings| `~/.claude/`
-`"local"`| CLAUDE.local.md (gitignored), `.claude/settings.local.json`| `<cwd>/`
-
-Omitting `settingSources` is equivalent to `["user", "project", "local"]`. The `cwd` option determines where the SDK looks for project settings. If neither `cwd` nor any of its parent directories contains a `.claude/` folder, project-level features won’t load.
+`"local"`| CLAUDE.local.md, `.claude/settings.local.json`| `<cwd>/.claude/` for `settings.local.json`; `<cwd>` and every parent directory for CLAUDE.local.md
+
+Omitting `settingSources` is equivalent to `["user", "project", "local"]`. The `cwd` option determines where the SDK looks for project-level inputs. CLAUDE.md and rules load from `<cwd>` and from every parent directory. Skills load from `<cwd>` and from every parent directory up to the repository root. Project `settings.json` and hooks load only from `<cwd>/.claude/` with no parent-directory fallback.
###
@@ -80,10 +80,10 @@
Level| Location| When loaded
---|---|---
Project (root)| `<cwd>/CLAUDE.md` or `<cwd>/.claude/CLAUDE.md`| `settingSources` includes `"project"`
-Project rules| `<cwd>/.claude/rules/*.md`| `settingSources` includes `"project"`
+Project rules| `<cwd>/.claude/rules/*.md` and `.claude/rules/*.md` in every parent directory| `settingSources` includes `"project"`
Project (parent dirs)| `CLAUDE.md` files in directories above `cwd`| `settingSources` includes `"project"`, loaded at session start
Project (child dirs)| `CLAUDE.md` files in subdirectories of `cwd`| `settingSources` includes `"project"`, loaded on demand when the agent reads a file in that subtree
-Local (gitignored)| `<cwd>/CLAUDE.local.md`| `settingSources` includes `"local"`
+Local| `<cwd>/CLAUDE.local.md` and `CLAUDE.local.md` in every parent directory| `settingSources` includes `"local"`
User| `~/.claude/CLAUDE.md`| `settingSources` includes `"user"`
User rules| `~/.claude/rules/*.md`| `settingSources` includes `"user"`
--- a/claude-code-on-the-web.md
+++ b/claude-code-on-the-web.md
@@ -32,8 +32,10 @@
Method| How it works| Best for
---|---|---
-**GitHub App**| Install the Claude GitHub App on specific repositories during [web onboarding](</docs/en/web-quickstart>). Access is scoped per repository.| Teams that want explicit per-repo authorization
-**`/web-setup`**| Run `/web-setup` in your terminal to sync your local `gh` CLI token to your Claude account. Access matches whatever your `gh` token can see.| Individual developers who already use `gh`
+**GitHub App**| Authorize the Claude GitHub App during [web onboarding](</docs/en/web-quickstart>).| Browser onboarding; teams that want Auto-fix
+**`/web-setup`**| Run `/web-setup` in your terminal to sync your local `gh` CLI token to your Claude account.| Individual developers who already use `gh`
+
+With either method, a cloud session can access any repository the connecting GitHub account can see, not just the repositories the Claude GitHub App is installed on. App installation enables PR webhooks for Auto-fix; it is not a session-level access control. To restrict which repositories your team can reach from cloud sessions, restrict access on GitHub itself, for example by limiting team or repository membership for the connected GitHub accounts.
Either method works. [`/schedule`](</docs/en/routines>) checks for either form of access and prompts you to run `/web-setup` if neither is configured. See [Connect from your terminal](</docs/en/web-quickstart#connect-from-your-terminal>) for the `/web-setup` walkthrough. The GitHub App is required for Auto-fix, which uses the App to receive PR webhooks. If you connect with `/web-setup` and later want Auto-fix, install the App on those repositories. Team and Enterprise admins can disable `/web-setup` with the Quick web setup toggle at [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>).
@@ -781,6 +783,8 @@
* **From the mobile app** : tell Claude to auto-fix the PR, for example “watch this PR and fix any CI failures or review comments”
* **Any existing PR** : paste the PR URL into a session and tell Claude to auto-fix it
+Auto-fix is a per-PR toggle. To stop monitoring, open the CI status bar in the web session and clear the **Auto-fix** toggle, or tell Claude to stop watching the PR.
+
###
@@ -828,7 +832,7 @@
* Check [status.claude.com](<https://status.claude.com>) for cloud session incidents
* Retry after a minute, as capacity is provisioned on demand
- * Confirm your repository is reachable. Private repositories require either the GitHub App installed with access to that repository, or a `gh` token synced via `/web-setup`. See GitHub authentication options.
+ * Confirm your repository is reachable. The connecting GitHub account must have access to the repository on GitHub, either through the Claude GitHub App authorization or a `gh` token synced via `/web-setup` — installing the App on the repository is not required. See GitHub authentication options.
###
--- a/cli-reference.md
+++ b/cli-reference.md
@@ -73,7 +73,7 @@
`--disallowedTools`| Tools that are removed from the model’s context and cannot be used| `"Bash(git log *)" "Bash(git diff *)" "Edit"`
`--effort`| Set the [effort level](</docs/en/model-config#adjust-effort-level>) for the current session. Options: `low`, `medium`, `high`, `xhigh`, `max`; available levels depend on the model. Overrides the [`effortLevel`](</docs/en/settings#available-settings>) setting for this session and does not persist| `claude --effort high`
`--enable-auto-mode`| Removed in v2.1.111. Auto mode is now in the `Shift+Tab` cycle by default; use `--permission-mode auto` to start in it| `claude --permission-mode auto`
-`--exclude-dynamic-system-prompt-sections`| Move per-machine sections from the system prompt (working directory, environment info, memory paths, git status) into the first user message. Improves prompt-cache reuse across different users and machines running the same task. Only applies with the default system prompt; ignored when `--system-prompt` or `--system-prompt-file` is set. Use with `-p` for scripted, multi-user workloads| `claude -p --exclude-dynamic-system-prompt-sections "query"`
+`--exclude-dynamic-system-prompt-sections`| Move per-machine sections from the system prompt (working directory, environment info, memory paths, git-repo flag) into the first user message. Improves prompt-cache reuse across different users and machines running the same task. Only applies with the default system prompt; ignored when `--system-prompt` or `--system-prompt-file` is set. Use with `-p` for scripted, multi-user workloads| `claude -p --exclude-dynamic-system-prompt-sections "query"`
`--fallback-model`| Enable automatic fallback to specified model when default model is overloaded (print mode only)| `claude -p --fallback-model sonnet "query"`
`--fork-session`| When resuming, create a new session ID instead of reusing the original (use with `--resume` or `--continue`)| `claude --resume abc123 --fork-session`
`--from-pr`| Resume sessions linked to a specific pull request. Accepts a PR number, a GitHub or GitHub Enterprise PR URL, a GitLab merge request URL, or a Bitbucket pull request URL. Sessions are linked automatically when Claude creates the pull request| `claude --from-pr 123`
@@ -134,7 +134,7 @@
`--append-system-prompt`| Appends to the default prompt| `claude --append-system-prompt "Always use TypeScript"`
`--append-system-prompt-file`| Appends file contents to the default prompt| `claude --append-system-prompt-file ./style-rules.txt`
-`--system-prompt` and `--system-prompt-file` are mutually exclusive. The append flags can be combined with either replacement flag. For most use cases, use an append flag. Appending preserves Claude Code’s built-in capabilities while adding your requirements. Use a replacement flag only when you need complete control over the system prompt.
+`--system-prompt` and `--system-prompt-file` are mutually exclusive. The append flags can be combined with either replacement flag. Choose based on whether Claude Code’s default identity still fits your task. Use an append flag when Claude should remain a coding assistant that also follows your extra rules: per-invocation instructions, output formatting, or domain context for a `-p` script. Appending preserves the default tool guidance, safety instructions, and coding conventions, so you only supply what differs. Use a replacement flag when the surface, identity, or permission model differs from Claude Code’s, like a non-coding agent in a pipeline that no human watches. Replacing drops all of the default prompt, including tool guidance and safety instructions, so you take responsibility for whatever your task still needs. These flags apply only to the current invocation. For persistent personas you can switch between and share across a project, use [output styles](</docs/en/output-styles>). For project conventions Claude should always follow, use [CLAUDE.md](</docs/en/memory>). The [Agent SDK guide on system prompts](</docs/en/agent-sdk/modifying-system-prompts#decide-on-a-starting-point>) covers the same decision in more depth.
##
--- a/commands.md
+++ b/commands.md
@@ -47,7 +47,7 @@
`/diff`| Open an interactive diff viewer showing uncommitted changes and per-turn diffs. Use left/right arrows to switch between the current git diff and individual Claude turns, and up/down to browse files
`/doctor`| Diagnose and verify your Claude Code installation and settings. Results show with status icons. Press `f` to have Claude fix any reported issues
`/effort [level|auto]`| Set the model [effort level](</docs/en/model-config#adjust-effort-level>). Accepts `low`, `medium`, `high`, `xhigh`, or `max`; available levels depend on the model and `max` is session-only. `auto` resets to the model default. Without an argument, opens an interactive slider; use left and right arrows to pick a level and `Enter` to apply. Takes effect immediately without waiting for the current response to finish
-`/exit`| Exit the CLI. Alias: `/quit`
+`/exit`| Exit the CLI. In an attached [background session](</docs/en/agent-view#attach-to-a-session>), this detaches and the session keeps running. Alias: `/quit`
`/export [filename]`| Export the current conversation as plain text. With a filename, writes directly to that file. Without, opens a dialog to copy to clipboard or save to a file
`/extra-usage`| Configure extra usage to keep working when rate limits are hit
`/fast [on|off]`| Toggle [fast mode](</docs/en/fast-mode>) on or off
--- a/data-usage.md
+++ b/data-usage.md
@@ -46,7 +46,7 @@
* **No** : declines without sending anything
* **Don’t ask again** : declines and stops this follow-up from appearing in future sessions
-Nothing is uploaded unless you explicitly select **Yes**. Organizations with [zero data retention](</docs/en/zero-data-retention>), or where product feedback is disabled by organization policy, never see this follow-up. Your responses to this survey, including session transcripts submitted after the rating prompt, do not impact your data training preferences and cannot be used to train our AI models. To disable these surveys, set `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY=1`. The survey is also disabled when `DISABLE_TELEMETRY` or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set. To control frequency instead of disabling, set [`feedbackSurveyRate`](</docs/en/settings#available-settings>) in your settings file to a probability between `0` and `1`.
+Nothing is uploaded unless you explicitly select **Yes**. Organizations with [zero data retention](</docs/en/zero-data-retention>), or where product feedback is disabled by organization policy, or where `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set, never see this follow-up. Your responses to this survey, including session transcripts submitted after the rating prompt, do not impact your data training preferences and cannot be used to train our AI models. To disable these surveys, set `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY=1`. The survey is also disabled when `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set. Organizations that block nonessential traffic but capture survey responses through their own [OpenTelemetry collector](</docs/en/monitoring-usage>) can opt the survey back in by setting `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL=1`. The survey then logs ratings to the configured collector only. The transcript-share follow-up and all other Anthropic-bound feedback traffic stay disabled. To control frequency instead of disabling, set [`feedbackSurveyRate`](</docs/en/settings#available-settings>) in your settings file to a probability between `0` and `1`.
###
--- a/discover-plugins.md
+++ b/discover-plugins.md
@@ -370,7 +370,7 @@
3. Choose a marketplace from the list
4. Select **Enable auto-update** or **Disable auto-update**
-Official Anthropic marketplaces have auto-update enabled by default. Third-party and local development marketplaces have auto-update disabled by default. To disable all automatic updates entirely for both Claude Code and all plugins, set the `DISABLE_AUTOUPDATER` environment variable. See [Auto updates](</docs/en/setup#auto-updates>) for details. To keep plugin auto-updates enabled while disabling Claude Code auto-updates, set `FORCE_AUTOUPDATE_PLUGINS=1` along with `DISABLE_AUTOUPDATER`:
+Official Anthropic marketplaces have auto-update enabled by default. Third-party and local development marketplaces have auto-update disabled by default. Administrators can also set `"autoUpdate": true` on each [`extraKnownMarketplaces`](</docs/en/settings#extraknownmarketplaces>) entry in managed settings to enable auto-update for an organization marketplace without requiring each user to toggle it. To disable all automatic updates entirely for both Claude Code and all plugins, set the `DISABLE_AUTOUPDATER` environment variable. See [Auto updates](</docs/en/setup#auto-updates>) for details. To keep plugin auto-updates enabled while disabling Claude Code auto-updates, set `FORCE_AUTOUPDATE_PLUGINS=1` along with `DISABLE_AUTOUPDATER`:
export DISABLE_AUTOUPDATER=1
export FORCE_AUTOUPDATE_PLUGINS=1
--- a/env-vars.md
+++ b/env-vars.md
@@ -79,7 +79,7 @@
`CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session
`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip Anthropic-specific `anthropic-beta` request headers and beta tool-schema fields (such as `defer_loading` and `eager_input_streaming`) from API requests. Use this when a proxy gateway rejects requests with errors like “Unexpected value(s) for the `anthropic-beta` header” or “Extra inputs are not permitted”. Standard fields (`name`, `description`, `input_schema`, `cache_control`) are preserved.
`CLAUDE_CODE_DISABLE_FAST_MODE`| Set to `1` to disable [fast mode](</docs/en/fast-mode>)
-`CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY` or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set. To set a sample rate instead of disabling outright, use the [`feedbackSurveyRate`](</docs/en/settings#available-settings>) setting. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>)
+`CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set, unless `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL` opts back in. To set a sample rate instead of disabling outright, use the [`feedbackSurveyRate`](</docs/en/settings#available-settings>) setting. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>)
`CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING`| Set to `1` to disable file [checkpointing](</docs/en/checkpointing>). The `/rewind` command will not be able to restore code changes
`CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s system prompt. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings#available-settings>) setting when set
`CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4.0 and 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Bedrock, Vertex, or Foundry
@@ -94,8 +94,10 @@
`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_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](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) for that turn
+`CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL`| Set to `1` to route the “How is Claude doing?” session quality survey to your own [OpenTelemetry collector](</docs/en/monitoring-usage>) when Anthropic-bound nonessential traffic is blocked. Survey ratings are emitted only as OTEL events to your configured collector. No survey data is sent to Anthropic in this mode. Applies when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, `DISABLE_TELEMETRY`, or `DO_NOT_TRACK` is set, and has no effect otherwise. `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY` and the organization product feedback policy take precedence
`CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING`| Controls whether tool call inputs stream from the API as Claude generates them. With this off, a large tool input such as a long file write arrives only after Claude finishes generating it, which can look like it’s hanging. Enabled by default on the Anthropic API. On Bedrock and Vertex, enabled per model where the deployed container supports it. Set to `0` to opt out. Set to `1` to force on when routing through a proxy via `ANTHROPIC_BASE_URL`, `ANTHROPIC_VERTEX_BASE_URL`, or `ANTHROPIC_BEDROCK_BASE_URL`. Off by default on Foundry and [gateway](</docs/en/llm-gateway>) connections
`CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY`| Set to `1` to populate the `/model` picker from your gateway’s `/v1/models` endpoint when `ANTHROPIC_BASE_URL` points at an Anthropic-compatible gateway such as LiteLLM, Kong, or an internal proxy. Off by default because gateways backed by a shared API key would otherwise show every user every model the key can access. Discovered models are still filtered by the [`availableModels`](</docs/en/settings#available-settings>) allowlist
+`CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE`| Set to `1` to run [fast mode](</docs/en/fast-mode>) on Claude Opus 4.7 instead of Opus 4.6. With the variable set, `/fast` switches to Opus 4.7; without it, `/fast` continues to use Opus 4.6
`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 after Claude responds. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>)
`CLAUDE_CODE_ENABLE_TASKS`| Set to `1` to enable the task tracking system in non-interactive mode (the `-p` flag). Tasks are on by default in interactive mode. See [Task list](</docs/en/interactive-mode#task-list>)
`CLAUDE_CODE_ENABLE_TELEMETRY`| Set to `1` to enable OpenTelemetry data collection for metrics and logging. Required before configuring OTel exporters. See [Monitoring](</docs/en/monitoring-usage>)
@@ -125,6 +127,7 @@
`CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for Claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. Useful for provisioning authentication in automated environments
`CLAUDE_CODE_OAUTH_SCOPES`| Space-separated OAuth scopes the refresh token was issued with, such as `"user:profile user:inference user:sessions:claude_code"`. Required when `CLAUDE_CODE_OAUTH_REFRESH_TOKEN` is set
`CLAUDE_CODE_OAUTH_TOKEN`| OAuth access token for Claude.ai authentication. Alternative to `/login` for SDK and automated environments. Takes precedence over keychain-stored credentials. Generate one with [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>)
+`CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE`| Set to `1` to keep [fast mode](</docs/en/fast-mode>) on Claude Opus 4.6. Takes precedence over `CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE`, so set this if you need to pin Opus 4.6 regardless of how the default changes
`CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS`| Timeout in milliseconds for flushing pending OpenTelemetry spans (default: 5000). See [Monitoring](</docs/en/monitoring-usage>)
`CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS`| Interval for refreshing dynamic OpenTelemetry headers in milliseconds (default: 1740000 / 29 minutes). See [Dynamic headers](</docs/en/monitoring-usage#dynamic-headers>)
`CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS`| Timeout in milliseconds for the OpenTelemetry exporter to finish on shutdown (default: 2000). Increase if metrics are dropped at exit. See [Monitoring](</docs/en/monitoring-usage>)
@@ -139,6 +142,7 @@
`CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud environment
`CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link artifacts back to the session](</docs/en/claude-code-on-the-web#link-artifacts-back-to-the-session>)
`CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt
+`CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message injected when resuming a session that ended mid-turn. Defaults to `Continue from where you left off.`. Spawn scripts for long-running agents can set this to a more directive boot message. An empty string uses the default
`CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control
`CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts values from 1 to 20. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling
`CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Override the time budget in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks. Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. By default the budget is 1.5 seconds, automatically raised to the highest per-hook `timeout` configured in settings files, up to 60 seconds. Timeouts on plugin-provided hooks do not raise the budget
@@ -194,7 +198,7 @@
`DISABLE_PROMPT_CACHING_HAIKU`| Set to `1` to disable prompt caching for Haiku models
`DISABLE_PROMPT_CACHING_OPUS`| Set to `1` to disable prompt caching for Opus models
`DISABLE_PROMPT_CACHING_SONNET`| Set to `1` to disable prompt caching for Sonnet models
-`DISABLE_TELEMETRY`| Set to `1` to opt out of telemetry. Telemetry events do not include user data like code, file paths, or bash commands
+`DISABLE_TELEMETRY`| Set to `1` to opt out of telemetry. Telemetry events do not include user data like code, file paths, or bash commands. Also disables feature flags, so some features that are still rolling out may not be available
`DISABLE_UPDATES`| Set to `1` to block all updates including manual `claude update` and `claude install`. Stricter than `DISABLE_AUTOUPDATER`. Use when distributing Claude Code through your own channels and users should not self-update
`DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command
`DO_NOT_TRACK`| Set to `1` to opt out of telemetry. Equivalent to setting `DISABLE_TELEMETRY`. Honored as the [standard cross-tool convention](<https://consoledonottrack.com/>)
--- a/fast-mode.md
+++ b/fast-mode.md
@@ -6,18 +6,19 @@
Fast mode is in research preview. The feature, pricing, and availability may change based on feedback.
-Fast mode is a high-speed configuration for Claude Opus 4.6, making the model 2.5x faster at a higher cost per token. Toggle it on with `/fast` when you need speed for interactive work like rapid iteration or live debugging, and toggle it off when cost matters more than latency. Fast mode is not a different model. It uses the same Opus 4.6 with a different API configuration that prioritizes speed over cost efficiency. You get identical quality and capabilities, just faster responses. Fast mode is not available on Opus 4.7 or other models.
+Fast mode is a high-speed configuration for Claude Opus, making the model 2.5x faster at a higher cost per token. Toggle it on with `/fast` when you need speed for interactive work like rapid iteration or live debugging, and toggle it off when cost matters more than latency. Fast mode is not a different model. It uses Claude Opus with a different API configuration that prioritizes speed over cost efficiency. You get identical quality and capabilities, just faster responses. Fast mode is supported on Opus 4.6 and Opus 4.7. It is not available on Sonnet, Haiku, or other models.
Fast mode requires Claude Code v2.1.36 or later. Check your version with `claude --version`.
What to know:
* Use `/fast` to toggle on fast mode in Claude Code CLI. Also available via `/fast` in Claude Code VS Code Extension.
- * Fast mode for Opus 4.6 pricing is $30/150 MTok.
+ * By default, `/fast` runs on Opus 4.6. To run fast mode on Opus 4.7 instead, set the `CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE` environment variable.
+ * Fast mode pricing is $30/150 MTok on both Opus 4.6 and Opus 4.7.
* Available to all Claude Code users on subscription plans (Pro/Max/Team/Enterprise) and Claude Console.
* For Claude Code users on subscription plans (Pro/Max/Team/Enterprise), fast mode is available via extra usage only and not included in the subscription rate limits.
-This page covers how to toggle fast mode, its cost tradeoff, when to use it, requirements, per-session opt-in, and rate limit behavior.
+This page covers how to toggle fast mode, use fast mode on Opus 4.7, the cost tradeoff, when to use it, requirements, per-session opt-in, and rate limit behavior.
##
@@ -32,12 +33,38 @@
By default, fast mode persists across sessions. Administrators can configure fast mode to reset each session. See require per-session opt-in for details. For the best cost efficiency, enable fast mode at the start of a session rather than switching mid-conversation. See understand the cost tradeoff for details. When you enable fast mode:
- * If you’re on a different model, Claude Code automatically switches to Opus 4.6
+ * If you’re on a different model, Claude Code automatically switches to the fast mode model: Opus 4.6 by default, or Opus 4.7 when `CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE` is set.
* You’ll see a confirmation message: “Fast mode ON”
* A small `↯` icon appears next to the prompt while fast mode is active
* Run `/fast` again at any time to check whether fast mode is on or off
-When you disable fast mode with `/fast` again, you remain on Opus 4.6. The model does not revert to your previous model. To switch to a different model, use `/model`.
+When you disable fast mode with `/fast` again, you remain on the same Opus version that fast mode was running on. The model does not revert to your previous model. To switch to a different model, use `/model`.
+
+##
+
+
+
+Use fast mode on Opus 4.7
+
+Fast mode on Opus 4.7 requires Claude Code v2.1.139 or later.
+
+Fast mode for Claude Opus 4.7 is in research preview. It runs at the same 2.5x speed and the same price as fast mode for Opus 4.6, with no other behavior changes.
+
+On May 14, 2026, Opus 4.7 becomes the default fast mode model. Until then, opt in by setting `CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE=1`.
+
+To opt in, set `CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE=1` before launching Claude Code. With the variable set, `/fast` runs on Opus 4.7. Without it, `/fast` continues to run on Opus 4.6. You can set the variable as a shell export:
+
+ export CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE=1
+
+Or in any Claude Code [settings file](</docs/en/settings#settings-files>), including user, project, and managed settings, to scope the opt-in:
+
+ {
+ "env": {
+ "CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE": "1"
+ }
+ }
+
+Fast mode for Opus 4.6 remains available alongside Opus 4.7. The two share the same fast mode rate limit pool: usage on either model draws from the same limits. To pin fast mode to Opus 4.6 explicitly, set `CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE=1`. This variable takes precedence, so fast mode runs on Opus 4.6 regardless of whether `CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE` is set.
##
@@ -45,11 +72,12 @@
Understand the cost tradeoff
-Fast mode has higher per-token pricing than standard Opus 4.6:
+Fast mode has higher per-token pricing than standard Opus:
Mode| Input (MTok)| Output (MTok)
---|---|---
Fast mode on Opus 4.6| $30| $150
+Fast mode on Opus 4.7| $30| $150
Fast mode pricing is flat across the full 1M token context window. When you switch into fast mode mid-conversation, you pay the full fast mode uncached input token price for the entire conversation context. This costs more than if you had enabled fast mode from the start.
@@ -136,9 +164,9 @@
Handle rate limits
-Fast mode has separate rate limits from standard Opus 4.6. When you hit the fast mode rate limit or run out of extra usage:
+Fast mode has separate rate limits from standard Opus. Fast mode for Opus 4.6 and Opus 4.7 share the same rate limit pool: usage on either model draws from the same limits. When you hit the fast mode rate limit or run out of extra usage:
- 1. Fast mode automatically falls back to standard Opus 4.6
+ 1. Fast mode automatically falls back to standard speed on the same Opus version
2. The `↯` icon turns gray to indicate cooldown
3. You continue working at standard speed and pricing
4. When the cooldown expires, fast mode automatically re-enables
--- a/goal.md
+++ b/goal.md
@@ -140,7 +140,7 @@
Requirements
-`/goal` runs only in workspaces where you have accepted the trust dialog, because the evaluator is part of the hooks system. If [`disableAllHooks`](</docs/en/hooks#disable-or-remove-hooks>) is set in managed policy settings, `/goal` is unavailable. In both cases, the command tells you why instead of silently doing nothing.
+`/goal` runs only in workspaces where you have accepted the trust dialog, because the evaluator is part of the hooks system. `/goal` is also unavailable when [`disableAllHooks`](</docs/en/hooks#disable-or-remove-hooks>) is set at any settings level or when [`allowManagedHooksOnly`](</docs/en/settings#hook-configuration>) is set in managed settings. In each case, the command tells you why instead of silently doing nothing.
##
--- a/mcp.md
+++ b/mcp.md
@@ -25,13 +25,31 @@
-Popular MCP servers
-
-Here are some commonly used MCP servers you can connect to Claude Code:
-
-Use third party MCP servers at your own risk - Anthropic has not verified the correctness or security of all these servers. Make sure you trust MCP servers you are installing. Be especially careful when using MCP servers that could fetch untrusted content, as these can expose you to prompt injection risk.
-
-**Need a specific integration?** [Find hundreds more MCP servers on GitHub](<https://github.com/modelcontextprotocol/servers>), or build your own using the [MCP SDK](<https://modelcontextprotocol.io/quickstart/server>).
+Find and build MCP servers
+
+Browse reviewed connectors in the [Anthropic Directory](<https://claude.ai/directory>). Directory connectors use the same MCP infrastructure as Claude Code, so you can add any remote server listed there with `claude mcp add`.
+
+Verify you trust each server before connecting it. Servers that fetch external content can expose you to [prompt injection risk](</docs/en/security#protect-against-prompt-injection>).
+
+To build your own server, see the [MCP server guide](<https://modelcontextprotocol.io/docs/develop/build-server>) for protocol fundamentals and the [Claude connector building docs](<https://claude.com/docs/connectors/building>) for authentication, testing, and Directory submission. You can also have Claude scaffold a server for you with the official [`mcp-server-dev` plugin](<https://github.com/anthropics/claude-plugins-official/tree/main/plugins/mcp-server-dev>).
+
+1
+
+Install the plugin
+
+In a Claude Code session, run:
+
+ /plugin install mcp-server-dev@claude-plugins-official
+
+Then run `/reload-plugins` to activate it in the current session.
+
+2
+
+Run the build skill
+
+ /mcp-server-dev:build-mcp-server
+
+Claude asks about your use case and scaffolds a remote HTTP or local stdio server.
##
--- a/model-config.md
+++ b/model-config.md
@@ -257,7 +257,7 @@
Extended context
-Opus 4.7, Opus 4.6, and Sonnet 4.6 support a [1 million token context window](<https://platform.claude.com/docs/en/build-with-claude/context-windows#1m-token-context-window>) for long sessions with large codebases. Availability varies by model and plan. On Max, Team, and Enterprise plans, Opus is automatically upgraded to 1M context with no additional configuration. This applies to both Team Standard and Team Premium seats.
+Opus 4.7, Opus 4.6, and Sonnet 4.6 support a [1 million token context window](<https://platform.claude.com/docs/en/build-with-claude/context-windows#1m-token-context-window>) for long sessions with large codebases. Availability varies by model and plan. On Max, Team, and Enterprise plans, Opus is automatically upgraded to 1M context with no additional configuration. This applies to both Team Standard and Team Premium seats. Sonnet with 1M context is not part of the automatic upgrade and requires [extra usage](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) on every subscription plan, including Max.
Plan| Opus with 1M context| Sonnet with 1M context
---|---|---
Show diff (431 lines)
--- a/modifying-system-prompts.md
+++ b/modifying-system-prompts.md
@@ -4,90 +4,72 @@
>
> Use this file to discover all available pages before exploring further.
-System prompts define Claude’s behavior, capabilities, and response style. The Claude Agent SDK provides three ways to customize system prompts: using output styles (persistent, file-based configurations), appending to Claude Code’s prompt, or using a fully custom prompt.
-
-##
-
-
-
-Understanding system prompts
-
-A system prompt is the initial instruction set that shapes how Claude behaves throughout a conversation.
-
-**Default behavior:** The Agent SDK uses a **minimal system prompt** by default. It contains only essential tool instructions but omits Claude Code’s coding guidelines, response style, and project context. To include the full Claude Code system prompt, specify `systemPrompt: { type: "preset", preset: "claude_code" }` in TypeScript or `system_prompt={"type": "preset", "preset": "claude_code"}` in Python.
-
-Claude Code’s system prompt includes:
-
- * Tool usage instructions and available tools
- * Code style and formatting guidelines
- * Response tone and verbosity settings
- * Security and safety instructions
- * Context about the current working directory and environment
-
-##
-
-
-
-Methods of modification
-
-###
-
-
-
-Method 1: CLAUDE.md files (project-level instructions)
-
-CLAUDE.md files provide project-specific context and instructions that are automatically read by the Agent SDK when it runs in a directory. They serve as persistent “memory” for your project.
+System prompts define Claude’s behavior, capabilities, and response style. Start from the `claude_code` preset for CLI or IDE-like coding tools where a human watches and steers the work. Write your own prompt for agents with a different surface, identity, or permission model. This page covers:
+
+ * How system prompts work, with a decision table for choosing between the preset, the preset with `append`, and a custom prompt
+ * Customize agent behavior with CLAUDE.md files, output styles, `append`, or a custom string
+ * Compare the four approaches by persistence, scope, and what they preserve
+ * Combine approaches to layer customization methods together
+
+##
+
+
+
+How system prompts work
+
+A system prompt is the initial instruction set that shapes how Claude behaves throughout a conversation. The Agent SDK has three starting points for it:
+
+ * **Minimal default** : when you don’t set `systemPrompt` in TypeScript or `system_prompt` in Python, the SDK uses a minimal prompt that covers tool calling but omits Claude Code’s coding guidelines, response style, and project context. This differs from `claude -p`, which uses the full Claude Code prompt by default. If you’re migrating from the CLI and want matching behavior, set the `claude_code` preset.
+ * **`claude_code` preset**: the full system prompt that the Claude Code CLI uses, with tool usage instructions, code style and formatting guidelines, response tone and verbosity rules, security and safety instructions, and context about the working directory and environment. Set `systemPrompt: { type: "preset", preset: "claude_code" }` in TypeScript or `system_prompt={"type": "preset", "preset": "claude_code"}` in Python, optionally with `append` to add your own instructions on the end.
+ * **Custom string** : a prompt you write yourself. The SDK sends only what you provide.
+
+###
+
+
+
+Decide on a starting point
+
+The deciding factor is how closely your agent resembles Claude Code: a coding agent operating in a repository, with a human watching streaming output and steering the work. The further your product is from that, the more you’ll want to write your own prompt.
+
+You’re building| Use| What you get
+---|---|---
+A CLI or IDE-like coding tool where a human watches and steers, and Claude Code’s defaults are what you want| `claude_code` preset| The full Claude Code prompt: tool guidance, safety rules, terminal-friendly responses, repo-convention awareness
+The same kind of tool, plus product-specific rules like coding standards, output format, or domain context| `claude_code` preset with `append`| Everything above, with your instructions added after the preset. Nothing is removed, so this is the lowest-risk customization
+An agent with a different surface, identity, or permission model, or a non-coding agent| Custom prompt string| Only what you write. You take responsibility for replacing the tool guidance and safety instructions your agent still needs
+A thin tool-calling loop with no agent persona, where you supply all behavior in the user prompt| No `systemPrompt` option| The minimal default: tool-calling support and nothing else
+
+“Different from Claude Code” usually means one of the following:
+
+ * **Different surface** : the output isn’t read in a terminal by the person who triggered it. Chat UIs, structured-output consumers, and non-coding automation each need a prompt that matches how their output is rendered and reviewed. Unattended coding automation, like a CI job that fixes lint errors or reviews diffs, still fits the preset because the work itself is what the preset is written for.
+ * **Different identity** : the agent shouldn’t present itself as Claude Code. A support bot, a data-analysis assistant, or any domain-specific agent needs its own name, scope, and persona.
+ * **Different permission model** : the agent runs autonomously without a human approving each step, or operates on a narrow set of resources. Claude Code’s prompt assumes a human is in the loop with access to a full toolset.
+ * **Non-coding tasks** : most of Claude Code’s prompt is coding guidance. For research, content, or operations agents, that guidance competes with the instructions you actually need.
+
+The comparison table shows what each customization method preserves.
+
+##
+
+
+
+Customize agent behavior
+
+Output styles, `append`, and a custom prompt string each change the system prompt directly. CLAUDE.md takes a different path: the SDK reads it and injects its content into the conversation as project context, not into the system prompt, so it shapes behavior alongside whichever system prompt you choose. [Skills](</docs/en/agent-sdk/skills>), [hooks](</docs/en/agent-sdk/hooks>), and [permissions](</docs/en/agent-sdk/permissions>) also shape behavior outside the system prompt and are covered on their own pages.
+
+###
+
+
+
+CLAUDE.md files for project-level instructions
+
+CLAUDE.md files give Claude persistent project context and instructions. The SDK injects their content into the conversation, not into the system prompt, so they work with any system prompt configuration. For what to put in CLAUDE.md, where to place it, and how to write effective instructions, see [How Claude remembers your project](</docs/en/memory>). This section covers what’s specific to the SDK: how CLAUDE.md loads. The SDK reads CLAUDE.md when the matching setting source is enabled: `'project'` loads `CLAUDE.md` or `.claude/CLAUDE.md` from the working directory, and `'user'` loads `~/.claude/CLAUDE.md`. Default `query()` options enable both sources, so CLAUDE.md loads automatically. If you set `settingSources` in TypeScript or `setting_sources` in Python explicitly, include the sources you need. CLAUDE.md loading is controlled by setting sources, not by the `claude_code` preset.
####
-How CLAUDE.md works with the SDK
-
-**Location and discovery:**
-
- * **Project-level:** `CLAUDE.md` or `.claude/CLAUDE.md` in your working directory
- * **User-level:** `~/.claude/CLAUDE.md` for global instructions across all projects
-
-CLAUDE.md files are read when the corresponding setting source is enabled: `'project'` for project-level CLAUDE.md and `'user'` for `~/.claude/CLAUDE.md`. With default `query()` options both sources are enabled, so CLAUDE.md loads automatically. If you set `settingSources` (TypeScript) or `setting_sources` (Python) explicitly, include the sources you need. CLAUDE.md loading is controlled by setting sources, not by the `claude_code` preset. **Content format:** CLAUDE.md files use plain markdown and can contain:
-
- * Coding guidelines and standards
- * Project-specific context
- * Common commands or workflows
- * API conventions
- * Testing requirements
-
-####
-
-
-
-Example CLAUDE.md
-
- # Project Guidelines
-
- ## Code Style
-
- - Use TypeScript strict mode
- - Prefer functional components in React
- - Always include JSDoc comments for public APIs
-
- ## Testing
-
- - Run `npm test` before committing
- - Maintain >80% code coverage
- - Use jest for unit tests, playwright for E2E
-
- ## Commands
-
- - Build: `npm run build`
- - Dev server: `npm run dev`
- - Type check: `npm run typecheck`
-
-####
-
-
-
-Using CLAUDE.md with the SDK
+Load CLAUDE.md with the SDK
+
+To load CLAUDE.md, set `settingSources` to include the level your CLAUDE.md lives at. The example below loads a project-level CLAUDE.md alongside the `claude_code` preset, so Claude has both the full coding-agent prompt and your project’s conventions:
TypeScript
@@ -112,99 +94,58 @@
// Now Claude has access to your project guidelines from CLAUDE.md
+CLAUDE.md is persistent across all sessions in a project, shared with your team through git, and discovered automatically without code changes. It is not loaded if you pass an empty `settingSources` array.
+
+###
+
+
+
+Output styles for persistent configurations
+
+Output styles are saved configurations that modify Claude’s system prompt. They’re stored as markdown files and can be reused across sessions and projects.
+
####
-When to use CLAUDE.md
-
-**Best for:**
-
- * **Team-shared context** \- Guidelines everyone should follow
- * **Project conventions** \- Coding standards, file structure, naming patterns
- * **Common commands** \- Build, test, deploy commands specific to your project
- * **Long-term memory** \- Context that should persist across all sessions
- * **Version-controlled instructions** \- Commit to git so the team stays in sync
-
-**Key characteristics:**
-
- * ✅ Persistent across all sessions in a project
- * ✅ Shared with team via git
- * ✅ Automatic discovery (no code changes needed)
- * ⚠️ Not loaded if you pass `settingSources: []`
-
-###
-
-
-
-Method 2: Output styles (persistent configurations)
-
-Output styles are saved configurations that modify Claude’s system prompt. They’re stored as markdown files and can be reused across sessions and projects.
-
-####
-
-
-
-Creating an output style
-
-TypeScript
-
-Python
-
- import { writeFile, mkdir } from "fs/promises";
- import { join } from "path";
- import { homedir } from "os";
-
- async function createOutputStyle(name: string, description: string, prompt: string) {
- // User-level: ~/.claude/output-styles
- // Project-level: .claude/output-styles
- const outputStylesDir = join(homedir(), ".claude", "output-styles");
-
- await mkdir(outputStylesDir, { recursive: true });
-
- const content = `---
- name: ${name}
- description: ${description}
+Create an output style
+
+An output style is a markdown file with a `name` and `description` in its frontmatter, followed by the prompt content. Save it to `~/.claude/output-styles/` for a user-level style available in every project, or `.claude/output-styles/` in your repository for a project-level style you can commit and share with your team. The example below defines a code-review persona. Save it as `~/.claude/output-styles/code-reviewer.md` to make it available across projects:
+
+~/.claude/output-styles/code-reviewer.md
+
---
-
- ${prompt}`;
-
- const filePath = join(outputStylesDir, `${name.toLowerCase().replace(/\s+/g, "-")}.md`);
- await writeFile(filePath, content, "utf-8");
- }
-
- // Example: Create a code review specialist
- await createOutputStyle(
- "Code Reviewer",
- "Thorough code review assistant",
- `You are an expert code reviewer.
+ name: Code Reviewer
+ description: Thorough code review assistant
+ ---
+
+ You are an expert code reviewer.
For every code submission:
1. Check for bugs and security issues
2. Evaluate performance
3. Suggest improvements
- 4. Rate code quality (1-10)`
- );
+ 4. Rate code quality (1-10)
####
-Using output styles
+Activate an output style
Once created, activate output styles via:
- * **CLI** : `/config`, then select Output style
+ * **CLI** : run `/config` and select an output style
* **Settings** : set `outputStyle` in `.claude/settings.local.json`
- * **Create new** : add a Markdown file at `~/.claude/output-styles/` or `.claude/output-styles/`; see [Create a custom output style](</docs/en/output-styles#create-a-custom-output-style>) for the format
-
-**Note for SDK users:** Output styles are loaded when you include `settingSources: ['user']` or `settingSources: ['project']` (TypeScript) / `setting_sources=["user"]` or `setting_sources=["project"]` (Python) in your options.
-
-###
-
-
-
-Method 3: Using `systemPrompt` with append
+ * **TypeScript SDK** : set `options.outputStyle` to the style’s name
+
+The Python SDK does not have an option to select an output style programmatically. For code-only deployments where you can’t write to `.claude/settings.local.json`, use `append` or a custom prompt string instead. **Note for SDK users:** Output styles are loaded when you include `settingSources: ['user']` or `settingSources: ['project']` (TypeScript) / `setting_sources=["user"]` or `setting_sources=["project"]` (Python) in your options.
+
+###
+
+
+
+Append to the `claude_code` preset
You can use the Claude Code preset with an `append` property to add your custom instructions while preserving all built-in functionality.
@@ -238,7 +179,7 @@
Improve prompt caching across users and machines
-By default, two sessions that use the same `claude_code` preset and `append` text still cannot share a prompt cache entry if they run from different working directories. This is because the preset embeds per-session context in the system prompt ahead of your `append` text: the working directory, platform and OS version, current date, git status, and auto-memory paths. Any difference in that context produces a different system prompt and a cache miss. To make the system prompt identical across sessions, set `excludeDynamicSections: true` in TypeScript or `"exclude_dynamic_sections": True` in Python. The per-session context moves into the first user message, leaving only the static preset and your `append` text in the system prompt so identical configurations share a cache entry across users and machines.
+By default, two sessions that use the same `claude_code` preset and `append` text still cannot share a prompt cache entry if they run from different working directories. This is because the preset embeds per-session context in the system prompt ahead of your `append` text: the working directory, whether it’s a git repository, the platform, the active shell, the OS version, and auto-memory paths. Any difference in that context produces a different system prompt and a cache miss. CLAUDE.md content doesn’t affect the system prompt cache because the SDK injects it into the conversation, not the system prompt. To make the system prompt identical across sessions, set `excludeDynamicSections: true` in TypeScript or `"exclude_dynamic_sections": True` in Python. The per-session context moves into the first user message, leaving only the static preset and your `append` text in the system prompt so identical configurations share a cache entry across users and machines.
`excludeDynamicSections` requires `@anthropic-ai/claude-agent-sdk` v0.2.98 or later, or `claude-agent-sdk` v0.1.58 or later for Python. It applies only to the preset object form and has no effect when `systemPrompt` is a string.
@@ -264,13 +205,13 @@
// ...
}
-**Tradeoffs:** the working directory, git status, and memory location still reach Claude, but as part of the first user message rather than the system prompt. Instructions in the user message carry marginally less weight than the same text in the system prompt, so Claude may rely on them less strongly when reasoning about the current directory or auto-memory paths. Enable this option when cross-session cache reuse matters more than maximally authoritative environment context. For the equivalent flag in non-interactive CLI mode, see [`--exclude-dynamic-system-prompt-sections`](</docs/en/cli-reference>).
-
-###
-
-
-
-Method 4: Custom system prompts
+**Tradeoffs:** the working directory, the git-repo flag, the platform, the active shell, the OS version, and auto-memory paths still reach Claude, but as part of the first user message rather than the system prompt. Instructions in the user message carry marginally less weight than the same text in the system prompt, so Claude may rely on them less strongly when reasoning about the current directory or auto-memory paths. Enable this option when cross-session cache reuse matters more than maximally authoritative environment context. For the equivalent flag in non-interactive CLI mode, see [`--exclude-dynamic-system-prompt-sections`](</docs/en/cli-reference>).
+
+###
+
+
+
+Custom system prompts
You can provide a custom string as `systemPrompt` to replace the default entirely with your own instructions.
@@ -306,7 +247,9 @@
-Comparison of all four approaches
+Compare the four approaches
+
+The four customization methods differ in where they live, how they’re shared, and what they preserve from the `claude_code` preset.
Feature| CLAUDE.md| Output Styles| `systemPrompt` with append| Custom `systemPrompt`
---|---|---|---|---
@@ -320,7 +263,7 @@
**Version control**| With project| Yes| With code| With code
**Scope**| Project-specific| User or project| Code session| Code session
-**Note:** “With append” means using `systemPrompt: { type: "preset", preset: "claude_code", append: "..." }` in TypeScript or `system_prompt={"type": "preset", "preset": "claude_code", "append": "..."}` in Python.
+“With append” means using `systemPrompt: { type: "preset", preset: "claude_code", append: "..." }` in TypeScript or `system_prompt={"type": "preset", "preset": "claude_code", "append": "..."}` in Python. CLAUDE.md doesn’t change the system prompt itself: the SDK injects its content into the conversation as project context.
##
@@ -334,21 +277,7 @@
When to use CLAUDE.md
-**Best for:**
-
- * Project-specific coding standards and conventions
- * Documenting project structure and architecture
- * Listing common commands (build, test, deploy)
- * Team-shared context that should be version controlled
- * Instructions that apply to all SDK usage in a project
-
-**Examples:**
-
- * “All API endpoints should use async/await patterns”
- * “Run `npm run lint:fix` before committing”
- * “Database migrations are in the `migrations/` directory”
-
-CLAUDE.md files load when the `project` setting source is enabled, which it is for default `query()` options. If you set `settingSources` (TypeScript) or `setting_sources` (Python) explicitly, include `'project'` to keep loading project-level CLAUDE.md.
+Use CLAUDE.md for instructions that should apply to every session in a project, regardless of which system prompt the session uses: coding standards, common commands, architecture context, and team conventions. CLAUDE.md is committed to your repository, so it stays in sync with the code it describes. See [When to add to CLAUDE.md](</docs/en/memory#when-to-add-to-claude-md>) for full guidance. CLAUDE.md files load when the `project` setting source is enabled, which it is for default `query()` options. If you set `settingSources` in TypeScript or `setting_sources` in Python explicitly, include `'project'` to keep loading project-level CLAUDE.md.
###
@@ -356,11 +285,11 @@
When to use output styles
-**Best for:**
+Output styles are for personas you want to reuse across the CLI and SDK without changing application code. Because they live as files in `.claude/output-styles`, the same persona is available from `/config` in the CLI and from any SDK session that loads the matching setting source. **Best for:**
* Persistent behavior changes across sessions
* Team-shared configurations
- * Specialized assistants (code reviewer, data scientist, DevOps)
+ * Specialized assistants like a code reviewer, data scientist, or DevOps assistant
* Complex prompt modifications that need versioning
**Examples:**
@@ -375,7 +304,7 @@
When to use `systemPrompt` with append
-**Best for:**
+Use `append` when the `claude_code` preset already fits your product and you only need to layer in extra instructions. You keep the preset’s tool guidance, safety rules, and coding conventions without reimplementing them. **Best for:**
* Adding specific coding standards or preferences
* Customizing output formatting
@@ -389,7 +318,7 @@
When to use custom `systemPrompt`
-**Best for:**
+Use a custom prompt when your agent’s surface, identity, or permission model differs from Claude Code’s, as described in Decide on a starting point. You define the full instruction set, including any tool guidance and safety rules your agent needs. **Best for:**
* Complete control over Claude’s behavior
* Specialized single-session tasks
@@ -401,15 +330,17 @@
-Combining approaches
-
-You can combine these methods for maximum flexibility:
-
-###
-
-
-
-Example: Output style with session-specific additions
+Combine approaches
+
+These methods compose. A persistent output style or CLAUDE.md sets the long-lived behavior, and `append` layers session-specific instructions on top without touching the saved configuration.
+
+###
+
+
+
+Combine an output style with session-specific additions
+
+The example below assumes a Code Reviewer output style is already active. The `append` block layers session-specific focus areas on top of the persona, so a single review session can prioritize OAuth and token storage without changing the saved output style:
TypeScript
@@ -445,6 +376,8 @@
See also
- * [Output styles](</docs/en/output-styles>) \- Complete output styles documentation
- * [TypeScript SDK guide](</docs/en/agent-sdk/typescript>) \- Complete SDK usage guide
- * [Configuration guide](</docs/en/settings>) \- General configuration options
+ * [Output styles](</docs/en/output-styles>): create, manage, and share output styles for the CLI, including the file format and storage locations
+ * [How Claude remembers your project](</docs/en/memory>): what to put in CLAUDE.md, where to place it, and how to write effective project instructions
+ * [TypeScript SDK reference](</docs/en/agent-sdk/typescript>): the full `Options` type, including `systemPrompt`, `settingSources`, and `outputStyle`
+ * [Python SDK reference](</docs/en/agent-sdk/python>): the full `ClaudeAgentOptions` type, including `system_prompt` and `setting_sources`
+ * [Settings](</docs/en/settings>): the `settings.json` reference, including where output styles and other configuration are stored
--- a/monitoring-usage.md
+++ b/monitoring-usage.md
@@ -959,6 +959,24 @@
* `post_tokens`: Approximate token count after compaction
* `error`: Error message when compaction failed
+####
+
+
+
+Feedback survey event
+
+Logged when a session quality survey is shown or answered. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>) for what the surveys collect and how to control them. **Event Name** : `claude_code.feedback_survey` **Attributes** :
+
+ * All standard attributes
+ * `event.name`: `"feedback_survey"`
+ * `event.timestamp`: ISO 8601 timestamp
+ * `event.sequence`: monotonically increasing counter for ordering events within a session
+ * `event_type`: Survey lifecycle event, for example `"appeared"`, `"responded"`, or `"transcript_prompt_appeared"`
+ * `appearance_id`: Unique ID linking the events emitted for one survey instance
+ * `survey_type`: Which survey produced the event. `"session"` is the “How is Claude doing?” rating prompt
+ * `response`: The user’s selection on `responded` events
+ * `enabled_via_override`: `true` when [`CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL`](</docs/en/env-vars>) is set. Emitted as a boolean, not a string. Present on `session` survey events. Filter on this attribute to confirm the override is applied across a fleet
+
##
--- a/output-styles.md
+++ b/output-styles.md
@@ -104,7 +104,7 @@
Output Styles vs. CLAUDE.md vs. —append-system-prompt
-Output styles completely “turn off” the parts of Claude Code’s default system prompt specific to software engineering. Neither CLAUDE.md nor `--append-system-prompt` edit Claude Code’s default system prompt. CLAUDE.md adds the contents as a user message _following_ Claude Code’s default system prompt. `--append-system-prompt` appends the content to the system prompt.
+Choose based on whether Claude should stop acting as a coding assistant or keep its default role and learn more. Output styles replace the software-engineering parts of Claude Code’s system prompt with your own role and voice, so use one when Claude should adopt a different identity, like a writing editor or a data-analysis assistant. CLAUDE.md and `--append-system-prompt` both keep Claude Code’s default identity and add to it, so use them when Claude should remain a coding assistant that also follows your project conventions or extra instructions. The mechanisms differ as well. Output styles edit the system prompt directly. CLAUDE.md adds its contents as a user message after the system prompt. `--append-system-prompt` appends content to the end of the system prompt without removing anything.
###
@@ -112,7 +112,7 @@
Output Styles vs. [Agents](</docs/en/sub-agents>)
-Output styles directly affect the main agent loop and only affect the system prompt. Agents are invoked to handle specific tasks and can include additional settings like the model to use, the tools they have available, and some context about when to use the agent.
+Use an output style to change how the main conversation responds in every session. Use a [subagent](</docs/en/sub-agents>) when you want a separately scoped helper that the main conversation delegates to. Output styles affect only the system prompt of the main agent loop. Agents handle specific tasks and can carry their own model, tools, and context about when to invoke them.
###
--- a/permissions.md
+++ b/permissions.md
@@ -166,7 +166,7 @@
Read-only commands
-Claude Code recognizes a built-in set of Bash commands as read-only and runs them without a permission prompt in every mode. These include `ls`, `cat`, `head`, `tail`, `grep`, `find`, `wc`, `diff`, `stat`, `du`, `cd`, and read-only forms of `git`. The set is not configurable; to require a prompt for one of these commands, add an `ask` or `deny` rule for it. Unquoted glob patterns are permitted for commands whose every flag is read-only, so `ls *.ts` and `wc -l src/*.py` run without a prompt. Commands with write-capable or exec-capable flags, such as `find`, `sort`, `sed`, and `git`, still prompt when an unquoted glob is present because the glob could expand to a flag like `-delete`. A `cd` into a path inside your working directory or an additional directory is also read-only. A compound command like `cd packages/api && ls` runs without a prompt when each part qualifies on its own. Combining `cd` with `git` in one compound command always prompts, regardless of the target directory.
+Claude Code recognizes a built-in set of Bash commands as read-only and runs them without a permission prompt in every mode. These include `ls`, `cat`, `echo`, `pwd`, `head`, `tail`, `grep`, `find`, `wc`, `which`, `diff`, `stat`, `du`, `cd`, and read-only forms of `git`. The set is not configurable; to require a prompt for one of these commands, add an `ask` or `deny` rule for it. Unquoted glob patterns are permitted for commands whose every flag is read-only, so `ls *.ts` and `wc -l src/*.py` run without a prompt. Commands with write-capable or exec-capable flags, such as `find`, `sort`, `sed`, and `git`, still prompt when an unquoted glob is present because the glob could expand to a flag like `-delete`. A `cd` into a path inside your working directory or an additional directory is also read-only. A compound command like `cd packages/api && ls` runs without a prompt when each part qualifies on its own. Combining `cd` with `git` in one compound command always prompts, regardless of the target directory.
Bash permission patterns that try to constrain command arguments are fragile. For example, `Bash(curl http://github.com/ *)` intends to restrict curl to GitHub URLs, but won’t match variations like:
@@ -324,7 +324,7 @@
Plugin settings in `.claude/settings.json`| `enabledPlugins` and `extraKnownMarketplaces` only
[CLAUDE.md](</docs/en/memory>) files, `.claude/rules/`, and `CLAUDE.local.md`| Only when `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1` is set. `CLAUDE.local.md` additionally requires the `local` setting source, which is enabled by default
-Everything else, including subagents, commands, output styles, hooks, and other settings, is discovered only from the current working directory and its parents, your user directory at `~/.claude/`, and managed settings. To share that configuration across projects, use one of these approaches:
+Subagents, commands, and output styles are discovered from the current working directory and its parents, your user directory at `~/.claude/`, and managed settings. Hooks and other `settings.json` keys load from the current working directory’s `.claude/` folder with no parent-directory fallback, alongside your user `~/.claude/settings.json` and managed settings. To share that configuration across projects, use one of these approaches:
* **User-level configuration** : place files in `~/.claude/agents/`, `~/.claude/output-styles/`, or `~/.claude/settings.json` to make them available in every project
* **Plugins** : package and distribute configuration as a [plugin](</docs/en/plugins>) that teams can install
@@ -399,7 +399,7 @@
4. **Shared project settings** (`.claude/settings.json`)
5. **User settings** (`~/.claude/settings.json`)
-If a tool is denied at any level, no other level can allow it. For example, a managed settings deny cannot be overridden by `--allowedTools`, and `--disallowedTools` can add restrictions beyond what managed settings define. If a permission is allowed in user settings but denied in project settings, the project setting takes precedence and the permission is blocked.
+If a tool is denied at any level, no other level can allow it. For example, a managed settings deny cannot be overridden by `--allowedTools`, and `--disallowedTools` can add restrictions beyond what managed settings define. Embedding hosts can supply additional managed policy via the SDK `managedSettings` option when [`parentSettingsBehavior`](</docs/en/settings#settings-precedence>) is set to `"merge"`; embedder values can tighten policy but not loosen it. If a permission is allowed in user settings but denied in project settings, the project setting takes precedence and the permission is blocked.
##
--- a/plugins.md
+++ b/plugins.md
@@ -303,6 +303,10 @@
claude --plugin-dir ./my-plugin
+The flag also accepts a `.zip` archive of the plugin directory, which requires Claude Code v2.1.128 or later.
+
+ claude --plugin-dir ./my-plugin.zip
+
When a `--plugin-dir` plugin has the same name as an installed marketplace plugin, the local copy takes precedence for that session. This lets you test changes to a plugin you already have installed without uninstalling it first. Marketplace plugins force-enabled by managed settings are the only exception and cannot be overridden. As you make changes to your plugin, run `/reload-plugins` to pick up the updates without restarting. This reloads plugins, skills, agents, hooks, plugin MCP servers, and plugin LSP servers. Test your plugin components:
* Try your skills with `/plugin-name:skill-name`
--- a/plugins-reference.md
+++ b/plugins-reference.md
@@ -508,7 +508,7 @@
* **Adds to the default** : `skills`. The default `skills/` directory is always scanned, and directories listed in `skills` are loaded alongside it
* **Own merge rules** : hooks, MCP servers, and LSP servers. See each section for how multiple sources combine
-For all path fields:
+When a plugin has both a default folder and the matching manifest key, Claude Code v2.1.140 and later flags the ignored folder in `/doctor`, `claude plugin list`, and the `/plugin` detail view. The plugin still loads using the manifest paths. No warning is shown when the manifest key points into the default folder, for example `"commands": ["./commands/deploy.md"]`, because the folder is addressed explicitly in that case. For all path fields:
* All paths must be relative to the plugin root and start with `./`
* Components from custom paths use the same naming and namespacing rules
@@ -772,7 +772,7 @@
`-s, --scope <scope>`| Uninstall from scope: `user`, `project`, or `local`| `user`
`--keep-data`| Preserve the plugin’s persistent data directory|
`--prune`| Also remove auto-installed dependencies that no other plugin requires. See plugin prune|
-`-y, --yes`| Skip the `--prune` confirmation prompt. Required when stdin is not a TTY|
+`-y, --yes`| Skip the `--prune` confirmation prompt. Required when stdin or stdout is not a TTY|
`-h, --help`| Display help for command|
**Aliases:** `remove`, `rm` By default, uninstalling from the last remaining scope also deletes the plugin’s `${CLAUDE_PLUGIN_DATA}` directory. Use `--keep-data` to preserve it, for example when reinstalling after testing a new version.
@@ -793,7 +793,7 @@
---|---|---
`-s, --scope <scope>`| Prune at scope: `user`, `project`, or `local`| `user`
`--dry-run`| List what would be removed without removing anything|
-`-y, --yes`| Skip the confirmation prompt. Required when stdin is not a TTY|
+`-y, --yes`| Skip the confirmation prompt. Required when stdin or stdout is not a TTY|
`-h, --help`| Display help for command|
**Aliases:** `autoremove` The command lists orphaned dependencies and asks for confirmation before removing them. To remove a plugin and clean up its dependencies in one step, run `claude plugin uninstall <plugin> --prune`.
Show diff (131 lines)
--- a/python.md
+++ b/python.md
@@ -1017,7 +1017,7 @@
`type`| Yes| Must be `"preset"` to use a preset system prompt
`preset`| Yes| Must be `"claude_code"` to use Claude Code’s system prompt
`append`| No| Additional instructions to append to the preset system prompt
-`exclude_dynamic_sections`| No| Move per-session context such as working directory, git status, and memory paths from the system prompt into the first user message. Improves prompt-cache reuse across users and machines. See [Modify system prompts](</docs/en/agent-sdk/modifying-system-prompts#improve-prompt-caching-across-users-and-machines>)
+`exclude_dynamic_sections`| No| Move per-session context such as working directory, the git-repo flag, and auto-memory paths from the system prompt into the first user message. Improves prompt-cache reuse across users and machines. See [Modify system prompts](</docs/en/agent-sdk/modifying-system-prompts#improve-prompt-caching-across-users-and-machines>)
###
@@ -2858,7 +2858,11 @@
TodoWrite
-**Tool name:** `TodoWrite` **Input:**
+**Tool name:** `TodoWrite`
+
+`TodoWrite` is deprecated and will be removed in a future release. Use `TaskCreate`, `TaskGet`, `TaskUpdate`, and `TaskList` instead. Set `CLAUDE_CODE_ENABLE_TASKS=1` to opt in. See [Migrate to Task tools](</docs/en/agent-sdk/todo-tracking#migrate-to-task-tools>) for how monitoring code changes.
+
+**Input:**
{
"todos": [
@@ -2875,6 +2879,106 @@
{
"message": str, # Success message
"stats": {"total": int, "pending": int, "in_progress": int, "completed": int},
+ }
+
+###
+
+
+
+TaskCreate
+
+**Tool name:** `TaskCreate` **Input:**
+
+ {
+ "subject": str, # Short task title
+ "description": str, # Detailed task body
+ "activeForm": str | None, # Present-tense label shown while in progress
+ "metadata": dict | None, # Arbitrary caller metadata
+ }
+
+**Output:**
+
+ {
+ "task": {"id": str, "subject": str}, # Created task with assigned ID
+ }
+
+###
+
+
+
+TaskUpdate
+
+**Tool name:** `TaskUpdate` **Input:**
+
+ {
+ "taskId": str, # ID of the task to patch
+ "status": Literal["pending", "in_progress", "completed", "deleted"] | None,
+ "subject": str | None,
+ "description": str | None,
+ "activeForm": str | None,
+ "addBlocks": list[str] | None, # Task IDs this task now blocks
+ "addBlockedBy": list[str] | None, # Task IDs that now block this task
+ "owner": str | None,
+ "metadata": dict | None,
+ }
+
+**Output:**
+
+ {
+ "success": bool,
+ "taskId": str,
+ "updatedFields": list[str], # Names of fields that changed
+ "error": str | None,
+ "statusChange": {"from": str, "to": str} | None,
+ }
+
+###
+
+
+
+TaskGet
+
+**Tool name:** `TaskGet` **Input:**
+
+ {
+ "taskId": str, # ID of the task to read
+ }
+
+**Output:**
+
+ {
+ "task": {
+ "id": str,
+ "subject": str,
+ "description": str,
+ "status": Literal["pending", "in_progress", "completed"],
+ "blocks": list[str],
+ "blockedBy": list[str],
+ } | None, # None when the ID is not found
+ }
+
+###
+
+
+
+TaskList
+
+**Tool name:** `TaskList` **Input:**
+
+ {}
+
+**Output:**
+
+ {
+ "tasks": [
+ {
+ "id": str,
+ "subject": str,
+ "status": Literal["pending", "in_progress", "completed"],
+ "owner": str | None,
+ "blockedBy": list[str],
+ }
+ ],
}
###
--- a/routines.md
+++ b/routines.md
@@ -332,7 +332,7 @@
Connectors
-Routines can use your connected MCP connectors to read from and write to external services during each run. For example, a routine that triages support requests might read from a Slack channel and create issues in Linear. When you create a routine, all of your currently connected connectors are included by default. Remove any that aren’t needed to limit which tools Claude has access to during the run. You can also add connectors directly from the routine form. To manage or add connectors outside of the routine form, visit **Settings > Connectors** on claude.ai or use `/schedule update` in the CLI.
+Routines can use your connected MCP connectors to read from and write to external services during each run. For example, a routine that triages support requests might read from a Slack channel and create issues in Linear. Connectors are the [claude.ai integrations](</docs/en/mcp#use-mcp-servers-from-claude-ai>) on your account. MCP servers you added locally in the CLI with `claude mcp add` are stored on your machine rather than your claude.ai account, so they do not appear in the connectors list. To use one of those servers in a routine, add it as a connector at [claude.ai/customize/connectors](<https://claude.ai/customize/connectors>), or declare it in a committed [`.mcp.json`](</docs/en/mcp#project-scope>) so it is part of the cloned repository. When you create a routine, all of your currently connected connectors are included by default. Remove any that aren’t needed to limit which tools Claude has access to during the run. You can also add connectors directly from the routine form. To manage or add connectors outside of the routine form, visit **Settings > Connectors** on claude.ai or use `/schedule update` in the CLI.
###
--- a/sandboxing.md
+++ b/sandboxing.md
@@ -104,6 +104,22 @@
sudo apt-get install bubblewrap socat
sudo dnf install bubblewrap socat
+
+On Ubuntu 24.04 and later, the default AppArmor policy prevents bubblewrap from creating the user namespaces it needs for isolation. Add an AppArmor profile that grants `bwrap` this capability:
+
+ sudo tee /etc/apparmor.d/bwrap > /dev/null <<'EOF'
+ abi <abi/4.0>,
+ include <tunables/global>
+
+ profile bwrap /usr/bin/bwrap flags=(unconfined) {
+ userns,
+ include if exists <local/bwrap>
+ }
+ EOF
+
+The profile applies only to `bwrap` itself, not to the commands it runs inside the sandbox. Reload AppArmor to apply it:
+
+ sudo systemctl reload apparmor
WSL1 does not support sandboxing because it lacks the required Linux namespace primitives. If you see `Sandboxing requires WSL2`, upgrade your distribution to WSL2 or run Claude Code without sandboxing. On WSL2, sandboxed commands cannot launch Windows binaries such as `cmd.exe`, `powershell.exe`, or anything under `/mnt/c/`. WSL hands these off to the Windows host over a Unix socket, which the sandbox blocks. If a command needs to invoke a Windows binary, add it to [`excludedCommands`](</docs/en/settings#sandbox-settings>) so it runs outside the sandbox.
--- a/security.md
+++ b/security.md
@@ -113,7 +113,7 @@
MCP security
-Claude Code allows users to configure Model Context Protocol (MCP) servers. The list of allowed MCP servers is configured in your source code, as part of Claude Code settings engineers check into source control. We encourage either writing your own MCP servers or using MCP servers from providers that you trust. You are able to configure Claude Code permissions for MCP servers. Anthropic does not manage or audit any MCP servers.
+Claude Code allows users to configure Model Context Protocol (MCP) servers. The list of allowed MCP servers is configured in your source code, as part of Claude Code settings engineers check into source control. We encourage either writing your own MCP servers or using MCP servers from providers that you trust. You are able to configure Claude Code permissions for MCP servers. Anthropic reviews connectors against its [listing criteria](<https://claude.com/docs/connectors/building/review-criteria>) before adding them to the [Anthropic Directory](<https://claude.ai/directory>), but does not security-audit or manage any MCP server.
##
--- a/server-managed-settings.md
+++ b/server-managed-settings.md
@@ -188,7 +188,7 @@
"forceRemoteSettingsRefresh": true
}
-Before enabling this setting, ensure your network policies allow connectivity to `api.anthropic.com`. If that endpoint is unreachable, the CLI exits at startup and users cannot start Claude Code.
+Before enabling this setting, ensure your network policies allow connectivity to `api.anthropic.com`. If that endpoint is unreachable, the CLI exits at startup and users cannot start Claude Code. As of v2.1.139, the `claude auth` subcommands such as `claude auth login` are exempt from this check, so users can re-authenticate when expired credentials are the reason the settings fetch fails.
###
@@ -239,7 +239,7 @@
---|---
User edits the cached settings file| Tampered file applies at startup, but correct settings restore on the next server fetch
User deletes the cached settings file| First-launch behavior occurs: settings fetch asynchronously with a brief unenforced window
-API is unavailable| Cached settings apply if available, otherwise managed settings are not enforced until the next successful fetch. With `forceRemoteSettingsRefresh: true`, the CLI exits instead of continuing
+API is unavailable| Cached settings apply if available, otherwise managed settings are not enforced until the next successful fetch. With `forceRemoteSettingsRefresh: true`, the CLI exits instead of continuing, except for `claude auth` subcommands
User authenticates with a different organization| Settings are not delivered for accounts outside the managed organization
User configures a third-party model provider| Server-managed settings are bypassed. This includes setting `CLAUDE_CODE_USE_BEDROCK`, `CLAUDE_CODE_USE_MANTLE`, `CLAUDE_CODE_USE_VERTEX`, `CLAUDE_CODE_USE_FOUNDRY`, or a non-default `ANTHROPIC_BASE_URL`
--- a/settings.md
+++ b/settings.md
@@ -270,6 +270,7 @@
`autoConnectIde`| Automatically connect to a running IDE when Claude Code starts from an external terminal. Default: `false`. Appears in `/config` as **Auto-connect to IDE (external terminal)** when running outside a VS Code or JetBrains terminal. The [`CLAUDE_CODE_AUTO_CONNECT_IDE`](</docs/en/env-vars>) environment variable overrides this when set| `true`
`autoInstallIdeExtension`| Automatically install the Claude Code IDE extension when running from a VS Code terminal. Default: `true`. Appears in `/config` as **Auto-install IDE extension** when running inside a VS Code or JetBrains terminal. You can also set the [`CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL`](</docs/en/env-vars>) environment variable| `false`
`externalEditorContext`| Prepend Claude’s previous response as `#`-commented context when you open the external editor with `Ctrl+G`. Default: `false`. Appears in `/config` as **Show last response in external editor**| `true`
+`teammateDefaultModel`| Default model for [agent team](</docs/en/agent-teams>) teammates when the spawn prompt doesn’t specify one. Set to a model alias such as `"sonnet"`, or `null` to inherit the lead’s current `/model` selection. Appears in `/config` as **Default teammate model**| `"sonnet"`
###
@@ -283,7 +284,7 @@
---|---|---
`worktree.baseRef`| Which ref new worktrees branch from. `"fresh"` (default) branches from `origin/<default-branch>` for a clean tree matching the remote. `"head"` branches from your current local `HEAD`, so unpushed commits and feature-branch state are present in the worktree. Applies to `--worktree`, the `EnterWorktree` tool, and subagent isolation| `"head"`
`worktree.symlinkDirectories`| Directories to symlink from the main repository into each worktree to avoid duplicating large directories on disk. No directories are symlinked by default| `["node_modules", ".cache"]`
-`worktree.sparsePaths`| Directories to check out in each worktree via git sparse-checkout (cone mode). Only the listed paths are written to disk, which is faster in large monorepos| `["packages/my-app", "shared/utils"]`
+`worktree.sparsePaths`| Directories to check out in each worktree via git sparse-checkout. Only the listed directories plus root-level files are written to disk, which is faster in large monorepos| `["packages/my-app", "shared/utils"]`
To copy gitignored files like `.env` into new worktrees, use a [`.worktreeinclude` file](</docs/en/worktrees#copy-gitignored-files-into-worktrees>) in your project root instead of a setting.
@@ -525,6 +526,7 @@
* Policies deployed by IT through server delivery, MDM configuration profiles, registry policies, or managed settings files
* Cannot be overridden by any other level, including command line arguments
* Within the managed tier, precedence is: server-managed > MDM/OS-level policies > file-based (`managed-settings.d/*.json` \+ `managed-settings.json`) > HKCU registry (Windows only). Only one managed source is used; sources do not merge across tiers. Within the file-based tier, drop-in files and the base file are merged together.
+ * Embedding hosts such as Claude Desktop can supply policy via the SDK `managedSettings` option. By default this is ignored when any managed-settings tier is present. Administrators can opt in by setting `parentSettingsBehavior` to `"merge"`. The embedder’s values are filtered so they can tighten managed policy but not loosen it.
2. **Command line arguments**
* Temporary overrides for a specific session. JSON passed via `--settings <file-or-json>` merges with file-based settings using the same rules as the other layers: a key set here overrides the same key in local, project, or user settings, and omitting a key leaves the lower-layer value in place
3. **Local project settings** (`.claude/settings.local.json`)
@@ -699,7 +701,7 @@
* `hostPattern`: regex pattern to match marketplace hosts (uses `hostPattern`)
* `settings`: inline marketplace declared directly in settings.json without a separate hosted repository (uses `name` and `plugins`)
-Use `source: 'settings'` to declare a small set of plugins inline without setting up a hosted marketplace repository. Plugins listed here must reference external sources such as GitHub or npm. You still need to enable each plugin separately in `enabledPlugins`.
+Each marketplace entry also accepts an optional `autoUpdate` Boolean. Set `"autoUpdate": true` alongside `source` to make Claude Code refresh that marketplace and update its installed plugins at startup. When omitted, official Anthropic marketplaces default to `true` and all other marketplaces default to `false`. See [Configure auto-updates](</docs/en/discover-plugins#configure-auto-updates>). Use `source: 'settings'` to declare a small set of plugins inline without setting up a hosted marketplace repository. Plugins listed here must reference external sources such as GitHub or npm. You still need to enable each plugin separately in `enabledPlugins`.
{
"extraKnownMarketplaces": {
--- a/skills.md
+++ b/skills.md
@@ -103,9 +103,9 @@
-Automatic discovery from nested directories
-
-When you work with files in subdirectories, Claude Code automatically discovers skills from nested `.claude/skills/` directories. For example, if you’re editing a file in `packages/frontend/`, Claude Code also looks for skills in `packages/frontend/.claude/skills/`. This supports monorepo setups where packages have their own skills. Each skill is a directory with `SKILL.md` as the entrypoint:
+Automatic discovery from parent and nested directories
+
+Project skills load from `.claude/skills/` in your starting directory and in every parent directory up to the repository root, so starting Claude in a subdirectory still picks up skills defined at the root. When you work with files in subdirectories below your starting directory, Claude Code also discovers skills from nested `.claude/skills/` directories on demand. For example, if you’re editing a file in `packages/frontend/`, Claude Code also looks for skills in `packages/frontend/.claude/skills/`. This supports monorepo setups where packages have their own skills. Each skill is a directory with `SKILL.md` as the entrypoint:
my-skill/
├── SKILL.md # Main instructions (required)
--- a/todo-tracking.md
+++ b/todo-tracking.md
@@ -5,6 +5,8 @@
> Use this file to discover all available pages before exploring further.
Todo tracking provides a structured way to manage tasks and display progress to users. The Claude Agent SDK includes built-in todo functionality that helps organize complex workflows and keep users informed about task progression.
+
+`TodoWrite` is the current default in the Agent SDK and the examples on this page use it. The replacement Task tools are available now behind `CLAUDE_CODE_ENABLE_TASKS=1` and will become the default in a future release. See Migrate to Task tools for how monitoring code changes.
###
@@ -129,6 +131,46 @@
+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. To opt in before the Task tools become the default, set `CLAUDE_CODE_ENABLE_TASKS=1` in `options.env`.
+
+With `TodoWrite`| With Task tools
+---|---
+One tool call rewrites the full `todos` array| `TaskCreate` adds one item, `TaskUpdate` patches one item by `taskId`
+Match `block.name === "TodoWrite"`| Match `block.name === "TaskCreate"` or `"TaskUpdate"`
+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. To render a complete list, watch for a `TaskList` tool result in the stream or accumulate `TaskCreate` results and `TaskUpdate` inputs into a map:
+
+TypeScript
+
+Python
+
+ import { query } from "@anthropic-ai/claude-agent-sdk";
+
+ for await (const message of query({
+ prompt: "Optimize my React app performance",
+ options: { env: { ...process.env, CLAUDE_CODE_ENABLE_TASKS: "1" } },
+ })) {
+ if (message.type !== "assistant") continue;
+ for (const block of message.message.content) {
+ if (block.type !== "tool_use") continue;
+ if (block.name === "TaskCreate") {
+ const input = block.input as { subject: string };
+ console.log(`+ ${input.subject}`);
+ } else if (block.name === "TaskUpdate") {
+ const input = block.input as { taskId: string; status?: string };
+ if (input.status) console.log(` ${input.taskId} -> ${input.status}`);
+ }
+ }
+ }
+
+##
+
+
+
Related Documentation
* [TypeScript SDK Reference](</docs/en/agent-sdk/typescript>)
--- a/tools-reference.md
+++ b/tools-reference.md
@@ -41,7 +41,7 @@
`TaskUpdate`| Updates task status, dependencies, details, or deletes tasks| No
`TeamCreate`| Creates an [agent team](</docs/en/agent-teams>) with multiple teammates. Only available when `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` is set| No
`TeamDelete`| Disbands an agent team and cleans up teammate processes. Only available when `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` is set| No
-`TodoWrite`| Manages the session task checklist. Available in non-interactive mode and the [Agent SDK](</docs/en/headless>); interactive sessions use TaskCreate, TaskGet, TaskList, and TaskUpdate instead| No
+`TodoWrite`| Manages the session task checklist. Deprecated in favor of `TaskCreate`, `TaskGet`, `TaskList`, and `TaskUpdate`. Interactive sessions already use the Task tools by default. When you run `claude -p` or use the [Agent SDK](</docs/en/agent-sdk/overview>), `TodoWrite` is still the default. Set `CLAUDE_CODE_ENABLE_TASKS=1` to switch those to the Task tools before `TodoWrite` is removed| No
`ToolSearch`| Searches for and loads deferred tools when [tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is enabled| No
`WebFetch`| Fetches content from a specified URL. See WebFetch tool behavior| Yes
`WebSearch`| Performs web searches. See WebSearch tool behavior| Yes
Show diff (189 lines)
--- a/typescript.md
+++ b/typescript.md
@@ -412,7 +412,7 @@
---|---|---|---
`options.cwd`| `string`| `process.cwd()`| Directory to resolve project and local settings relative to
`options.settingSources`| `SettingSource``[]`| All sources| Which filesystem sources to load. Pass `[]` to skip user, project, and local settings. Managed policy settings load in all cases
-`options.managedSettings`| `Settings`| `undefined`| Restrictive policy-tier settings merged at the managed-policy precedence level. Non-restrictive keys such as `model` are silently dropped
+`options.managedSettings`| `Settings`| `undefined`| Restrictive policy-tier settings supplied by the embedding host. Dropped by default when an admin-deployed managed tier is present; merged under that tier when [`parentSettingsBehavior`](</docs/en/settings#available-settings>) is `"merge"`. Non-restrictive keys such as `model` are silently dropped so this option can tighten managed policy but not loosen it
`options.serverManagedSettings`| `Settings`| `undefined`| Server-managed settings payload from `/api/claude_code/settings`. Non-restrictive keys pass through unfiltered
####
@@ -492,6 +492,7 @@
`mcpServers`| `Record<string, [`McpServerConfig`](#mcpserverconfig)>`| `{}`| MCP server configurations
`model`| `string`| Default from CLI| Claude model to use
`outputFormat`| `{ type: 'json_schema', schema: JSONSchema }`| `undefined`| Define output format for agent results. See [Structured outputs](</docs/en/agent-sdk/structured-outputs>) for details
+`outputStyle`| `string`| `undefined`| Name of an [output style](</docs/en/output-styles>) to activate for the session. The style must exist in a loaded `settingSources` location, such as `.claude/output-styles/`. See [Activate an output style](</docs/en/agent-sdk/modifying-system-prompts#activate-an-output-style>)
`pathToClaudeCodeExecutable`| `string`| Auto-resolved from bundled native binary| Path to Claude Code executable. Only needed if optional dependencies were skipped during install or your platform isn’t in the supported set
`permissionMode`| `PermissionMode`| `'default'`| Permission mode for the session
`permissionPromptToolName`| `string`| `undefined`| MCP tool name for permission prompts
@@ -2086,6 +2087,77 @@
Creates and manages a structured task list for tracking progress.
+`TodoWrite` is deprecated and will be removed in a future release. Use `TaskCreate`, `TaskGet`, `TaskUpdate`, and `TaskList` instead. Set `CLAUDE_CODE_ENABLE_TASKS=1` to opt in. See [Migrate to Task tools](</docs/en/agent-sdk/todo-tracking#migrate-to-task-tools>) for how monitoring code changes.
+
+###
+
+
+
+TaskCreate
+
+**Tool name:** `TaskCreate`
+
+ // Not yet exported from the SDK; define locally.
+ type TaskCreateInput = {
+ subject: string;
+ description: string;
+ activeForm?: string;
+ metadata?: Record<string, unknown>;
+ };
+
+Creates a single task and returns its assigned ID.
+
+###
+
+
+
+TaskUpdate
+
+**Tool name:** `TaskUpdate`
+
+ // Not yet exported from the SDK; define locally.
+ type TaskUpdateInput = {
+ taskId: string;
+ status?: "pending" | "in_progress" | "completed" | "deleted";
+ subject?: string;
+ description?: string;
+ activeForm?: string;
+ addBlocks?: string[];
+ addBlockedBy?: string[];
+ owner?: string;
+ metadata?: Record<string, unknown>;
+ };
+
+Patches one task by ID. Set `status` to `"deleted"` to remove it.
+
+###
+
+
+
+TaskGet
+
+**Tool name:** `TaskGet`
+
+ // Not yet exported from the SDK; define locally.
+ type TaskGetInput = {
+ taskId: string;
+ };
+
+Returns full details for one task, or `null` when the ID is not found.
+
+###
+
+
+
+TaskList
+
+**Tool name:** `TaskList`
+
+ // Not yet exported from the SDK; define locally.
+ type TaskListInput = {};
+
+Returns a snapshot of all tasks in the current list.
+
###
@@ -2560,6 +2632,91 @@
Returns the previous and updated task lists.
+`TodoWrite` is deprecated and will be removed in a future release. Use `TaskCreate`, `TaskGet`, `TaskUpdate`, and `TaskList` instead. Set `CLAUDE_CODE_ENABLE_TASKS=1` to opt in. See [Migrate to Task tools](</docs/en/agent-sdk/todo-tracking#migrate-to-task-tools>) for how monitoring code changes.
+
+###
+
+
+
+TaskCreate
+
+**Tool name:** `TaskCreate`
+
+ // Not yet exported from the SDK; define locally.
+ type TaskCreateOutput = {
+ task: {
+ id: string;
+ subject: string;
+ };
+ };
+
+Returns the created task with its assigned ID.
+
+###
+
+
+
+TaskUpdate
+
+**Tool name:** `TaskUpdate`
+
+ // Not yet exported from the SDK; define locally.
+ type TaskUpdateOutput = {
+ success: boolean;
+ taskId: string;
+ updatedFields: string[];
+ error?: string;
+ statusChange?: {
+ from: string;
+ to: string;
+ };
+ };
+
+Returns the update result, including which fields changed.
+
+###
+
+
+
+TaskGet
+
+**Tool name:** `TaskGet`
+
+ // Not yet exported from the SDK; define locally.
+ type TaskGetOutput = {
+ task: {
+ id: string;
+ subject: string;
+ description: string;
+ status: "pending" | "in_progress" | "completed";
+ blocks: string[];
+ blockedBy: string[];
+ } | null;
+ };
+
+Returns the full task record, or `null` when the ID is not found.
+
+###
+
+
+
+TaskList
+
+**Tool name:** `TaskList`
+
+ // Not yet exported from the SDK; define locally.
+ type TaskListOutput = {
+ tasks: Array<{
+ id: string;
+ subject: string;
+ status: "pending" | "in_progress" | "completed";
+ owner?: string;
+ blockedBy: string[];
+ }>;
+ };
+
+Returns a snapshot of all tasks in the current list.
+
###
--- a/user-input.md
+++ b/user-input.md
@@ -154,6 +154,7 @@
* **Approve** : let the tool execute as Claude requested
* **Approve with changes** : modify the input before execution (e.g., sanitize paths, add constraints)
+ * **Approve and remember** : echo a suggested permission rule back so matching calls skip the prompt next time
* **Reject** : block the tool and tell Claude why
* **Suggest alternative** : block but guide Claude toward what the user wants instead
* **Redirect entirely** : use [streaming input](</docs/en/agent-sdk/streaming-vs-single-mode>) to send Claude a completely new instruction
@@ -161,6 +162,8 @@
* Approve
* Approve with changes
+
+ * Approve and remember
* Reject
@@ -197,6 +200,26 @@
)
return PermissionResultAllow(updated_input=sandboxed_input)
return PermissionResultAllow(updated_input=input_data)
+
+The user approves and doesn’t want to be asked again for this kind of call. The third callback argument carries `suggestions`, an array of ready-made [`PermissionUpdate`](</docs/en/agent-sdk/typescript#permissionupdate>) entries. Echo one back in `updatedPermissions` to apply it. A suggestion with the `localSettings` destination writes the rule to `.claude/settings.local.json` so future sessions skip the prompt for matching calls.The Python example requires `claude-agent-sdk` 0.1.80 or later.
+
+Python
+
+TypeScript
+
+ async def can_use_tool(tool_name, input_data, context):
+ choice = await ask_user(f"Allow {tool_name}?", ["once", "always", "no"])
+
+ if choice == "always":
+ persist = [
+ s for s in context.suggestions if s.destination == "localSettings"
+ ]
+ return PermissionResultAllow(
+ updated_input=input_data, updated_permissions=persist
+ )
+ if choice == "once":
+ return PermissionResultAllow(updated_input=input_data)
+ return PermissionResultDeny(message="User declined")
The user doesn’t want this action to happen. Block the tool and provide a message explaining why. Claude sees this message and may try a different approach.
--- a/web-quickstart.md
+++ b/web-quickstart.md
@@ -212,7 +212,7 @@
No repositories appear after connecting GitHub
-The Claude GitHub App needs explicit access to each repository you want to use. On github.com, open **Settings → Applications → Claude → Configure** and verify your repo is listed under **Repository access**. Private repositories need the same authorization as public ones.
+A cloud session can use any repository the connected GitHub account can see, regardless of which repositories the Claude GitHub App is installed on. If a repository is missing, verify the connected GitHub account has access to it on GitHub. If you also want [Auto-fix](</docs/en/claude-code-on-the-web#auto-fix-pull-requests>) for a repository, install the App on it: on github.com, open **Settings → Applications → Claude → Configure** and verify the repository is listed under **Repository access**. Private repositories need the same authorization as public ones.
###
--- a/worktrees.md
+++ b/worktrees.md
@@ -80,8 +80,8 @@
When you exit a worktree session, cleanup depends on whether you made changes:
- * **No changes** : the worktree and its branch are removed automatically
- * **Changes or commits exist** : 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, discarding all uncommitted changes and commits
+ * **No uncommitted changes, no untracked files, and no new commits** : the worktree and its branch are removed automatically. If the session has a [name](</docs/en/sessions#name-your-sessions>), Claude prompts instead so you can keep the worktree for later
+ * **Uncommitted changes, untracked files, or new commits exist** : 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, discarding any uncommitted changes, untracked files, and commits
* **Non-interactive runs** : worktrees created with `--worktree` alongside `-p` are not cleaned up automatically since there is no exit prompt. Remove them with `git worktree remove`
Subagent worktrees orphaned by a crash or interrupted run are removed at startup once they are older than your [`cleanupPeriodDays`](</docs/en/settings#available-settings>) setting, provided they have no uncommitted changes, no untracked files, and no unpushed commits. Worktrees you create with `--worktree` are never removed by this sweep.