modified Week 13 · March 23–27, 2026 View current →
--- a/2026-w13.md +++ b/2026-w13.md @@ -12,7 +12,7 @@ Cycle to auto with Shift+Tab, or set it as your default: -.claude/settings.json +~/.claude/settings.json { "permissions": {
added Week 20 · May 11–15, 2026 View current →
--- a/2026-w20.md +++ b/2026-w20.md @@ -0,0 +1,69 @@ +> ## Documentation Index +> +> Fetch the complete documentation index at: <https://code.claude.com/docs/llms.txt> +> +> Use this file to discover all available pages before exploring further. + +Releases [v2.1.139 → v2.1.142](</en/changelog#2-1-139>)3 features · May 11–15 + +Agent viewresearch preview + +`claude agents` opens one screen for every Claude Code session: what’s running, what’s blocked on your input, and what’s done. Dispatch a bug fix, a pull request review, and a flaky-test investigation as three rows, keep working in another window, and step in only when a row needs you. Attach to any row to drop into its full conversation, then press `←` to return to the list. Each background session keeps running without a terminal attached. + +Open the dashboard from your shell: + +terminal + + claude agents + +[Agent view](</en/agent-view>) + +/goalv2.1.139 + +Set a completion condition and Claude keeps working toward it across turns without you prompting each step. After every turn, a fast model checks whether the condition holds; if not, Claude starts another turn instead of handing control back. Useful for substantial work with a verifiable end state, like migrating a module until every call site compiles and tests pass. The goal clears once the condition is met, and works in interactive, `-p`, and Remote Control. + +Set a goal and let Claude run until it holds: + +Claude Code + + > /goal all tests in test/auth pass and the lint step is clean + +[Goals](</en/goal>) + +Fast mode on Opus 4.7research preview + +`/fast` now runs on Opus 4.7 by default instead of Opus 4.6. Fast mode is a high-speed Opus configuration: the same model quality at about 2.5x the speed for a higher per-token cost, useful for rapid iteration and live debugging. Pricing is unchanged at 30/30/30/150 per MTok, the same as Opus 4.6 fast mode. To pin fast mode to Opus 4.6, set `CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE=1`. + +Toggle fast mode, now running on Opus 4.7: + +Claude Code + + > /fast + +[Fast mode on Opus 4.7](</en/fast-mode#use-fast-mode-on-opus-4-7>) + +Other wins + +`claude agents` gained dispatch flags (`—add-dir`, `—settings`, `—mcp-config`, `—plugin-dir`, `—permission-mode`, `—model`, `—effort`, `—dangerously-skip-permissions`) to configure background sessions, and `claude agents —cwd <path>` scopes the session list to a directory + +New hook `args: string[]` exec form spawns the command directly without a shell, so path placeholders never need quoting + +New `continueOnBlock` config option for `PostToolUse` hooks feeds the hook’s rejection reason back to Claude and continues the turn instead of ending it + +New `terminalSequence` field in hook JSON output lets hooks emit desktop notifications, window titles, and bells without a controlling terminal + +The Rewind menu added “Summarize up to here” to compress earlier context while keeping recent turns intact + +Remote Control, `/schedule`, Claude.ai MCP connectors, and notification preferences are now disabled when `ANTHROPIC_API_KEY`, `apiKeyHelper`, or `ANTHROPIC_AUTH_TOKEN` is set, even alongside a Claude.ai login; unset the API key to use these features + +MCP stdio servers now receive `CLAUDE_PROJECT_DIR` in their environment, matching hooks, and plugin configs can reference `$CLAUDE_PROJECT_DIR` in commands + +`claude plugin details <name>` shows a plugin’s component inventory and projected per-session token cost, and the `/plugin` details pane now also lists the LSP servers a plugin provides + +Plugins with a root-level `SKILL.md` and no `skills/` subdirectory are now surfaced as a skill + +`/feedback` can now include recent sessions from the last 24 hours or 7 days for issues spanning more than the current session + +Agent tool `subagent_type` now matches case- and separator-insensitively, so `“Code Reviewer”` resolves to `code-reviewer` + +[Full changelog for v2.1.139–v2.1.142 →](</docs/en/changelog#2-1-139>)
modified Manage multiple agents with agent view View current →
--- a/agent-view.md +++ b/agent-view.md @@ -115,7 +115,7 @@ `∙`| The process has exited. You can still peek, reply, or attach, and Claude restarts from where it left off `✢`| A [`/loop`](</docs/en/scheduled-tasks>) session sleeping between iterations. The row shows its run count and a countdown -The `●` that can appear at the right edge of a row is the pull request status indicator, not part of the state icon. A number before it is the count of pull requests the session has opened. Background sessions don’t need any terminal open to keep working. A separate supervisor process runs them, so you can close agent view, close your shell, or start a new interactive session and your dispatched work keeps going. Session state persists on disk through auto-updates and supervisor restarts. Sessions are also preserved when your machine sleeps. Their processes resume on wake and the supervisor reconnects to them instead of treating the time gap as idle. Shutting down still stops running sessions; see Sessions show as failed after shutdown for how to recover them. +The `●` that can appear at the right edge of a row is the pull request status indicator, not part of the state icon. A number before it is the count of pull requests the session has opened. The terminal tab title shows the awaiting-input count while agent view is open: `2 awaiting input · claude agents` when sessions need input, or `claude agents` when none do. Background sessions don’t need any terminal open to keep working. A separate supervisor process runs them, so you can close agent view, close your shell, or start a new interactive session and your dispatched work keeps going. Session state persists on disk through auto-updates and supervisor restarts. Sessions are also preserved when your machine sleeps. Their processes resume on wake and the supervisor reconnects to them instead of treating the time gap as idle. Shutting down still stops running sessions; see Sessions show as failed after shutdown for how to recover them. ### @@ -171,7 +171,7 @@ * 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 removes its conversation transcript. If Claude created a worktree for the session, deleting removes that worktree too, including any uncommitted changes in it, so push or commit work you want to keep first. A worktree you created yourself and started the session inside is left in place. 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. +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. If Claude created a worktree for the session, deleting removes that worktree too, including any uncommitted changes in it, so push or commit work you want to keep first. A worktree you created yourself and started the session inside is left in place. The conversation transcript stays on your local machine 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. ### @@ -270,7 +270,7 @@ * `--fallback-model` * `--allow-dangerously-skip-permissions` -Carrying `--allow-dangerously-skip-permissions` through keeps `bypassPermissions` reachable in the backgrounded session, but it does not grant anything new. The mode still requires the same one-time interactive acceptance described in Permission mode, model, and effort before any session can use it. +Directories you added during the session with [`/add-dir`](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) also carry through. Carrying `--allow-dangerously-skip-permissions` through keeps `bypassPermissions` reachable in the backgrounded session, but it does not grant anything new. The mode still requires the same one-time interactive acceptance described in Permission mode, model, and effort before any session can use it. ### @@ -290,9 +290,9 @@ claude --bg --name "flaky-test-fix" "investigate the flaky SettingsChangeDetector test" -After backgrounding, Claude prints the session’s short ID and the commands for managing it: - - backgrounded · 7c5dcf5d +After backgrounding, Claude prints the session’s short ID and the commands for managing it. When you pass `--name`, the name appears after the short ID: + + backgrounded · 7c5dcf5d · flaky-test-fix claude agents list sessions claude attach 7c5dcf5d open in this terminal claude logs 7c5dcf5d show recent output @@ -307,7 +307,7 @@ 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 the worktree when: * The session is already inside a linked git worktree, whether Claude created it under `.claude/worktrees/` or you created it with `git worktree add` somewhere else - * The working directory isn’t a git repository + * The working directory isn’t a git repository and no [`WorktreeCreate` hook](</docs/en/hooks#worktreecreate>) is configured * The write is outside the working directory To turn off worktree isolation for a repository where git worktrees are impractical, set [`worktree.bgIsolation`](</docs/en/settings#worktree-settings>) to `"none"`. Background sessions then edit your working copy directly without moving into a worktree first. Add the setting to the project’s `.claude/settings.json`: @@ -320,7 +320,7 @@ The `worktree.bgIsolation` setting requires Claude Code v2.1.143 or later. -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. Deleting a session in agent view (`Ctrl+X` twice) removes a worktree Claude created for it, including any uncommitted changes, so merge or push the changes you want to keep first. Deleting from the shell with `claude rm` keeps a worktree that has uncommitted changes and prints its path so you can clean it up yourself. A worktree you created yourself and started the session inside is left in place either way. 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. +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. If you use a different version control system, configure a [`WorktreeCreate` hook](</docs/en/worktrees#non-git-version-control>) and Claude isolates edits the same way it does for git. Deleting a session in agent view (`Ctrl+X` twice) removes a worktree Claude created for it, including any uncommitted changes, so merge or push the changes you want to keep first. Deleting from the shell with `claude rm` keeps a worktree that has uncommitted changes and prints its path so you can clean it up yourself. A worktree you created yourself and started the session inside is left in place either way. 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. ### @@ -328,7 +328,7 @@ 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. To override it for the whole agent view session, pass `--model` when opening agent view. See Permission mode, model, and effort. Each background session can run on a different model. To override it for one session: +The model name shown in the agent view header is the dispatch default. New sessions you start from the input use this model, which comes from the [`model` setting](</docs/en/settings#available-settings>) in your user settings. Set it by pressing `d` on a model in the [`/model` picker](</docs/en/model-config>), or edit the setting directly. To override it for the whole agent view session, pass `--model` when opening agent view. See Permission mode, model, and effort. 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. @@ -382,12 +382,13 @@ ---|--- `claude agents`| Open agent view `claude agents --cwd <path>`| Open agent view scoped to sessions started under `<path>` +`claude agents --json`| Print live sessions as a JSON array and exit. Each entry has `pid`, `cwd`, `kind`, and `startedAt`, plus `sessionId`, `name`, and `status` when set. Combine with `--cwd <path>` to filter `claude attach <id>`| Attach to a session in this terminal `claude logs <id>`| Print the session’s recent output `claude stop <id>`| Stop a session. Also accepts `claude kill` `claude respawn <id>`| Restart a session, running or stopped, with its conversation intact, e.g. to pick up an updated Claude Code binary `claude respawn --all`| Restart every running session, e.g. to move all sessions onto an updated Claude Code binary at once -`claude rm <id>`| Remove a session and its transcript. Removes a worktree Claude created for the session if it has no uncommitted changes; otherwise prints the worktree path so you can clean it up. Leaves a worktree you created yourself in place +`claude rm <id>`| Remove a session from the list. Removes a worktree Claude created for the session if it has no uncommitted changes; otherwise prints the worktree path so you can clean it up. Leaves a worktree you created yourself in place. The conversation transcript stays on your local machine and remains available through `claude --resume` `claude daemon status`| Print the supervisor’s state, version, socket directory, and worker count ## @@ -404,7 +405,7 @@ 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. +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. A running background shell command, subagent, workflow, or monitor counts as active work, so a long-running process such as a dev server keeps the session alive. 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. ###
modified Claude Code on Amazon Bedrock View current →
--- a/amazon-bedrock.md +++ b/amazon-bedrock.md @@ -196,7 +196,9 @@ # Optional: Request 1-hour prompt cache TTL instead of the 5-minute default export ENABLE_PROMPT_CACHING_1H=1 -[Prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) may not be available in all regions. Cache writes with a 1-hour TTL are billed at a higher rate than 5-minute writes. +The 1-hour cache TTL is billed at a higher rate than the 5-minute default. See [cache lifetime](</docs/en/prompt-caching#cache-lifetime>). + +Prompt caching may not be available in all Bedrock regions. If cache token counts stay at zero, check [supported models, regions, and limits](<https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-caching.html#prompt-caching-models>) in the Bedrock documentation. ####
modified Changelog View current →
--- a/changelog.md +++ b/changelog.md @@ -5,6 +5,33 @@ > 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.145 + +May 19, 2026 + + * Added `claude agents --json` to list live Claude sessions as JSON for scripting (tmux-resurrect, status bars, session pickers) + * Added `agent_id` and `parent_agent_id` attributes to `claude_code.tool` OTEL spans, and fixed trace parenting so background subagent spans nest under the dispatching Agent tool span + * Status line JSON input now includes GitHub repo and PR information when detected + * `/plugin` Discover and Browse screens now show a plugin’s commands, agents, skills, hooks, and MCP/LSP servers before installation + * `claude agents` terminal tab title now shows the awaiting-input count so an alt-tabbed window tells you when an agent needs attention + * Slash command and @-mention suggestion list now supports mouse hover and click in fullscreen mode + * Stop and SubagentStop hook input now includes `background_tasks` and `session_crons` fields + * Fixed a permission-prompt bypass where bare variable assignments to non-allowlisted environment variables in Bash commands were auto-approved + * Fixed MCP prompt slash commands showing raw server validation errors when a required argument is omitted — the error now names the missing argument and shows expected usage + * Fixed the spinner and elapsed-time display freezing until a keypress after the terminal was resized or refocused + * Fixed the cross-project resume hint failing in default Windows PowerShell 5.1 — Windows now uses `;` as the command separator + * Fixed voice push-to-talk not working in the agent view’s reply pane + * Fixed task lists rendering in random order when several tasks are created at once + * Fixed stale “Failed to install Anthropic marketplace” banner showing when the marketplace is already installed + * Fixed the PR badge in the footer not updating immediately after `gh pr create` and other PR-state-changing commands run in-session + * Fixed Agent Teams teammates with non-ASCII names failing every API call due to invalid header encoding + * Fixed `/review` using a deprecated `projectCards` GraphQL query that errored on repos with Classic Projects + * Fixed `claude plugin validate` not flagging `skills:` entries that point at a file instead of a directory — the error now suggests the parent directory + * Fixed an infinite loop where a skill using `context: fork` could repeatedly re-invoke itself instead of running + * Improved the Read tool to return a truncated first page with a “PARTIAL view” notice instead of a hard error when a whole-file read exceeds the token limit ​ @@ -40,8 +67,6 @@ * Fixed background side-queries on custom `ANTHROPIC_BASE_URL` setups and Bedrock Mantle not using Haiku — now falls back correctly when a first-party API key is configured or no Haiku model is set * Fixed scrolling in attached background sessions on Windows — PgUp/PgDn, mouse wheel, and Ctrl+O transcript navigation now work * Fixed a crash when closing the terminal while attached to a background session - * Fixed `! <cmd>` exec sessions not responding to Ctrl+C while attached — now interrupts the running command - * Fixed agent view shell-command rows lingering under Working after completion, and pressing Enter on a completed row re-running the command after its output expired * Fixed on Windows, pressing ← in `claude agents` leaving the list unresponsive to keyboard input * Fixed ghost characters at the left edge when switching panes in Agent View on Windows Terminal with CJK content * `/bg` and `←`-detach now preserve directories added via `/add-dir`
modified Channels reference View current →
--- a/channels-reference.md +++ b/channels-reference.md @@ -733,7 +733,7 @@ Package as a plugin -To make your channel installable and shareable, wrap it in a [plugin](</docs/en/plugins>) and publish it to a [marketplace](</docs/en/plugin-marketplaces>). Users install it with `/plugin install`, then enable it per session with `--channels plugin:<name>@<marketplace>`. A channel published to your own marketplace still needs `--dangerously-load-development-channels` to run, since it isn’t on the [approved allowlist](</docs/en/channels#supported-channels>). To get it added, [submit it to the official marketplace](</docs/en/plugins#submit-your-plugin-to-the-official-marketplace>). Channel plugins go through security review before being approved. On Team and Enterprise plans, an admin can instead include your plugin in the organization’s own [`allowedChannelPlugins`](</docs/en/channels#restrict-which-channel-plugins-can-run>) list, which replaces the default Anthropic allowlist. +To make your channel installable and shareable, wrap it in a [plugin](</docs/en/plugins>) and publish it to a [marketplace](</docs/en/plugin-marketplaces>). Users install it with `/plugin install`, then enable it per session with `--channels plugin:<name>@<marketplace>`. A channel published to your own marketplace still needs `--dangerously-load-development-channels` to run, since it isn’t on the [approved allowlist](</docs/en/channels#supported-channels>). The default allowlist is the channel plugins in `claude-plugins-official`, which Anthropic curates at its discretion. The [in-app submission forms](</docs/en/plugins#submit-your-plugin-to-the-community-marketplace>) add plugins to the community marketplace, which is not on the channel allowlist. If you are working with an Anthropic partner contact, reach out to them to coordinate an official-marketplace listing. On Team and Enterprise plans, an admin can instead include your plugin in the organization’s own [`allowedChannelPlugins`](</docs/en/channels#restrict-which-channel-plugins-can-run>) list, which replaces the default Anthropic allowlist. ##
modified Claude Code on Claude Platform on AWS View current →
--- a/claude-platform-on-aws.md +++ b/claude-platform-on-aws.md @@ -78,7 +78,7 @@ export ANTHROPIC_DEFAULT_SONNET_MODEL=claude-sonnet-4-6 export ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-4-5 -For the full list of model IDs and aliases, see [Models overview](<https://platform.claude.com/docs/en/about-claude/models/overview>). For other model-related variables, see [Model configuration](</docs/en/model-config>). [Prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) is enabled automatically. 1-hour cache writes are billed at a higher rate than 5-minute writes. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`. +For the full list of model IDs and aliases, see [Models overview](<https://platform.claude.com/docs/en/about-claude/models/overview>). For other model-related variables, see [Model configuration](</docs/en/model-config>). [Prompt caching](</docs/en/prompt-caching>) is enabled automatically. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`. The API bills 1-hour cache writes at a higher rate. See [prompt caching pricing](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching#pricing>) for the rates. ##
modified CLI reference View current →
--- a/cli-reference.md +++ b/cli-reference.md @@ -26,7 +26,7 @@ `claude auth login`| Sign in to your Anthropic account. Use `--email` to pre-fill your email address, `--sso` to force SSO authentication, and `--console` to sign in with Anthropic Console for API usage billing instead of a Claude subscription| `claude auth login --console` `claude auth logout`| Log out from your Anthropic account| `claude auth logout` `claude auth status`| Show authentication status as JSON. Use `--text` for human-readable output. Exits with code 0 if logged in, 1 if not| `claude auth status` -`claude agents`| Open [agent view](</docs/en/agent-view>) to monitor and dispatch parallel background sessions. Use `--cwd <path>` to show only sessions started under that directory. Pass `--permission-mode`, `--model`, or `--effort` to set [defaults for dispatched sessions](</docs/en/agent-view#permission-mode-model-and-effort>). Accepts `--settings`, `--add-dir`, `--plugin-dir`, and `--mcp-config` like the top-level `claude` command. Requires an interactive terminal| `claude agents --cwd ~/projects/my-app` +`claude agents`| Open [agent view](</docs/en/agent-view>) to monitor and dispatch parallel background sessions. Use `--cwd <path>` to show only sessions started under that directory, or `--json` to print live sessions as a JSON array for scripting. Pass `--permission-mode`, `--model`, or `--effort` to set [defaults for dispatched sessions](</docs/en/agent-view#permission-mode-model-and-effort>). Accepts `--settings`, `--add-dir`, `--plugin-dir`, and `--mcp-config` like the top-level `claude` command. Opening agent view requires an interactive terminal| `claude agents --json` `claude attach <id>`| Attach to a [background session](</docs/en/agent-view#manage-sessions-from-the-shell>) in this terminal| `claude attach 7c5dcf5d` `claude auto-mode defaults`| Print the built-in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) classifier rules as JSON. Use `claude auto-mode config` to see your effective config with settings applied| `claude auto-mode defaults > rules.json` `claude daemon status`| Print the background-session [supervisor’s](</docs/en/agent-view#the-supervisor-process>) state, version, socket directory, and worker count for diagnostics. Exits 1 if the supervisor isn’t running| `claude daemon status` @@ -36,7 +36,7 @@ `claude project purge [path]`| Delete all local Claude Code state for a project: transcripts, task lists, debug logs, file-edit history, prompt history lines, and the project’s entry in `~/.claude.json`. Omit `[path]` to pick from an interactive list. Flags: `--dry-run` to preview, `-y`/`--yes` to skip confirmation, `-i`/`--interactive` to confirm each item, `--all` for every project. See [Clear local data](</docs/en/claude-directory#clear-local-data>)| `claude project purge ~/work/repo --dry-run` `claude remote-control`| Start a [Remote Control](</docs/en/remote-control>) server to control Claude Code from Claude.ai or the Claude app. Runs in server mode (no local interactive session). See [Server mode flags](</docs/en/remote-control#start-a-remote-control-session>)| `claude remote-control --name "My Project"` `claude respawn <id>`| Restart a [background session](</docs/en/agent-view#manage-sessions-from-the-shell>), running or stopped, with its conversation intact. Use `--all` to restart every running session, e.g. to pick up an updated Claude Code binary| `claude respawn 7c5dcf5d` -`claude rm <id>`| Remove a [background session](</docs/en/agent-view#manage-sessions-from-the-shell>) from the list| `claude rm 7c5dcf5d` +`claude rm <id>`| Remove a [background session](</docs/en/agent-view#manage-sessions-from-the-shell>) from the list. The conversation transcript stays on your local machine, available through `claude --resume`| `claude rm 7c5dcf5d` `claude setup-token`| Generate a long-lived OAuth token for CI and scripts. Prints the token to the terminal without saving it. Requires a Claude subscription. See [Generate a long-lived token](</docs/en/authentication#generate-a-long-lived-token>)| `claude setup-token` `claude stop <id>`| Stop a [background session](</docs/en/agent-view#manage-sessions-from-the-shell>). Also accepts `claude kill`| `claude stop 7c5dcf5d` `claude ultrareview [target]`| Run [ultrareview](</docs/en/ultrareview#run-ultrareview-non-interactively>) non-interactively. Prints findings to stdout and exits 0 on success or 1 on failure. Use `--json` for the raw payload and `--timeout <minutes>` to override the 30-minute default| `claude ultrareview 1234 --json` @@ -71,7 +71,7 @@ `--debug`| Enable debug mode with optional category filtering (for example, `"api,hooks"` or `"!statsig,!file"`)| `claude --debug "api,mcp"` `--debug-file <path>`| Write debug logs to a specific file path. Implicitly enables debug mode. Takes precedence over `CLAUDE_CODE_DEBUG_LOGS_DIR`| `claude --debug-file /tmp/claude-debug.log` `--disable-slash-commands`| Disable all skills and commands for this session| `claude --disable-slash-commands` -`--disallowedTools`| Tools that are removed from the model’s context and cannot be used| `"Bash(git log *)" "Bash(git diff *)" "Edit"` +`--disallowedTools`| Deny rules. A bare tool name removes that tool from the model’s context. A scoped rule such as `Bash(rm *)` leaves the tool available and denies only matching calls| `"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-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"` @@ -105,7 +105,7 @@ `--remote-control`, `--rc`| Start an interactive session with [Remote Control](</docs/en/remote-control#start-a-remote-control-session>) enabled so you can also control it from claude.ai or the Claude app. Optionally pass a name for the session| `claude --remote-control "My Project"` `--remote-control-session-name-prefix <prefix>`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is set. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. Set `CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX` for the same effect| `claude remote-control --remote-control-session-name-prefix dev-box` `--replay-user-messages`| Re-emit user messages from stdin back on stdout for acknowledgment. Requires `--input-format stream-json` and `--output-format stream-json`| `claude -p --input-format stream-json --output-format stream-json --replay-user-messages` -`--resume`, `-r`| Resume a specific session by ID or name, or show an interactive picker to choose a session. Includes sessions that added this directory with `/add-dir`| `claude --resume auth-refactor` +`--resume`, `-r`| Resume a specific session by ID or name, or show an interactive picker to choose a session. Includes sessions that added this directory with `/add-dir`. As of v2.1.144, [background sessions](</docs/en/agent-view>) appear in the picker marked with `bg`| `claude --resume auth-refactor` `--session-id`| Use a specific session ID for the conversation (must be a valid UUID)| `claude --session-id "550e8400-e29b-41d4-a716-446655440000"` `--setting-sources`| Comma-separated list of setting sources to load (`user`, `project`, `local`)| `claude --setting-sources user,project` `--settings`| Path to a settings JSON file or an inline JSON string. Values you set here override the same keys in your `settings.json` files for this session. Keys you omit keep their file-based values. See [settings precedence](</docs/en/settings#settings-precedence>)| `claude --settings ./settings.json`
modified Commands View current →
--- a/commands.md +++ b/commands.md @@ -50,7 +50,7 @@ `/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 `/fast [on|off]`| Toggle [fast mode](</docs/en/fast-mode>) on or off -`/feedback [report]`| Submit feedback about Claude Code. Alias: `/bug` +`/feedback [report]`| Submit feedback, report a bug, or share your conversation. Aliases: `/bug`, `/share` `/fewer-permission-prompts`| **[Skill](</docs/en/skills#bundled-skills>).** Scan your transcripts for common read-only Bash and MCP tool calls, then add a prioritized allowlist to project `.claude/settings.json` to reduce permission prompts `/focus`| Toggle the focus view, which shows only your last prompt, a one-line tool-call summary with edit diffstats, and the final response. The selection persists across sessions; set [`viewMode`](</docs/en/settings#available-settings>) in settings to override it. Only available in [fullscreen rendering](</docs/en/fullscreen>) `/goal [condition|clear]`| Set a [goal](</docs/en/goal>): Claude keeps working across turns until the condition is met. With no argument, shows the current or most recently achieved goal. `clear`, `stop`, `off`, `reset`, `none`, or `cancel` removes an active goal early @@ -69,7 +69,7 @@ `/mcp`| Manage MCP server connections and OAuth authentication `/memory`| Edit `CLAUDE.md` memory files, enable or disable [auto-memory](</docs/en/memory#auto-memory>), and view auto-memory entries `/mobile`| Show QR code to download the Claude mobile app. Aliases: `/ios`, `/android` -`/model [model]`| Select or change the AI model. For models that support it, use left/right arrows to [adjust effort level](</docs/en/model-config#adjust-effort-level>). With no argument, opens a picker that asks for confirmation when the conversation has prior output, since the next response re-reads the full history without cached context. Once confirmed, the change applies without waiting for the current response to finish +`/model [model]`| Set the AI model for the current session. For models that support it, use left/right arrows to [adjust effort level](</docs/en/model-config#adjust-effort-level>). With no argument, opens a picker; press `d` on a row to also save that model as the default for new sessions. The picker asks for confirmation when the conversation has prior output, since the next response re-reads the full history without cached context. Once confirmed, the change applies without waiting for the current response to finish `/passes`| Share a free week of Claude Code with friends. Only visible if your account is eligible `/permissions`| Manage allow, ask, and deny rules for tool permissions. Opens an interactive dialog where you can view rules by scope, add or remove rules, manage working directories, and review [recent auto mode denials](</docs/en/auto-mode-config#review-denials>). Alias: `/allowed-tools` `/plan [description]`| Enter plan mode directly from the prompt. Pass an optional description to enter plan mode and immediately start with that task, for example `/plan fix the auth bug` @@ -84,9 +84,11 @@ `/remote-control`| Make this session available for [remote control](</docs/en/remote-control>) from claude.ai. Alias: `/rc` `/remote-env`| Configure the default remote environment for [web sessions started with `--remote`](</docs/en/claude-code-on-the-web#configure-your-environment>) `/rename [name]`| Rename the current session and show the name on the prompt bar. Without a name, auto-generates one from conversation history -`/resume [session]`| Resume a conversation by ID or name, or open the session picker. Alias: `/continue` +`/resume [session]`| Resume a conversation by ID or name, or open the session picker. As of v2.1.144, [background sessions](</docs/en/agent-view>) appear in the picker marked with `bg`. Alias: `/continue` `/review [PR]`| Review a pull request locally in your current session. For a deeper cloud-based review, see [`/ultrareview`](</docs/en/ultrareview>) `/rewind`| Rewind the conversation and/or code to a previous point, or summarize from a selected message. See [checkpointing](</docs/en/checkpointing>). Aliases: `/checkpoint`, `/undo` +`/run`| **[Skill](</docs/en/skills#bundled-skills>).** Launch and drive your project’s app to see a change working in the running app, not just in tests. See [Run and verify your app](</docs/en/skills#run-and-verify-your-app>). Requires Claude Code v2.1.145 or later +`/run-skill-generator`| **[Skill](</docs/en/skills#bundled-skills>).** Teach `/run` and `/verify` how to build, launch, and drive your project’s app from a clean environment by writing a per-project [skill](</docs/en/skills#run-and-verify-your-app>). Requires Claude Code v2.1.145 or later `/sandbox`| Toggle [sandbox mode](</docs/en/sandboxing>). Available on supported platforms only `/schedule [description]`| Create, update, list, or run [routines](</docs/en/routines>), which execute on Anthropic-managed cloud infrastructure. Claude walks you through the setup conversationally. Alias: `/routines` `/scroll-speed`| Adjust mouse wheel [scroll speed](</docs/en/fullscreen#mouse-wheel-scrolling>) interactively, with a ruler you can scroll while the dialog is open to preview the change. Available in [fullscreen rendering](</docs/en/fullscreen>) only and not in the JetBrains IDE terminal @@ -111,6 +113,7 @@ `/upgrade`| Open the upgrade page to switch to a higher plan tier `/usage`| Show session cost, plan usage limits, and activity stats. See the [cost tracking guide](</docs/en/costs#using-the-%2Fusage-command>) for subscription-specific details. `/cost` and `/stats` are aliases `/usage-credits`| Configure usage credits to keep working when you hit a limit. Previously `/extra-usage` +`/verify`| **[Skill](</docs/en/skills#bundled-skills>).** Confirm a code change does what it should by building your project’s app, running it, and observing the result, rather than relying on tests or type checks. See [Run and verify your app](</docs/en/skills#run-and-verify-your-app>). Requires Claude Code v2.1.145 or later `/vim`| Removed in v2.1.92. To toggle between Vim and Normal editing modes, use `/config` → Editor mode `/voice [hold|tap|off]`| Toggle [voice dictation](</docs/en/voice-dictation>), or enable it in a specific mode. Requires a Claude.ai account `/web-setup`| Connect your GitHub account to [Claude Code on the web](</docs/en/web-quickstart#connect-from-your-terminal>) using your local `gh` CLI credentials. `/schedule` prompts for this automatically if GitHub isn’t connected
modified Explore the context window View current →
--- a/context-window.md +++ b/context-window.md @@ -59,4 +59,5 @@ * [Store instructions and memories](</docs/en/memory>): CLAUDE.md hierarchy and auto memory * [Subagents](</docs/en/sub-agents>): delegate research to a separate context window * [Best practices](</docs/en/best-practices>): managing context as your primary constraint + * [Prompt caching](</docs/en/prompt-caching>): which actions invalidate the cached prefix * [Reduce token usage](</docs/en/costs#reduce-token-usage>): strategies for keeping context usage low
modified Manage costs effectively View current →
--- a/costs.md +++ b/costs.md @@ -80,7 +80,7 @@ Reduce token usage -Token costs scale with context size: the more context Claude processes, the more tokens you use. Claude Code automatically optimizes costs through prompt caching (which reduces costs for repeated content like system prompts) and auto-compaction (which summarizes conversation history when approaching context limits). The following strategies help you keep context small and reduce per-message costs. +Token costs scale with context size: the more context Claude processes, the more tokens you use. Claude Code automatically optimizes costs through [prompt caching](</docs/en/prompt-caching>), which reduces costs for repeated content like system prompts, and auto-compaction, which summarizes conversation history when approaching context limits. The following strategies help you keep context small and reduce per-message costs. ###
modified Give Claude custom tools View current →
--- a/custom-tools.md +++ b/custom-tools.md @@ -243,16 +243,16 @@ Configure allowed tools -The `tools` option and the allowed/disallowed lists operate on separate layers. `tools` controls which built-in tools appear in Claude’s context. Allowed and disallowed tool lists control whether calls are approved or denied once Claude attempts them. +The `tools` option and the allowed/disallowed lists affect two layers: availability, which controls whether a tool appears in Claude’s context, and permission, which controls whether a call is approved once Claude attempts it. `tools` and bare-name `disallowedTools` entries change availability. `allowedTools` and scoped `disallowedTools` rules change permission only. Option| Layer| Effect ---|---|--- `tools: ["Read", "Grep"]`| Availability| Only the listed built-ins are in Claude’s context. Unlisted built-ins are removed. MCP tools are unaffected. `tools: []`| Availability| All built-ins are removed. Claude can only use your MCP tools. allowed tools| Permission| Listed tools run without a permission prompt. Unlisted tools remain available; calls go through the [permission flow](</docs/en/agent-sdk/permissions>). -disallowed tools| Permission| Every call to a listed tool is denied. The tool stays in Claude’s context, so Claude may still attempt it before the call is rejected. - -To limit which built-ins Claude can use, prefer `tools` over disallowed tools. Omitting a tool from `tools` removes it from context so Claude never attempts it; listing it in `disallowedTools` (Python: `disallowed_tools`) blocks the call but leaves the tool visible, so Claude may waste a turn trying it. See [Configure permissions](</docs/en/agent-sdk/permissions>) for the full evaluation order. +disallowed tools| Both| A bare tool name such as `"Bash"` removes the tool from Claude’s context, the same as omitting it from `tools`. A scoped rule such as `"Bash(rm *)"` leaves the tool in context and denies only matching calls. + +To remove a built-in entirely, omit it from `tools` or list its bare name in `disallowedTools` (Python: `disallowed_tools`); both keep the tool out of context so Claude never attempts it. A scoped `disallowedTools` rule blocks matching calls but leaves the tool visible, so Claude may waste a turn trying it. See [Configure permissions](</docs/en/agent-sdk/permissions>) for the full evaluation order. ##
modified Discover and install prebuilt plugins through marketplaces View current →
--- a/discover-plugins.md +++ b/discover-plugins.md @@ -40,12 +40,7 @@ If Claude Code reports that the plugin is not found in any marketplace, your marketplace is either missing or outdated. Run `/plugin marketplace update claude-plugins-official` to refresh it, or `/plugin marketplace add anthropics/claude-plugins-official` if you haven’t added it before. Then retry the install. -The official marketplace is maintained by Anthropic. To submit a plugin to the official marketplace, use one of the in-app submission forms: - - * **Claude.ai** : [claude.ai/settings/plugins/submit](<https://claude.ai/settings/plugins/submit>) - * **Console** : [platform.claude.com/plugins/submit](<https://platform.claude.com/plugins/submit>) - -To distribute plugins independently, [create your own marketplace](</docs/en/plugin-marketplaces>) and share it with users. +The official marketplace is curated by Anthropic, and inclusion is at Anthropic’s discretion. The in-app submission forms add plugins to the community marketplace, not the official one. To distribute plugins independently, [create your own marketplace](</docs/en/plugin-marketplaces>) and share it with users. The official marketplace includes several categories of plugins: @@ -131,6 +126,22 @@ ​ +Community marketplace + +The community marketplace at [`anthropics/claude-plugins-community`](<https://github.com/anthropics/claude-plugins-community>) hosts third-party plugins that have passed Anthropic’s automated validation and safety screening. Each plugin is pinned to a specific commit SHA in the catalog. Unlike the official marketplace, you add it manually: + + /plugin marketplace add anthropics/claude-plugins-community + +Then install plugins from it using the `claude-community` marketplace name: + + /plugin install <plugin-name>@claude-community + +To submit your own plugin to the community marketplace, see [Submit your plugin to the community marketplace](</docs/en/plugins#submit-your-plugin-to-the-community-marketplace>) in the create-plugins guide. + +## + +​ + Try it: add the demo marketplace Anthropic also maintains a [demo plugins marketplace](<https://github.com/anthropics/claude-code/tree/main/plugins>) (`claude-code-plugins`) with example plugins that show what’s possible with the plugin system. Unlike the official marketplace, you need to add this one manually. @@ -162,7 +173,13 @@ Install a plugin -Select a plugin to view its details. On Claude Code v2.1.143 and later, the details pane includes a **Context cost** estimate so you can see how many tokens the plugin will add to your [context window](</docs/en/features-overview#understand-context-costs>) every turn before you install it.Choose an installation scope: +Select a plugin to view its details. The details pane shows what the plugin contains and what it costs: + + * A **Context cost** estimate so you can see how many tokens the plugin will add to your [context window](</docs/en/features-overview#understand-context-costs>) every turn (Claude Code v2.1.143 and later) + * The plugin’s **Last updated** date (v2.1.144 and later) + * A **Will install** section listing the plugin’s commands, agents, skills, hooks, and MCP and LSP servers, so you can review exactly what it adds before installing (v2.1.145 and later) + +Choose an installation scope: * **User scope** : install for yourself across all projects * **Project scope** : install for all collaborators on this repository @@ -182,7 +199,7 @@ /commit-commands:commit -This stages your changes, generates a commit message, and creates the commit.Each plugin works differently. Check the plugin’s description in the **Discover** tab or its homepage to learn what skills and capabilities it provides. +This stages your changes, generates a commit message, and creates the commit.Each plugin works differently. Check the plugin’s details in the **Discover** tab to see the commands and skills it provides, or visit its homepage for usage guidance. The rest of this guide covers all the ways you can add marketplaces, install plugins, and manage your configuration.
modified Environment variables View current →
Show diff (167 lines)
--- a/env-vars.md +++ b/env-vars.md @@ -4,7 +4,90 @@ > > Use this file to discover all available pages before exploring further. -Claude Code supports the following environment variables to control its behavior. Set them in your shell before launching `claude`, or configure them in [`settings.json`](</docs/en/settings#available-settings>) under the `env` key to apply them to every session or roll them out across your team. +Environment variables can control Claude Code behavior such as model selection, authentication, request routing, and feature toggles. Many of the same behaviors can also be configured through a [settings file](</docs/en/settings>) field, a [CLI flag](</docs/en/cli-reference>), or an in-session command like `/model`. This page covers how to: + + * Set environment variables in your shell or in a settings file + * Check which value applies when a behavior can be set more than one way + * Look up the variables Claude Code reads + +## + +​ + +Set environment variables + +A variable you set in your shell lasts for that terminal session, while a variable in a settings file applies every time `claude` runs. + +### + +​ + +In your shell + +Set the variable before launching `claude`: + + * macOS, Linux, WSL + + * Windows PowerShell + + * Windows CMD + + export API_TIMEOUT_MS="1200000" + claude + +To set it for every session, add the `export` line to `~/.bashrc`, `~/.zshrc`, or your shell’s profile file. + + $env:API_TIMEOUT_MS = "1200000" + claude + +To set it for every session, run `[Environment]::SetEnvironmentVariable("API_TIMEOUT_MS", "1200000", "User")` and open a new terminal. + + set API_TIMEOUT_MS=1200000 + claude + +To set it for every session, run `setx API_TIMEOUT_MS "1200000"` and open a new terminal. + +### + +​ + +In settings files + +Add variables under the `env` key in a `settings.json` file. Claude Code reads them directly from the file at startup, so they take effect no matter how `claude` was launched. + +~/.claude/settings.json + + { + "env": { + "API_TIMEOUT_MS": "1200000", + "BASH_DEFAULT_TIMEOUT_MS": "300000" + } + } + +The file you choose controls who the variables apply to: + +File| Applies to +---|--- +`~/.claude/settings.json`| You, in every project +`.claude/settings.json`| Everyone working in the project, checked into source control +`.claude/settings.local.json`| You, in this project only, not checked in +Managed settings| Everyone in your organization, deployed by an admin + +See [Settings files](</docs/en/settings#settings-files>) for where each file lives and [Settings precedence](</docs/en/settings#settings-precedence>) for how they combine when more than one sets the same variable. + +## + +​ + +Precedence + +Where the same behavior has both an environment variable and a settings field, the environment variable takes precedence. For example, `ANTHROPIC_MODEL` overrides the `model` setting, and `CLAUDE_CODE_AUTO_CONNECT_IDE` overrides `autoConnectIde`. The settings field applies when the environment variable is not set. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads environment variables at startup, so changes take effect the next time you launch `claude`. + +## + +​ + +Variables Variable| Purpose ---|--- @@ -50,7 +133,7 @@ `BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters in bash outputs before the full output is saved to a file and Claude receives the path plus a short preview. See [Bash tool behavior](</docs/en/tools-reference#bash-tool-behavior>) `BASH_MAX_TIMEOUT_MS`| Maximum timeout the model can set for long-running bash commands (default: 600000, or 10 minutes) `CCR_FORCE_BUNDLE`| Set to `1` to force [`claude --remote`](</docs/en/claude-code-on-the-web#send-local-repositories-without-github>) to bundle and upload your local repository even when GitHub access is available -`CLAUDECODE`| Set to `1` in shell environments Claude Code spawns (Bash tool, tmux sessions). Not set in [hooks](</docs/en/hooks>) or [status line](</docs/en/statusline>) commands. Use to detect when a script is running inside a shell spawned by Claude Code +`CLAUDECODE`| Set to `1` in subprocesses Claude Code spawns (Bash and PowerShell tools, tmux sessions, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands). Use to detect when a script is running inside a subprocess spawned by Claude Code `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS`| Set to `1` to disable all built-in [subagent](</docs/en/sub-agents>) types such as Explore and Plan. Only applies in non-interactive mode (the `-p` flag). Useful for SDK users who want a blank slate `CLAUDE_AGENT_SDK_MCP_NO_PREFIX`| Set to `1` to skip the `mcp__<server>__` prefix on tool names from SDK-created MCP servers. Tools use their original names. SDK usage only `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for background subagents. Default `600000` (10 minutes). The timer resets on each streaming progress event; if no progress arrives within the window, the subagent is aborted and the task is marked failed, surfacing any partial result to the parent @@ -59,6 +142,7 @@ `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`| Return to the original working directory after each Bash or PowerShell command in the main session `CLAUDE_CODE_ACCESSIBILITY`| Set to `1` to keep the native terminal cursor visible and disable the inverted-text cursor indicator. Allows screen magnifiers like macOS Zoom to track cursor position `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD`| Set to `1` to load memory files from directories specified with `--add-dir`. Loads `CLAUDE.md`, `.claude/CLAUDE.md`, `.claude/rules/*.md`, and `CLAUDE.local.md`. By default, additional directories do not load memory files +`CLAUDE_CODE_ALT_SCREEN_FULL_REPAINT`| Set to `1` to repaint the entire screen on every frame in [fullscreen rendering](</docs/en/fullscreen>) instead of sending incremental updates. Use this if fullscreen mode shows stale or misplaced text fragments. Claude Code enables this automatically for background sessions on Windows `CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings#available-settings>)) `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the attribution block (client version and prompt fingerprint) from the start of the system prompt. Disabling it improves prompt-cache hit rates when routing through an [LLM gateway](</docs/en/llm-gateway>). Anthropic API caching is unaffected `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the context capacity in tokens used for auto-compaction calculations. Defaults to the model’s context window: 200K for standard models or 1M for [extended context](</docs/en/model-config#extended-context>) models. Use a lower value like `500000` on a 1M model to treat the window as 500K for compaction purposes. The value is capped at the model’s actual context window. `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` is applied as a percentage of this value. Setting this variable decouples the compaction threshold from the status line’s `used_percentage`, which always uses the model’s full context window @@ -94,7 +178,7 @@ `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear `CLAUDE_CODE_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_BACKGROUND_PLUGIN_REFRESH`| Set to `1` to refresh plugin state at turn boundaries in [non-interactive mode](</docs/en/headless>) after a background install completes. Off by default because the refresh changes the system prompt mid-session, which invalidates [prompt caching](</docs/en/prompt-caching>) for that turn `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 @@ -137,7 +221,7 @@ `CLAUDE_CODE_PLUGIN_CACHE_DIR`| Override the plugins root directory. Despite the name, this sets the parent directory, not the cache itself: marketplaces and the plugin cache live in subdirectories under this path. Defaults to `~/.claude/plugins` `CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS`| Timeout in milliseconds for git operations when installing or updating plugins (default: 120000). Increase this value for large repositories or slow network connections. See [Git operations time out](</docs/en/plugin-marketplaces#git-operations-time-out>) `CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE`| Set to `1` to keep the existing marketplace cache when a `git pull` fails instead of wiping and re-cloning. Useful in offline or airgapped environments where re-cloning would fail the same way. See [Marketplace updates fail in offline environments](</docs/en/plugin-marketplaces#marketplace-updates-fail-in-offline-environments>) -`CLAUDE_CODE_PLUGIN_PREFER_HTTPS`| Set to `1` to clone GitHub `owner/repo` plugin sources over HTTPS instead of SSH. Useful in CI runners, containers, or any environment without a configured SSH key for `github.com` +`CLAUDE_CODE_PLUGIN_PREFER_HTTPS`| Set to `1` to clone GitHub `owner/repo` shorthand sources over HTTPS instead of SSH. Applies to plugin install and update, and to `/plugin marketplace add` and `update`. Useful in CI runners, containers, or any environment without a configured SSH key for `github.com` `CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugin-marketplaces#pre-populate-plugins-for-containers>) `CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY`| Set to `1` to stop Claude Code from passing `-ExecutionPolicy Bypass` when spawning PowerShell for tool calls, hooks, and status line commands, and respect the machine’s effective execution policy instead. By default Claude Code bypasses execution policy at process scope so `.ps1` scripts and module imports work on default-Restricted Windows installs. Process-scope bypass never overrides Group Policy `MachinePolicy` or `UserPolicy` regardless of this setting `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files are ignored so user settings cannot override the host’s routing. The automatic telemetry opt-out for Bedrock, Vertex, and Foundry is also skipped, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) @@ -149,7 +233,7 @@ `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 -`CLAUDE_CODE_SESSION_ID`| Set automatically in Bash and PowerShell tool subprocesses to the current session ID. Matches the `session_id` field passed to [hooks](</docs/en/hooks>). Updated on `/clear`. Use to correlate scripts and external tools with the Claude Code session that launched them +`CLAUDE_CODE_SESSION_ID`| Set automatically in Bash and PowerShell tool subprocesses and in [hook command](</docs/en/hooks>) subprocesses to the current session ID. Matches the `session_id` field in the hook JSON input. Updated on `/clear`. Use to correlate scripts and external tools with the Claude Code session that launched them `CLAUDE_CODE_SHELL`| Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`) `CLAUDE_CODE_SHELL_PREFIX`| Command prefix that wraps shell commands Claude Code spawns: Bash tool calls, [hook](</docs/en/hooks>) commands, and stdio [MCP server](</docs/en/mcp>) startup commands. Useful for logging or auditing. Example: setting `/path/to/logger.sh` runs each command as `/path/to/logger.sh <command>` `CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. OAuth tokens and keychain credentials are not read, so Anthropic authentication must come from `ANTHROPIC_API_KEY` or an `apiKeyHelper` in `--settings`. Equivalent to passing [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) @@ -200,16 +284,16 @@ `DISABLE_INTERLEAVED_THINKING`| Set to `1` to prevent sending the interleaved-thinking beta header. Useful when your LLM gateway or provider does not support [interleaved thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking#interleaved-thinking>) `DISABLE_LOGIN_COMMAND`| Set to `1` to hide the `/login` command. Useful when authentication is handled externally via API keys or `apiKeyHelper` `DISABLE_LOGOUT_COMMAND`| Set to `1` to hide the `/logout` command -`DISABLE_PROMPT_CACHING`| Set to `1` to disable prompt caching for all models (takes precedence over per-model settings) +`DISABLE_PROMPT_CACHING`| Set to `1` to disable [prompt caching](</docs/en/prompt-caching#disable-prompt-caching>) for all models (takes precedence over per-model settings) `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. Also disables feature flags, so some features that are still rolling out may not be available +`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-flag fetching with the same effect as `DISABLE_GROWTHBOOK`, so some flagged features may be unavailable `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/>) `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users -`ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour prompt cache TTL instead of the default 5 minutes. Intended for API key, [Bedrock](</docs/en/amazon-bedrock>), [Vertex](</docs/en/google-vertex-ai>), [Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users receive 1-hour TTL automatically. 1-hour cache writes are billed at a higher rate +`ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Bedrock](</docs/en/amazon-bedrock>), [Vertex](</docs/en/google-vertex-ai>), [Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive 1-hour TTL automatically. 1-hour cache writes are billed at a higher rate `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead `ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Vertex AI or when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always defer and send the beta header, requests fail on Vertex AI models earlier than Sonnet 4.5 or Opus 4.5, or on proxies that do not support `tool_reference`), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront) `FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value to trigger fallback to [`--fallback-model`](</docs/en/cli-reference#cli-flags>) after repeated overload errors on any primary model. By default, only Opus models trigger the fallback @@ -261,7 +345,7 @@ See also - * [Settings](</docs/en/settings>): configure environment variables in `settings.json` so they apply to every session + * [Settings](</docs/en/settings>): all `settings.json` configuration, including the `env` key * [CLI reference](</docs/en/cli-reference>): launch-time flags * [Network configuration](</docs/en/network-config>): proxy and TLS setup * [Monitoring](</docs/en/monitoring-usage>): OpenTelemetry configuration
modified Extend Claude Code View current →
--- a/features-overview.md +++ b/features-overview.md @@ -20,6 +20,7 @@ * **[CLAUDE.md](</docs/en/memory>)** adds persistent context Claude sees every session * **[Skills](</docs/en/skills>)** add reusable knowledge and invocable workflows + * **[Code intelligence](</docs/en/tools-reference#lsp-tool-behavior>)** connects Claude to a language server for symbol-level navigation and live type errors * **[MCP](</docs/en/mcp>)** connects Claude to external services and tools * **[Subagents](</docs/en/sub-agents>)** run their own loops in isolated context, returning summaries * **[Agent teams](</docs/en/agent-teams>)** coordinate multiple independent sessions with shared tasks and peer-to-peer messaging @@ -42,6 +43,7 @@ **Skill**| Instructions, knowledge, and workflows Claude can use| Reusable content, reference docs, repeatable tasks| `/deploy` runs your deployment checklist; API docs skill with endpoint patterns **Subagent**| Isolated execution context that returns summarized results| Context isolation, parallel tasks, specialized workers| Research task that reads many files but returns only key findings **[Agent teams](</docs/en/agent-teams>)**| Coordinate multiple independent Claude Code sessions| Parallel research, new feature development, debugging with competing hypotheses| Spawn reviewers to check security, performance, and tests simultaneously +**[Code intelligence](</docs/en/tools-reference#lsp-tool-behavior>)**| Language-server navigation and diagnostics| Typed languages, large codebases where grep is slow or imprecise| Jump to a symbol’s definition instead of reading the whole file **MCP**| Connect to external services| External data or actions| Query your database, post to Slack, control a browser **Hook**| Script, HTTP request, prompt, or subagent triggered by events| Automation that must run on every matching event| Run ESLint after every file edit @@ -61,6 +63,7 @@ You keep typing the same prompt to start a task| Save it as a user-invocable [skill](</docs/en/skills>) You paste the same playbook or multi-step procedure into chat for the third time| Capture it as a [skill](</docs/en/skills>) You keep copying data from a browser tab Claude can’t see| Connect that system as an [MCP server](</docs/en/mcp>) +Claude reads many files to find where a symbol is defined or used| Install a [code intelligence plugin](</docs/en/discover-plugins#code-intelligence>) for your language A side task floods your conversation with output you won’t reference again| Route it through a [subagent](</docs/en/sub-agents>) You want something to happen every time without asking| Write a [hook](</docs/en/hooks-guide>) A second repository needs the same setup| Package it as a [plugin](</docs/en/plugins>) @@ -210,6 +213,7 @@ **CLAUDE.md**| Session start| Full content| Every request **Skills**| Session start + when used| Descriptions at start, full content when used| Low (descriptions every request)* **MCP servers**| Session start| Tool names; full schemas on demand| Low until a tool is used +**Code intelligence**| After file edits and on demand| Diagnostics after edits; symbol locations on lookup| Low; reduces file reads elsewhere **Subagents**| When spawned| Fresh context with specified skills| Isolated from main session **Hooks**| On trigger| Nothing (runs externally)| Zero, unless hook returns additional context @@ -229,6 +233,8 @@ * MCP servers + * Code intelligence + * Subagents * Hooks @@ -244,6 +250,10 @@ **When:** Session start.**What loads:** Tool names from connected servers. Full JSON schemas stay deferred until Claude needs a specific tool.**Context cost:** [Tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is on by default, so idle MCP tools consume minimal context.**Reliability note:** MCP connections can fail silently mid-session. If a server disconnects, its tools disappear without warning. Claude may try to use a tool that no longer exists. If you notice Claude failing to use an MCP tool it previously could access, check the connection with `/mcp`. Run `/mcp` to see token costs per server. Disconnect servers you’re not actively using. + +**When:** After file edits, and on demand when Claude navigates code.**What loads:** Type errors and warnings after each file edit. Definition, reference, and type information when Claude looks up a symbol.**Context cost:** Low. Symbol lookups often replace broad file reads, so net context use can go down. + +The LSP tool is inactive until you install a [code intelligence plugin](</docs/en/discover-plugins#code-intelligence>) for your language. **When:** On demand, when you or Claude spawns one for a task.**What loads:** Fresh, isolated context containing:
modified Fullscreen rendering View current →
--- a/fullscreen.md +++ b/fullscreen.md @@ -47,6 +47,7 @@ Fullscreen rendering captures mouse events and handles them inside Claude Code: * **Click in the prompt input** to position your cursor anywhere in the text you’re typing. + * **Click a suggestion in the`/` command or `@` file list** to accept it. Hovering highlights the row under your cursor. * **Click a collapsed tool result** to expand it and see the full output. Click again to collapse. The tool call and its result expand together. Only messages that have more to show are clickable. * **Click a URL or file path** to open it. File paths in tool output, like the ones printed after an Edit or Write, open in your default application. Plain `http://` and `https://` URLs open in your browser. In most terminals this replaces native `Cmd`-click or `Ctrl`-click, which mouse capture intercepts. In the VS Code integrated terminal and similar xterm.js-based terminals, keep using `Cmd`-click. Claude Code defers to the terminal’s own link handler there to avoid opening links twice. * **Click and drag** to select text anywhere in the conversation. Double-click selects a word, matching iTerm2’s word boundaries so a file path selects as one unit. Triple-click selects the line.
modified Claude Code on Google Vertex AI View current →
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -148,7 +148,7 @@ export VERTEX_REGION_CLAUDE_HAIKU_4_5=us-east5 export VERTEX_REGION_CLAUDE_4_6_SONNET=europe-west1 -Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Vertex Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. For heightened rate limits, contact Google Cloud support. When using Vertex AI, the `/login` and `/logout` commands are disabled since authentication is handled through Google Cloud credentials. Claude Code disables [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) by default on Vertex AI, so MCP tool definitions load upfront. Vertex AI supports tool search for Claude Sonnet 4.5 and later and Claude Opus 4.5 and later. Set `ENABLE_TOOL_SEARCH=true` to enable it on those models. Earlier models on Vertex AI do not accept the required beta header, and requests fail if you enable tool search with them. +Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Vertex Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](</docs/en/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. For heightened rate limits, contact Google Cloud support. When using Vertex AI, the `/login` and `/logout` commands are disabled since authentication is handled through Google Cloud credentials. Claude Code disables [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) by default on Vertex AI, so MCP tool definitions load upfront. Vertex AI supports tool search for Claude Sonnet 4.5 and later and Claude Opus 4.5 and later. Set `ENABLE_TOOL_SEARCH=true` to enable it on those models. Earlier models on Vertex AI do not accept the required beta header, and requests fail if you enable tool search with them. ###
modified Run Claude Code programmatically View current →
--- a/headless.md +++ b/headless.md @@ -146,7 +146,7 @@ `max_retries`| integer| total retries permitted `retry_delay_ms`| integer| milliseconds until the next attempt `error_status`| integer or null| HTTP status code, or `null` for connection errors with no HTTP response -`error`| string| error category: `authentication_failed`, `oauth_org_not_allowed`, `billing_error`, `rate_limit`, `invalid_request`, `server_error`, `max_output_tokens`, or `unknown` +`error`| string| error category: `authentication_failed`, `oauth_org_not_allowed`, `billing_error`, `rate_limit`, `invalid_request`, `model_not_found`, `server_error`, `max_output_tokens`, or `unknown` `uuid`| string| unique event identifier `session_id`| string| session the event belongs to
modified Hooks reference View current →
Show diff (107 lines)
--- a/hooks.md +++ b/hooks.md @@ -204,7 +204,7 @@ `ConfigChange`| configuration source| `user_settings`, `project_settings`, `local_settings`, `policy_settings`, `skills` `CwdChanged`| no matcher support| always fires on every directory change `FileChanged`| literal filenames to watch (see FileChanged)| `.envrc|.env` -`StopFailure`| error type| `rate_limit`, `authentication_failed`, `oauth_org_not_allowed`, `billing_error`, `invalid_request`, `server_error`, `max_output_tokens`, `unknown` +`StopFailure`| error type| `rate_limit`, `authentication_failed`, `oauth_org_not_allowed`, `billing_error`, `invalid_request`, `model_not_found`, `server_error`, `max_output_tokens`, `unknown` `InstructionsLoaded`| load reason| `session_start`, `nested_traversal`, `path_glob_match`, `include`, `compact` `UserPromptExpansion`| command name| your skill or command names `Elicitation`| MCP server name| your configured MCP server names @@ -1714,7 +1714,7 @@ "transcript_path": "/Users/.../.claude/projects/.../00893aaf-19fa-41d2-8238-13269b9b3ca0.jsonl", "cwd": "/Users/...", "hook_event_name": "Notification", - "message": "Claude needs your permission to use Bash", + "message": "Claude needs your permission", "title": "Permission needed", "notification_type": "permission_prompt" } @@ -1773,7 +1773,7 @@ SubagentStop input -In addition to the common input fields, SubagentStop hooks receive `stop_hook_active`, `agent_id`, `agent_type`, `agent_transcript_path`, and `last_assistant_message`. The `agent_type` field is the value used for matcher filtering. The `transcript_path` is the main session’s transcript, while `agent_transcript_path` is the subagent’s own transcript stored in a nested `subagents/` folder. The `last_assistant_message` field contains the text content of the subagent’s final response, so hooks can access it without parsing the transcript file. +In addition to the common input fields, SubagentStop hooks receive `stop_hook_active`, `agent_id`, `agent_type`, `agent_transcript_path`, and `last_assistant_message`. The `agent_type` field is the value used for matcher filtering. The `transcript_path` is the main session’s transcript, while `agent_transcript_path` is the subagent’s own transcript stored in a nested `subagents/` folder. The `last_assistant_message` field contains the text content of the subagent’s final response, so hooks can access it without parsing the transcript file. SubagentStop hooks also receive the `background_tasks` and `session_crons` arrays described under Stop input, available in Claude Code v2.1.145 or later. Both arrays are scoped to the parent session, not the subagent. { "session_id": "abc123", @@ -1785,7 +1785,9 @@ "agent_id": "def456", "agent_type": "Explore", "agent_transcript_path": "~/.claude/projects/.../abc123/subagents/agent-def456.jsonl", - "last_assistant_message": "Analysis complete. Found 3 potential issues..." + "last_assistant_message": "Analysis complete. Found 3 potential issues...", + "background_tasks": [], + "session_crons": [] } SubagentStop hooks use the same decision control format as Stop hooks. They do not support `additionalContext`. Returning `decision: "block"` with a `reason` keeps the subagent running and delivers `reason` to the subagent as its next instruction. To inject context into the parent session after a subagent returns, use a `PostToolUse` hook on the `Agent` tool instead. @@ -1929,7 +1931,30 @@ Stop input -In addition to the common input fields, Stop hooks receive `stop_hook_active` and `last_assistant_message`. The `stop_hook_active` field is `true` when Claude Code is already continuing as a result of a stop hook. Check this value or process the transcript to avoid blocking on a condition that will never resolve. Claude Code overrides the hook and ends the turn after 8 consecutive blocks. The `last_assistant_message` field contains the text content of Claude’s final response, so hooks can access it without parsing the transcript file. +In addition to the common input fields, Stop hooks receive `stop_hook_active`, `last_assistant_message`, `background_tasks`, and `session_crons`. The `stop_hook_active` field is `true` when Claude Code is already continuing as a result of a stop hook. Check this value or process the transcript to avoid blocking on a condition that will never resolve. Claude Code overrides the hook and ends the turn after 8 consecutive blocks. The `last_assistant_message` field contains the text content of Claude’s final response, so hooks can access it without parsing the transcript file. The `background_tasks` and `session_crons` arrays, available in Claude Code v2.1.145 or later, let hooks distinguish “session is done” from “session is paused waiting for background work to wake it back up”. Both arrays are present when the task registry is reachable and are empty when nothing is in flight or scheduled. Each entry in `background_tasks` describes one in-flight task and uses these fields: + +Field| Description +---|--- +`id`| Task identifier +`type`| Friendly task-type label such as `shell`, `subagent`, `monitor`, `workflow`, `teammate`, `cloud session`, or `MCP task`. Each label identifies which Claude Code feature created the task. Falls back to the raw discriminant for unrecognized types +`status`| Current task status +`description`| Free-text description, capped at 1000 characters with an in-string `… [+N chars]` marker when clipped +`command`| Shell command line, capped at 1000 characters. Present only for `shell` tasks +`agent_type`| Subagent type name. Present only for `subagent` tasks +`server`| MCP server name. Present only for `monitor` and `MCP task` tasks +`tool`| MCP tool name. Present only for `monitor` and `MCP task` tasks +`name`| Workflow name. Present only for `workflow` tasks + +Each entry in `session_crons` describes one session-scoped scheduled wakeup, sourced from `CronCreate` and `/loop`: + +Field| Description +---|--- +`id`| Cron task identifier +`schedule`| Cron expression, for example `0 9 * * 1-5` +`recurring`| `false` for one-shot wakeups whose schedule encodes a single fire time, `true` for tasks that re-fire on every match +`prompt`| Prompt submitted when the cron fires, capped at 1000 characters with the same `… [+N chars]` marker + +This example shows a Stop input with one in-flight shell task and one recurring cron: { "session_id": "abc123", @@ -1938,7 +1963,24 @@ "permission_mode": "default", "hook_event_name": "Stop", "stop_hook_active": true, - "last_assistant_message": "I've completed the refactoring. Here's a summary..." + "last_assistant_message": "I've completed the refactoring. Here's a summary...", + "background_tasks": [ + { + "id": "task-001", + "type": "shell", + "status": "running", + "description": "tail logs", + "command": "tail -f /var/log/syslog" + } + ], + "session_crons": [ + { + "id": "cron-001", + "schedule": "0 9 * * 1-5", + "recurring": true, + "prompt": "check the build" + } + ] } #### @@ -1977,7 +2019,7 @@ Field| Description ---|--- -`error`| Error type: `rate_limit`, `authentication_failed`, `oauth_org_not_allowed`, `billing_error`, `invalid_request`, `server_error`, `max_output_tokens`, or `unknown` +`error`| Error type: `rate_limit`, `authentication_failed`, `oauth_org_not_allowed`, `billing_error`, `invalid_request`, `model_not_found`, `server_error`, `max_output_tokens`, or `unknown` `error_details`| Additional details about the error, when available `last_assistant_message`| The rendered error text shown in the conversation. Unlike `Stop` and `SubagentStop`, where this field holds Claude’s conversational output, for `StopFailure` it contains the API error string itself, such as `"API Error: Rate limit reached"`
modified Automate workflows with hooks View current →
--- a/hooks-guide.md +++ b/hooks-guide.md @@ -604,7 +604,7 @@ `PreCompact`, `PostCompact`| what triggered compaction| `manual`, `auto` `SubagentStop`| agent type| same values as `SubagentStart` `ConfigChange`| configuration source| `user_settings`, `project_settings`, `local_settings`, `policy_settings`, `skills` -`StopFailure`| error type| `rate_limit`, `authentication_failed`, `oauth_org_not_allowed`, `billing_error`, `invalid_request`, `server_error`, `max_output_tokens`, `unknown` +`StopFailure`| error type| `rate_limit`, `authentication_failed`, `oauth_org_not_allowed`, `billing_error`, `invalid_request`, `model_not_found`, `server_error`, `max_output_tokens`, `unknown` `InstructionsLoaded`| load reason| `session_start`, `nested_traversal`, `path_glob_match`, `include`, `compact` `Elicitation`| MCP server name| your configured MCP server names `ElicitationResult`| MCP server name| same values as `Elicitation`
modified What's new View current →
--- a/index.md +++ b/index.md @@ -5,6 +5,16 @@ > Use this file to discover all available pages before exploring further. The weekly dev digest highlights the features most likely to change how you work. Each entry includes runnable code, a short demo, and a link to the full docs. For every bug fix and minor improvement, see the [changelog](</docs/en/changelog>). + +​ + +Week 20 + +v2.1.139–v2.1.142 + +May 11–15, 2026 + +**Agent view** : `claude agents` opens one screen for every Claude Code session, showing what’s running, what’s blocked on you, and what’s done.Also this week: **`/goal`** keeps Claude working across turns until a completion condition holds; **fast mode** now runs on Opus 4.7 by default; and the **Rewind menu** can compress earlier context with “Summarize up to here”.[Read the Week 20 digest →](</docs/en/whats-new/2026-w20>) ​
modified Interactive mode View current →
--- a/interactive-mode.md +++ b/interactive-mode.md @@ -415,9 +415,8 @@ * Yellow: pending review * Red: changes requested * Gray: draft - * Purple: merged - -`Cmd+click` (Mac) or `Ctrl+click` (Windows/Linux) the link to open the pull request in your browser. The status updates automatically every 60 seconds. + +The badge disappears once the pull request merges or closes. `Cmd+click` (Mac) or `Ctrl+click` (Windows/Linux) the link to open the pull request in your browser. The status refreshes every 60 seconds, and immediately after a `gh pr` or `git push` command runs in the session. PR status requires the `gh` CLI to be installed and authenticated (`gh auth login`).
modified Customize keyboard shortcuts View current →
--- a/keybindings.md +++ b/keybindings.md @@ -339,6 +339,7 @@ ---|---|--- `modelPicker:decreaseEffort`| Left| Decrease effort level `modelPicker:increaseEffort`| Right| Increase effort level +`modelPicker:setAsDefault`| d| Set highlighted model as default for new sessions ###
modified Connect Claude Code to tools via MCP View current →
--- a/mcp.md +++ b/mcp.md @@ -733,7 +733,7 @@ Claude.ai servers appear in the list with indicators showing they come from Claude.ai. -A server you’ve added in Claude Code takes precedence over a claude.ai connector that points at the same URL. When this happens, `/mcp` lists the connector as hidden and shows how to remove the duplicate if you’d rather use the connector. To disable claude.ai MCP servers in Claude Code, set the `ENABLE_CLAUDEAI_MCP_SERVERS` environment variable to `false`: +Claude.ai connectors are fetched only when your active [authentication method](</docs/en/authentication#authentication-precedence>) is your Claude.ai subscription. They are not loaded when `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, `apiKeyHelper`, or a third-party provider such as Bedrock or Vertex is active, even if you previously ran `/login`. If `/mcp` does not list a connector you added, run `/status` to confirm which authentication method is active, unset that environment variable or remove the `apiKeyHelper` setting, then run `/login` to select your Claude.ai account. A server you’ve added in Claude Code takes precedence over a claude.ai connector that points at the same URL. When this happens, `/mcp` lists the connector as hidden and shows how to remove the duplicate if you’d rather use the connector. To disable claude.ai MCP servers in Claude Code, set the `ENABLE_CLAUDEAI_MCP_SERVERS` environment variable to `false`: ENABLE_CLAUDEAI_MCP_SERVERS=false claude
modified Claude Code on Microsoft Foundry View current →
--- a/microsoft-foundry.md +++ b/microsoft-foundry.md @@ -90,7 +90,7 @@ export ANTHROPIC_DEFAULT_SONNET_MODEL='claude-sonnet-4-6' export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5' -Background tasks such as session title generation use the small/fast model, normally a Haiku-class model. On Foundry, Claude Code defaults this to the primary model because not every account has a Haiku deployment. To use Haiku for background tasks, set `ANTHROPIC_DEFAULT_HAIKU_MODEL` to a Haiku deployment that is available in your account, as shown above. For current and legacy model IDs, see [Models overview](<https://platform.claude.com/docs/en/about-claude/models/overview>). See [Model configuration](</docs/en/model-config#pin-models-for-third-party-deployments>) for the full list of environment variables. [Prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) is enabled automatically. To request a 1-hour cache TTL instead of the 5-minute default, set the following variable; cache writes with a 1-hour TTL are billed at a higher rate: +Background tasks such as session title generation use the small/fast model, normally a Haiku-class model. On Foundry, Claude Code defaults this to the primary model because not every account has a Haiku deployment. To use Haiku for background tasks, set `ANTHROPIC_DEFAULT_HAIKU_MODEL` to a Haiku deployment that is available in your account, as shown above. For current and legacy model IDs, see [Models overview](<https://platform.claude.com/docs/en/about-claude/models/overview>). See [Model configuration](</docs/en/model-config#pin-models-for-third-party-deployments>) for the full list of environment variables. [Prompt caching](</docs/en/prompt-caching>) is enabled automatically. To request a 1-hour cache TTL instead of the 5-minute default, set the following variable; cache writes with a 1-hour TTL are billed at a higher rate: export ENABLE_PROMPT_CACHING_1H=1
modified Model configuration View current →
--- a/model-config.md +++ b/model-config.md @@ -57,7 +57,7 @@ 3. **Environment variable** \- Set `ANTHROPIC_MODEL=<alias|name>` 4. **Settings** \- Configure permanently in your settings file using the `model` field. -Your `/model` selection is saved to user settings and persists across restarts. As of v2.1.117, if the project’s `.claude/settings.json` pins a different model, Claude Code also writes your choice to `.claude/settings.local.json` so it continues to apply in that project after a restart. Managed settings take precedence and reapply on the next launch. The `--model` flag and `ANTHROPIC_MODEL` environment variable apply only to the session you launch with them and are not saved. To run different models in different terminals at the same time, launch each one with its own `--model` flag rather than switching with `/model`. When the active model at startup comes from project or managed settings rather than your own selection, the startup header shows which settings file set it. Run `/model` to override for the current session. Example usage: +As of v2.1.144, `/model` applies to the current session only and is not written to settings. To save your choice as the default for new sessions, press `d` on the highlighted row in the picker, which writes the `model` field in your user settings. Managed settings take precedence and reapply on the next launch. The `--model` flag and `ANTHROPIC_MODEL` environment variable also apply only to the session you launch with them. To run different models in different terminals at the same time, launch each one with its own `--model` flag rather than switching with `/model`. Resumed sessions started with `claude --resume`, `--continue`, or the `/resume` picker keep the model they were using when the transcript was saved, regardless of the current `model` setting. If that model has been retired, the session falls through to the normal precedence order. This prevents another session’s `/model` choice from changing the model on resume. When the active model at startup comes from project or managed settings rather than your own selection, the startup header shows which settings file set it. Run `/model` to override for the current session. Example usage: # Start with Opus claude --model opus @@ -402,13 +402,13 @@ Prompt caching configuration -Claude Code automatically uses [prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) to optimize performance and reduce costs. You can disable prompt caching globally or for specific model tiers: +Claude Code automatically uses [prompt caching](</docs/en/prompt-caching>) to optimize performance and reduce costs. You can disable prompt caching globally or for specific model tiers: Environment variable| Description ---|--- -`DISABLE_PROMPT_CACHING`| Set to `1` to disable prompt caching for all models (takes precedence over per-model settings) +`DISABLE_PROMPT_CACHING`| Set to `1` to disable prompt caching for all models. Takes precedence over the per-model settings `DISABLE_PROMPT_CACHING_HAIKU`| Set to `1` to disable prompt caching for Haiku models only `DISABLE_PROMPT_CACHING_SONNET`| Set to `1` to disable prompt caching for Sonnet models only `DISABLE_PROMPT_CACHING_OPUS`| Set to `1` to disable prompt caching for Opus models only -These environment variables give you fine-grained control over prompt caching behavior. The global `DISABLE_PROMPT_CACHING` setting takes precedence over the model-specific settings, allowing you to quickly disable all caching when needed. The per-model settings are useful for selective control, such as when debugging specific models or working with cloud providers that may have different caching implementations. +To change the cache TTL or learn what triggers a cache miss, see [How Claude Code uses prompt caching](</docs/en/prompt-caching>).
modified Modifying system prompts View current →
--- a/modifying-system-prompts.md +++ b/modifying-system-prompts.md @@ -138,7 +138,7 @@ * **CLI** : run `/config` and select an output style * **Settings** : set `outputStyle` in `.claude/settings.local.json` - * **TypeScript SDK** : set `options.outputStyle` to the style’s name + * **TypeScript SDK** : set `outputStyle` inside the inline `settings` object passed to `query()`, or point `settings` at a settings file that sets it. `outputStyle` is not a top-level `Options` field 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. @@ -379,6 +379,6 @@ * [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` + * [TypeScript SDK reference](</docs/en/agent-sdk/typescript>): the full `Options` type, including `systemPrompt`, `settingSources`, and `settings` * [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
modified Monitoring View current →
--- a/monitoring-usage.md +++ b/monitoring-usage.md @@ -142,7 +142,7 @@ `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT`| OTLP traces endpoint, overrides `OTEL_EXPORTER_OTLP_ENDPOINT`| `http://localhost:4318/v1/traces` `OTEL_TRACES_EXPORT_INTERVAL`| Span batch export interval in milliseconds (default: 5000)| `1000`, `10000` -Spans redact user prompt text, tool input details, and tool content by default. Set `OTEL_LOG_USER_PROMPTS=1`, `OTEL_LOG_TOOL_DETAILS=1`, and `OTEL_LOG_TOOL_CONTENT=1` to include them. When tracing is active, Bash and PowerShell subprocesses automatically inherit a `TRACEPARENT` environment variable containing the W3C trace context of the active tool execution span. This lets any subprocess that reads `TRACEPARENT` parent its own spans under the same trace, enabling end-to-end distributed tracing through scripts and commands that Claude runs. In Agent SDK and non-interactive sessions started with `-p`, Claude Code also reads `TRACEPARENT` and `TRACESTATE` from its own environment when starting each interaction span. This lets an embedding process pass its active W3C trace context into the subprocess so Claude Code’s spans appear as children of the caller’s distributed trace. Interactive sessions ignore inbound `TRACEPARENT` to avoid accidentally inheriting ambient values from CI or container environments. +Spans redact user prompt text, tool input details, and tool content by default. Set `OTEL_LOG_USER_PROMPTS=1`, `OTEL_LOG_TOOL_DETAILS=1`, and `OTEL_LOG_TOOL_CONTENT=1` to include them. When tracing is active, Bash and PowerShell subprocesses automatically inherit a `TRACEPARENT` environment variable containing the W3C trace context of the active tool execution span. This lets any subprocess that reads `TRACEPARENT` parent its own spans under the same trace, enabling end-to-end distributed tracing through scripts and commands that Claude runs. When tracing is active and Claude Code is connected directly to the Anthropic API, each model request carries a W3C `traceparent` header set to the `claude_code.llm_request` span’s context, and the API’s `traceresponse` header is recorded as a span link. Together these connect Claude Code’s client-side spans to the server-side trace through any compliant intermediary. The header is not sent to third-party providers. In Agent SDK and non-interactive sessions started with `-p`, Claude Code also reads `TRACEPARENT` and `TRACESTATE` from its own environment when starting each interaction span. This lets an embedding process pass its active W3C trace context into the subprocess so Claude Code’s spans appear as children of the caller’s distributed trace. Interactive sessions ignore inbound `TRACEPARENT` to avoid accidentally inheriting ambient values from CI or container environments. #### @@ -213,6 +213,8 @@ `tool_name`| Tool name| `duration_ms`| Wall-clock duration including permission wait and execution| `result_tokens`| Approximate token size of the tool result| +`agent_id`| Identifier of the subagent or teammate that ran the tool. Absent on the main session| +`parent_agent_id`| Identifier of the agent that spawned this one. Absent for the main session and for agents spawned directly from it| `file_path`| Target file path for Read, Edit, and Write tools| `OTEL_LOG_TOOL_DETAILS` `full_command`| Command string for the Bash tool| `OTEL_LOG_TOOL_DETAILS` `skill_name`| Skill name for the Skill tool| `OTEL_LOG_TOOL_DETAILS` @@ -944,6 +946,22 @@ ​ +Hook plugin metrics event + +Logged when an official-marketplace plugin hook emits per-invocation metrics. Only plugins installed from an official Anthropic marketplace can emit these. Third-party marketplace plugins and user-configured hooks do not emit to this event. Use this event to monitor plugin behavior such as finding rates, costs, and durations from your own observability stack. **Event Name** : `claude_code.hook_plugin_metrics` **Attributes** : + + * All standard attributes + * `event.name`: `"hook_plugin_metrics"` + * `event.timestamp`: ISO 8601 timestamp + * `event.sequence`: monotonically increasing counter for ordering events within a session + * `plugin_id`: plugin identifier in `<name>@<marketplace>` form + * `hook_event`: hook event type that emitted the metrics + * Up to 20 plugin-emitted metric keys. Names match `^[a-z][a-z0-9_]{0,39}$`. Values are boolean or number. + +#### + +​ + Compaction event Logged when conversation compaction completes. **Event Name** : `claude_code.compaction` **Attributes** :
modified Output styles View current →
--- a/output-styles.md +++ b/output-styles.md @@ -14,7 +14,7 @@ Claude Code’s **Default** output style is the existing system prompt, designed to help you complete software engineering tasks efficiently. There are three additional built-in output styles: - * **Proactive** : Claude executes immediately, makes reasonable assumptions instead of pausing for routine decisions, and prefers action over planning. This applies the same guidance as [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) without changing your permission mode, so you still see permission prompts before tools run. + * **Proactive** : Claude executes immediately, makes reasonable assumptions instead of pausing for routine decisions, and prefers action over planning. This is stronger autonomous-execution guidance than [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) applies, and it works without changing your permission mode, so you still see permission prompts before tools run. * **Explanatory** : Provides educational “Insights” in between helping you complete software engineering tasks. Helps you understand implementation choices and codebase patterns. * **Learning** : Collaborative, learn-by-doing mode where Claude will not only share “Insights” while coding, but also ask you to contribute small, strategic pieces of code yourself. Claude Code will add `TODO(human)` markers in your code for you to implement. @@ -30,7 +30,7 @@ "outputStyle": "Explanatory" } -Because the output style is set in the system prompt at session start, changes take effect the next time you start a new session. This keeps the system prompt stable throughout a conversation so prompt caching can reduce latency and cost. +Output style is part of the system prompt, which Claude Code reads once at session start. Changes take effect after `/clear` or a new session. See [How Claude Code uses prompt caching](</docs/en/prompt-caching#changing-output-style>) for what an output style change does to the cache. ## @@ -72,7 +72,7 @@ Switch to your style -Run `/config` and select your style under **Output style**. It takes effect the next time you start a session. +Run `/config` and select your style under **Output style**. It takes effect after `/clear` or the next time you start a session. [Plugins](</docs/en/plugins-reference>) can also ship output styles in an `output-styles/` directory. @@ -128,6 +128,6 @@ Related resources * [Settings](</docs/en/settings>): where the `outputStyle` field lives and how settings precedence works - * [Permission modes](</docs/en/permission-modes>): the Proactive style mirrors auto mode without changing your permission mode + * [Permission modes](</docs/en/permission-modes>): how the Proactive style compares to auto mode * [Plugins](</docs/en/plugins>): package and distribute output styles alongside skills, hooks, and agents * [Debug your configuration](</docs/en/debug-your-config>): diagnose why an output style isn’t taking effect
modified Choose a permission mode View current →
--- a/permission-modes.md +++ b/permission-modes.md @@ -148,7 +148,7 @@ Auto mode requires Claude Code v2.1.83 or later. -Auto mode lets Claude execute without permission prompts. A separate classifier model reviews actions before they run, blocking anything that escalates beyond your request, targets unrecognized infrastructure, or appears driven by hostile content Claude read. Auto mode also instructs Claude to execute immediately and minimize clarifying questions. To get that behavior while keeping permission prompts, set the [Proactive output style](</docs/en/output-styles>) instead. +Auto mode lets Claude execute without permission prompts. A separate classifier model reviews actions before they run, blocking anything that escalates beyond your request, targets unrecognized infrastructure, or appears driven by hostile content Claude read. Auto mode also nudges Claude to keep working without stopping for clarifying questions. For stronger autonomous behavior while keeping permission prompts, set the [Proactive output style](</docs/en/output-styles>) instead. Auto mode is a research preview. It reduces prompts but does not guarantee safety. Use it for tasks where you trust the general direction, not as a replacement for review on sensitive operations.
modified Configure permissions View current →
--- a/permissions.md +++ b/permissions.md @@ -32,7 +32,7 @@ * **Ask** rules prompt for confirmation whenever Claude Code tries to use the specified tool. * **Deny** rules prevent Claude Code from using the specified tool. -Rules are evaluated in order: **deny - > ask -> allow**. The first matching rule wins, so deny rules always take precedence. +Rules are evaluated in order: **deny - > ask -> allow**. The first matching rule wins, so deny rules always take precedence. Deny rules behave differently depending on whether they name a tool or scope a pattern within one. A bare tool name like `Bash` removes the tool from Claude’s context entirely, so Claude never sees it. A scoped rule like `Bash(rm *)` leaves the tool available and blocks matching calls when Claude attempts them. Permission rules are enforced by Claude Code, not by the model. Instructions in your prompt or `CLAUDE.md` shape what Claude tries to do, but they don’t change what Claude Code allows. To grant or revoke access, use `/permissions`, the rules described here, a [permission mode](</docs/en/permission-modes>), or a PreToolUse hook. @@ -79,7 +79,7 @@ `WebFetch`| Matches all web fetch requests `Read`| Matches all file reads -`Bash(*)` is equivalent to `Bash` and matches all Bash commands. +`Bash(*)` is equivalent to `Bash` and matches all Bash commands. As a deny rule, both forms remove the tool from Claude’s context. ###
modified Create plugins View current →
--- a/plugins.md +++ b/plugins.md @@ -356,14 +356,19 @@ ​ -Submit your plugin to the official marketplace - -To submit a plugin to the official Anthropic marketplace, use one of the in-app submission forms: +Submit your plugin to the community marketplace + +Anthropic maintains two public marketplaces for Claude Code plugins: + + * **`claude-plugins-official`** : a curated set of plugins maintained by Anthropic. Available automatically in every Claude Code installation. + * **`claude-community`** : the public community marketplace where third-party submissions land after review. Users add it with `/plugin marketplace add anthropics/claude-plugins-community` and install from it as `@claude-community`. + +To submit your plugin for community-marketplace review, use one of the in-app forms: * **Claude.ai** : [claude.ai/settings/plugins/submit](<https://claude.ai/settings/plugins/submit>) * **Console** : [platform.claude.com/plugins/submit](<https://platform.claude.com/plugins/submit>) -Once your plugin is listed, you can have your own CLI prompt Claude Code users to install it. See [Recommend your plugin from your CLI](</docs/en/plugin-hints>). +Run `claude plugin validate` locally before you submit. The review pipeline runs the same check on every submission, along with automated safety screening. Approved plugins are pinned to a specific commit SHA in the [`anthropics/claude-plugins-community`](<https://github.com/anthropics/claude-plugins-community>) catalog, and CI bumps the pin automatically as you push new commits to your repository. The public catalog syncs nightly from the review pipeline, so there can be a delay between approval and your plugin appearing in `marketplace.json`. To check whether your plugin is installable yet, search for its name in the [community catalog](<https://github.com/anthropics/claude-plugins-community/blob/main/.claude-plugin/marketplace.json>). The official marketplace, `claude-plugins-official`, is curated separately. Anthropic decides which plugins to include at its discretion. There is no application process, and the submission form does not add plugins to the official marketplace. If Anthropic lists your plugin in the official marketplace, your CLI can prompt Claude Code users to install it. See [Recommend your plugin from your CLI](</docs/en/plugin-hints>). For complete technical specifications, debugging techniques, and distribution strategies, see [Plugins reference](</docs/en/plugins-reference>).
modified Plugins reference View current →
--- a/plugins-reference.md +++ b/plugins-reference.md @@ -380,6 +380,16 @@ `name`| string| Unique identifier (kebab-case, no spaces)| `"deployment-tools"` This name is used for namespacing components. For example, in the UI, the agent `agent-creator` for the plugin with name `plugin-dev` will appear as `plugin-dev:agent-creator`. + +### + +​ + +Unrecognized fields + +Claude Code ignores top-level fields it does not recognize. You can keep metadata from another ecosystem in `plugin.json` and the plugin still loads. This makes it practical to maintain one manifest that doubles as a VS Code or Cursor extension manifest, an npm `package.json`, or an MCPB/DXT bundle manifest. `claude plugin validate` reports unrecognized fields as warnings, not errors. If a field is one or two characters off from a recognized one, the warning suggests the likely intended name. A plugin with only unrecognized-field warnings still passes validation and loads at runtime. Fields with the wrong type still fail. For example, a `keywords` value that is a string instead of an array is a load error, and `claude plugin validate` reports it as one. Pass `--strict` to treat warnings as errors. Use it in CI to catch a misspelled field name or a field left over from another tool’s manifest before publishing, even though the plugin would load at runtime. + + claude plugin validate ./my-plugin --strict ###
added How Claude Code uses prompt caching View current →
Show diff (269 lines)
--- a/prompt-caching.md +++ b/prompt-caching.md @@ -0,0 +1,266 @@ +> ## Documentation Index +> +> Fetch the complete documentation index at: <https://code.claude.com/docs/llms.txt> +> +> Use this file to discover all available pages before exploring further. + +Prompt caching makes Claude Code faster and more cost-efficient. Without caching, the API would reprocess your full history on every turn. With caching, it reuses what it already processed and only does new work for what changed. Claude Code handles prompt caching for you, unless you disable it. It is still useful to know how prompt caching works, because some actions invalidate the cache and make the next response slower and more expensive while it rebuilds. This page covers which actions those are, why some settings wait for a restart to apply, and how to check cache performance when usage looks high. + +## + +​ + +How the cache is organized + +Each time you send a message in Claude Code, it makes a new API request. The model doesn’t remember anything between requests, so Claude Code re-sends the full context: the system prompt, your project context, every prior message and tool result, and your new message. New content is appended at the end, which means most of each request is identical to the one before it. Prompt caching is how the API avoids reprocessing the part that didn’t change. The API caches by matching the start of each request, called the prefix, against content it recently processed. On a normal turn, the prefix is the entire previous request and only the latest exchange is new. The match is exact, so a change anywhere in the prefix recomputes everything after it. There is no per-file or per-segment caching. See [how prompt caching works](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching#how-prompt-caching-works>) in the API reference for the underlying mechanism. To get the most out of prefix matching, Claude Code orders each request so content that rarely changes between turns comes first: + +Layer| Content| Changes when +---|---|--- +System prompt| Core instructions, tool definitions, output style| An MCP server connects or disconnects, or Claude Code is upgraded +Project context| CLAUDE.md, auto memory, unscoped rules| Session starts, or after `/clear` or `/compact` +Conversation| Your messages, Claude’s responses, tool results| Every turn + +A change to the conversation layer leaves the system prompt and project context cached. A change to the system prompt invalidates everything, because all later content now sits behind a different prefix. The third column gives common triggers rather than an exhaustive list, and the sections below cover the full set, including content such as output style that is fixed at session start. The prefix-match rule explains most of the behaviors on this page. [Plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) and [skill loading](</docs/en/skills>), for example, append their instructions as conversation messages, so the cached prefix stays intact. Two settings aren’t part of the prompt text at all, so they don’t appear in the layer table. They behave differently for caching: + + * **Model** : the cache is keyed by model, so each model has its own cache. Switching models recomputes the entire request even when the content is identical. See Switching models below. + * **Effort level** : not part of the cache key or the prompt, so [changing it](</docs/en/model-config#adjust-effort-level>) mid-session has no effect on the cache. + +Pick your model and connect MCP servers at the top of a session, then save `/compact` for natural breaks between tasks. The fewer changes you make mid-task, the higher your cache hit rate. + +### + +​ + +Where the cache lives + +Caching happens server-side, in whichever infrastructure serves your model. Where that is depends on how you authenticate: + + * **API key, Claude subscription, or[Claude Platform on AWS](</docs/en/claude-platform-on-aws>)**: the cache lives in Anthropic’s infrastructure, accessed through the [Claude API](<https://platform.claude.com/docs>) + * **Bedrock or Vertex AI** : the cache lives in your cloud provider’s serving infrastructure + * **Foundry** : requests route to Anthropic’s infrastructure + * **Custom`ANTHROPIC_BASE_URL` or [LLM gateway](</docs/en/llm-gateway>)**: the cache lives wherever your requests are forwarded, and whether caching works depends on the gateway + +For what each provider stores and processes, see [data usage](</docs/en/data-usage>). Wherever the cache lives, entries expire after a period of inactivity, and Cache lifetime below covers the TTL and how to extend it. + +## + +​ + +Actions that invalidate the cache + +These actions cause the next request to miss part or all of the cache. You see a one-time slower, more expensive turn, after which the new prefix is cached. Most of them are avoidable mid-task once you know they have a cost. A model switch or an MCP reconnect can feel free until you notice the slower turn that follows. + + * Switching models + * Connecting or disconnecting an MCP server + * Denying an entire tool + * Compacting the conversation + * Upgrading Claude Code + +### + +​ + +Switching models + +Each model has its own cache. Switching with [`/model`](</docs/en/model-config#setting-your-model>) means the next request reads the entire conversation history with no cache hits, even though the content is identical. The [`opusplan` model setting](</docs/en/model-config#opusplan-model-setting>) resolves to Opus during plan mode and Sonnet during execution, so each plan-mode toggle is a model switch and starts a fresh cache. + +### + +​ + +Connecting or disconnecting an MCP server + +Tool definitions sit in the system prompt layer, so the cache invalidates when the set of MCP tools available to Claude changes between turns. The most common cause is an [MCP server](</docs/en/mcp>) connecting or disconnecting mid-session, which can happen without any action on your part: a stdio server’s process exits, an HTTP session expires, or a server [reconnects automatically after a transient failure](</docs/en/mcp#automatic-reconnection>). A connected server can also push a [dynamic tool update](</docs/en/mcp#dynamic-tool-updates>) that changes its tool list. Editing your MCP config does not by itself change the cache. The new config takes effect only after a restart, which is when the server connects or disconnects. [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) reduces how much each tool contributes to the prefix by deferring full tool definitions, but the set of tool names still has to stay stable for the cache to remain valid. + +### + +​ + +Denying an entire tool + +Adding a bare tool name like `Bash` or `WebFetch` as a [deny rule](</docs/en/permissions#manage-permissions>) removes that tool from Claude’s context entirely. Tool definitions sit in the system prompt layer, so adding or removing one of these rules mid-session invalidates the cache the same way an MCP server connecting or disconnecting does. The change takes effect on the next turn whether you add it through `/permissions` or by [editing a settings file directly](</docs/en/settings#when-edits-take-effect>). Only a bare tool name, or the equivalent `Bash(*)` form, has this effect. Scoped deny rules like `Bash(rm *)`, and all allow and ask rules, don’t change which tools Claude sees. Claude Code checks them when Claude attempts a call, leaving the prefix intact. + +### + +​ + +Compacting the conversation + +[Compaction](</docs/en/context-window#what-survives-compaction>) replaces your message history with a summary. By design, this invalidates the conversation layer, since the next request has a new, shorter history that doesn’t share a prefix with the old one. Claude Code reuses the system prompt layer and reloads project context from disk, which cache-hits only if CLAUDE.md and memory are unchanged since the session started. To produce the summary, Claude Code sends a one-off request with the same system prompt, tools, and history as your conversation, plus a summarization instruction appended as a final user message. Because it shares your prefix, that request reads the existing cache rather than reprocessing the full history. Most of compaction’s time goes to generating the summary, not to a cache miss. The turn that follows rebuilds the conversation cache only for the much shorter summary, so the post-compaction turn is not the slow part. + +Compaction works in your favor when the context you discard is content you no longer need. To choose when its overhead happens, run `/compact` at a natural break in your work, such as between tasks, instead of waiting for auto-compaction to trigger mid-task. If you’ve gone down a path you want to abandon entirely, `/rewind` to an earlier turn instead. Rewinding truncates back to a prefix that is already cached, rather than building a new one as compaction does. + +### + +​ + +Upgrading Claude Code + +A new Claude Code version typically updates the system prompt or tool definitions, so the first request after an upgrade rebuilds the cache from the top. [Auto-update](</docs/en/setup#auto-updates>) downloads new versions in the background but applies them on the next launch, never mid-session, so you see this as an uncached first turn after restarting rather than a surprise during a session. Set `DISABLE_AUTOUPDATER=1` to control when upgrades apply. + +[Resuming a session](</docs/en/sessions#resume-a-session>) after an upgrade reprocesses the entire conversation history with no cache hits, since the history now sits behind a different system prompt. The cost scales with how long the resumed conversation is, so the first turn back into a long session can be the most expensive request you send. + +## + +​ + +Actions that keep the cache + +These actions either append to the end of the conversation or don’t touch the request at all. Some of them, such as editing CLAUDE.md or changing output style, are also why a setting change waits for a restart to apply. + + * Editing files in your repository + * Editing CLAUDE.md mid-session + * Changing output style + * Changing permission mode + * Invoking skills and commands + * Running `/recap` + * Rewinding the conversation + * Spawning a subagent + +### + +​ + +Editing files in your repository + +File contents enter context only when Claude reads them, and reads append to the conversation. Editing a file Claude previously read does not retroactively change the earlier read in history. Instead, Claude Code appends a `<system-reminder>` noting the file changed, and Claude re-reads it if needed. + +### + +​ + +Editing CLAUDE.md mid-session + +Your project-root and user-level CLAUDE.md files are read once at session start and held in memory. Editing them mid-session does not invalidate the cache, but the edit also doesn’t apply. Claude keeps working with the version that was loaded at session start. The new content loads on the next `/clear`, `/compact`, or restart. [Nested CLAUDE.md files in subdirectories](</docs/en/memory>) and [rules with `paths:` frontmatter](</docs/en/memory#path-specific-rules>) load later, when Claude first reads a matching file. Editing one before it loads does take effect. After it loads, the content is part of the conversation history, so a mid-session edit doesn’t retroactively change it. + +### + +​ + +Changing output style + +[Output style](</docs/en/output-styles>) is part of the system prompt, which Claude Code reads once at session start. Changing it via `/config` or the `outputStyle` setting mid-session does not invalidate the cache, but the change also doesn’t apply. Claude keeps using the style that was loaded at session start. The new style loads on the next `/clear` or restart. + +### + +​ + +Changing permission mode + +Switching between [permission modes](</docs/en/permission-modes>), such as from default to accept edits, does not change the system prompt or tool definitions, so mode changes are cache-safe. The exception is plan mode with the [`opusplan`](</docs/en/model-config#opusplan-model-setting>) model setting, which switches the model between Opus and Sonnet as you enter or leave plan mode. That makes the mode toggle a model switch. + +### + +​ + +Invoking skills and commands + +[Skills](</docs/en/skills>) and [commands](</docs/en/commands>) inject their instructions as user messages at the point of invocation. Nothing earlier in the conversation changes. + +### + +​ + +Running `/recap` + +[`/recap`](</docs/en/interactive-mode#session-recap>) generates a summary for display in your terminal. Unlike `/compact`, it appends the summary as command output rather than replacing your message history, so the cached prefix stays intact. + +### + +​ + +Rewinding the conversation + +[`/rewind`](</docs/en/checkpointing>) truncates your conversation back to an earlier turn. The remaining history is the same content the cache was built from at that point, and the system prompt and project context layers are unchanged, so the next request hits the earlier cache entry. Every turn since then has read through that prefix, which kept the entry warm even if the original turn was longer ago than the TTL. Restoring file checkpoints alongside the conversation has no separate effect on the cache. File contents enter context only when Claude reads them, the same as editing files in your repository. + +## + +​ + +Cache lifetime + +Cached prefixes expire after a period of inactivity. Each request that hits the cache resets the timer, so the cache stays warm as long as you keep working. After a long enough gap, the next request recomputes the full input and re-establishes the cache, which is why the first turn back after stepping away can be noticeably slower. The time to live (TTL) controls how long a gap the cache survives. The API offers two: a five-minute TTL, and a [one-hour TTL](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching#1-hour-cache-duration>) that keeps the cache warm through longer breaks but [bills cache writes at a higher rate](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching#pricing>). Claude Code picks the TTL for you based on how you authenticate, and you can override it with environment variables. + +### + +​ + +On a Claude subscription + +On a Claude subscription, Claude Code requests the one-hour TTL automatically. Usage is included in your plan rather than billed per token, so the longer TTL costs you nothing extra and only affects how long your cache stays warm. If you’ve gone over your plan’s usage limit and Claude Code is drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>), you are billed for that usage, so Claude Code automatically drops the TTL to five minutes. + +### + +​ + +On an API key or third-party provider + +On an API key, Bedrock, Vertex, Foundry, or Claude Platform on AWS, you pay the per-token rates, so the TTL stays at the cheaper five minutes by default. To opt into the [one-hour TTL](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching#1-hour-cache-duration>), set `ENABLE_PROMPT_CACHING_1H=1`. On Bedrock, prompt caching support, minimum cacheable prefix length, and one-hour TTL availability all vary by model. If cache token counts stay at zero, check [supported models, regions, and limits](<https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-caching.html#prompt-caching-models>) in the Bedrock documentation. + +### + +​ + +Override the TTL + +Set `FORCE_PROMPT_CACHING_5M=1` to force the five-minute TTL regardless of authentication. This is useful when you’re debugging cache behavior, comparing the two TTLs, or overriding an `ENABLE_PROMPT_CACHING_1H` set in [managed settings](</docs/en/settings#settings-files>). + +## + +​ + +Cache scope + +In Claude Code, the cache is effectively scoped to one machine and directory. The system prompt embeds the working directory, platform, shell, OS version, and auto-memory paths, so two sessions in different directories build different prefixes and miss each other’s cache. That includes worktrees of the same repository, since each worktree has its own working directory. Sessions you run in parallel in the same directory build matching prefixes and read each other’s cache. Sequential sessions share the prefix only when the git status snapshot at startup matches, since the system prompt also captures branch and recent commits. The underlying API cache is broader. Caches are isolated between organizations, and on some providers, [between workspaces within an organization](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching#cache-storage-and-sharing>). Within those boundaries, any two requests with the same model and prefix read the same cache. For Agent SDK callers running fleets of automated processes, see [improve prompt caching across users and machines](</docs/en/agent-sdk/modifying-system-prompts#improve-prompt-caching-across-users-and-machines>) to suppress the per-machine sections of the system prompt and share the cache across machines. + +## + +​ + +Check cache performance + +Cache performance shows up as two token counts the API reports on every response. The most direct way to watch them live is a [statusline script](</docs/en/statusline>) that reads the `current_usage` object: + +Field| Meaning +---|--- +`cache_creation_input_tokens`| Tokens written to the cache on this turn, billed at the cache write rate +`cache_read_input_tokens`| Tokens served from cache on this turn, billed at roughly 10% of the standard input rate + +A high read-to-creation ratio means caching is working well. If creation stays high turn after turn, something is changing in your prefix. The actions that invalidate the cache section lists the usual causes. For visibility across an organization, the OpenTelemetry exporter reports cache read and creation tokens per user and session. See [Monitor usage](</docs/en/monitoring-usage>) for the metric and event attribute reference. + +## + +​ + +Subagents and the cache + +A [subagent](</docs/en/sub-agents>) starts its own conversation with its own system prompt and tool set, separate from the parent’s. It builds its own cache, starting with no cache hits on its first call and warming up across its own turns. Subagents use the five-minute TTL even on a subscription, since the automatic one-hour TTL applies to the main conversation. The parent’s cache is unaffected. From the parent’s side, the subagent’s call and result append to the conversation, leaving the parent’s prefix intact. A [fork](</docs/en/sub-agents#fork-the-current-conversation>), by contrast, inherits the parent’s system prompt, tools, and conversation history exactly, so its first request reads the parent’s cache. The compaction summarization call described in Compacting the conversation uses the same prefix-sharing approach. + +## + +​ + +Disable prompt caching + +Disabling caching is occasionally useful when debugging caching behavior with a specific model or provider. To turn it off, set one of these environment variables to `1`: + +Variable| Effect +---|--- +`DISABLE_PROMPT_CACHING`| Disable for all models +`DISABLE_PROMPT_CACHING_HAIKU`| Disable for Haiku only +`DISABLE_PROMPT_CACHING_SONNET`| Disable for Sonnet only +`DISABLE_PROMPT_CACHING_OPUS`| Disable for Opus only + +To set caching policy across an organization, put any of these or the TTL variables in the `env` block of [managed settings](</docs/en/settings#settings-files>). For normal use, leave caching enabled. + +## + +​ + +Related resources + + * [Lessons from building Claude Code: Prompt caching is everything](<https://claude.com/blog/lessons-from-building-claude-code-prompt-caching-is-everything>): the design rationale for plan mode, deferred tool loading, and compaction + * [Explore the context window](</docs/en/context-window>): what loads into context and when + * [Reduce token usage](</docs/en/costs#reduce-token-usage>): strategies beyond caching for managing context size + * [Track and reduce costs](</docs/en/agent-sdk/cost-tracking>): cache token tracking and TTL configuration for Agent SDK callers + * [Prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>): the underlying API mechanism, breakpoints, and pricing
modified Agent SDK reference - Python View current →
--- a/python.md +++ b/python.md @@ -925,7 +925,7 @@ `resume`| `str | None`| `None`| Session ID to resume `max_turns`| `int | None`| `None`| Maximum agentic turns (tool-use round trips) `max_budget_usd`| `float | None`| `None`| Stop the query when the client-side cost estimate reaches this USD value. Compared against the same estimate as `total_cost_usd`; see [Track cost and usage](</docs/en/agent-sdk/cost-tracking>) for accuracy caveats -`disallowed_tools`| `list[str]`| `[]`| Tools to always deny. Deny rules are checked first and override `allowed_tools` and `permission_mode` (including `bypassPermissions`) +`disallowed_tools`| `list[str]`| `[]`| Tools to deny. A bare name such as `"Bash"` removes the tool from Claude’s context. A scoped rule such as `"Bash(rm *)"` leaves the tool available and denies matching calls in every permission mode, including `bypassPermissions`. See [Permissions](</docs/en/agent-sdk/permissions#allow-and-deny-rules>) `enable_file_checkpointing`| `bool`| `False`| Enable file change tracking for rewinding. See [File checkpointing](</docs/en/agent-sdk/file-checkpointing>) `model`| `str | None`| `None`| Claude model to use `fallback_model`| `str | None`| `None`| Fallback model to use if the primary model fails
modified Automate work with routines View current →
--- a/routines.md +++ b/routines.md @@ -392,6 +392,21 @@ ​ +`/schedule` returns “Unknown command” + +The CLI hides `/schedule` when one of its requirements is not met. The cause is usually one of the following: + + * You are authenticated with a Console API key or a cloud provider such as Bedrock, Vertex, or Foundry. `/schedule` requires a claude.ai subscription login. If `ANTHROPIC_API_KEY` or `ANTHROPIC_AUTH_TOKEN` is set in your shell, or `apiKeyHelper` is set in `settings.json`, remove it first, since these take precedence over a claude.ai login + * `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, or `DISABLE_GROWTHBOOK` is set in your shell environment or in the `env` block of a [`settings.json` file](</docs/en/settings#available-settings>). These disable feature-flag fetching, which `/schedule` depends on + * You are inside a Claude Code on the web session. Manage routines from the [web UI](<https://claude.ai/code/routines>) instead + * Your CLI is older than v2.1.81. Run `claude update` + +You can always create and manage routines at [claude.ai/code/routines](<https://claude.ai/code/routines>) regardless of how the CLI is configured. + +### + +​ + ”Routines are disabled by your organization’s policy” Your Team or Enterprise admin has likely turned off the **Routines** toggle at [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>). This is a server-side organization setting, so it cannot be overridden from your local configuration. Contact your admin to request that routines be enabled for your organization.
modified Claude Code settings View current →
--- a/settings.md +++ b/settings.md @@ -156,6 +156,17 @@ } The `$schema` line in the example above points to the [official JSON schema](<https://json.schemastore.org/claude-code-settings.json>) for Claude Code settings. Adding it to your `settings.json` enables autocomplete and inline validation in VS Code, Cursor, and any other editor that supports JSON schema validation. The published schema is updated periodically and may not include settings added in the most recent CLI releases, so a validation warning on a recently documented field does not necessarily mean your configuration is invalid. + +### + +​ + +When edits take effect + +Claude Code watches your settings files and reloads them when they change, so edits to most keys apply to the running session without a restart. This includes `permissions`, `hooks`, and credential helpers like `apiKeyHelper`. The reload covers user, project, local, and managed settings, and the [`ConfigChange` hook](</docs/en/hooks#configchange>) fires for each detected change. A few keys are read once at session start and apply on the next restart instead: + + * `model`: use [`/model`](</docs/en/model-config#setting-your-model>) to switch mid-session + * [`outputStyle`](</docs/en/output-styles>): part of the system prompt, which is rebuilt on `/clear` or restart ### @@ -205,7 +216,7 @@ `effortLevel`| Persist the [effort level](</docs/en/model-config#adjust-effort-level>) across sessions. Accepts `"low"`, `"medium"`, `"high"`, or `"xhigh"`. Written automatically when you run `/effort` with one of those values. `--effort` and [`CLAUDE_CODE_EFFORT_LEVEL`](</docs/en/env-vars>) override this for one session. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) for supported models| `"xhigh"` `enableAllProjectMcpServers`| Automatically approve all MCP servers defined in project `.mcp.json` files| `true` `enabledMcpjsonServers`| List of specific MCP servers from `.mcp.json` files to approve| `["memory", "github"]` -`env`| Environment variables that will be applied to every session| `{"FOO": "bar"}` +`env`| Environment variables applied to every session and to subprocesses Claude Code spawns from it. As of v2.1.143, `NO_COLOR` and `FORCE_COLOR` set here are passed to subprocesses but do not change Claude Code’s own interface colors. Set those in your shell before launching `claude` to change interface colors| `{"FOO": "bar"}` `fastModePerSessionOptIn`| When `true`, fast mode does not persist across sessions. Each session starts with fast mode off, requiring users to enable it with `/fast`. The user’s fast mode preference is still saved. See [Require per-session opt-in](</docs/en/fast-mode#require-per-session-opt-in>)| `true` `feedbackSurveyRate`| Probability (0–1) that the [session quality survey](</docs/en/data-usage#session-quality-surveys>) appears when eligible. Set to `0` to suppress entirely, or set [`CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`](</docs/en/env-vars>) in `env`. Useful when using Bedrock, Vertex, or Foundry where the default sample rate does not apply| `0.05` `fileSuggestion`| Configure a custom script for `@` file autocomplete. See File suggestion settings| `{"type": "command", "command": "~/.claude/file-suggestion.sh"}` @@ -241,7 +252,7 @@ `skipWebFetchPreflight`| Skip the [WebFetch domain safety check](</docs/en/data-usage#webfetch-domain-safety-check>) that sends each requested hostname to `api.anthropic.com` before fetching. Set to `true` in environments that block traffic to Anthropic, such as Bedrock, Vertex AI, or Foundry deployments with restrictive egress. When skipped, WebFetch attempts any URL without consulting the blocklist| `true` `spinnerTipsEnabled`| Show tips in the spinner while Claude is working. Set to `false` to disable tips (default: `true`)| `false` `spinnerTipsOverride`| Override spinner tips with custom strings. `tips`: array of tip strings. `excludeDefault`: if `true`, only show custom tips; if `false` or absent, custom tips are merged with built-in tips| `{ "excludeDefault": true, "tips": ["Use our internal tool X"] }` -`spinnerVerbs`| Customize the action verbs shown in the spinner and turn duration messages. Set `mode` to `"replace"` to use only your verbs, or `"append"` to add them to the defaults| `{"mode": "append", "verbs": ["Pondering", "Crafting"]}` +`spinnerVerbs`| Customize the action verbs shown while a turn is in progress. Set `mode` to `"replace"` to use only your verbs, or `"append"` to add them to the defaults| `{"mode": "append", "verbs": ["Pondering", "Crafting"]}` `sshConfigs`| SSH connections to show in the [Desktop](</docs/en/desktop#pre-configure-ssh-connections-for-your-team>) environment dropdown. Each entry requires `id`, `name`, and `sshHost`; `sshPort`, `sshIdentityFile`, and `startDirectory` are optional. When set in managed settings, connections are read-only for users. Read from managed and user settings only| `[{"id": "dev-vm", "name": "Dev VM", "sshHost": "user@dev.example.com"}]` `statusLine`| Configure a custom status line to display context. See [`statusLine` documentation](</docs/en/statusline>)| `{"type": "command", "command": "~/.claude/statusline.sh"}` `strictKnownMarketplaces`| (Managed settings only) Allowlist of plugin marketplace sources. Undefined = no restrictions, empty array = lockdown. Enforced on marketplace add and on plugin install, update, refresh, and auto-update, so a marketplace added before the policy was set cannot be used to fetch plugins. See [Managed marketplace restrictions](</docs/en/plugin-marketplaces#managed-marketplace-restrictions>)| `[{ "source": "github", "repo": "acme-corp/plugins" }]`
modified Extend Claude with skills View current →
--- a/skills.md +++ b/skills.md @@ -17,6 +17,22 @@ Bundled skills Claude Code includes a set of bundled skills that are available in every session, including `/simplify`, `/batch`, `/debug`, `/loop`, and `/claude-api`. Unlike most built-in commands, which execute fixed logic directly, bundled skills are prompt-based: they give Claude detailed instructions and let it orchestrate the work using its tools. You invoke them the same way as any other skill, by typing `/` followed by the skill name. Bundled skills are listed alongside built-in commands in the [commands reference](</docs/en/commands>), marked **Skill** in the Purpose column. + +### + +​ + +Run and verify your app + +Three bundled skills work together to launch your app and confirm changes against the running app instead of just tests: + +Skill| Purpose +---|--- +`/run`| Launch and drive your app to see a change working +`/verify`| Build and run your app to confirm a code change does what it should, without falling back to tests or type checks +`/run-skill-generator`| Teach `/run` and `/verify` how to build and launch your project + +All three skills require Claude Code v2.1.145 or later. `/run` and `/verify` work without setup. They infer the launch from your project type (CLI, server, TUI, browser-driven) and from what’s in your README, `package.json`, or `Makefile`. That inference gets unreliable for projects that need anything beyond a standard launch: a database, an env file, a graphical session, a multi-step build. `/run-skill-generator` records the recipe instead. It gets your app running from a clean environment, captures what worked (the install commands, the env vars, the launch script), and commits it as a per-project skill at `.claude/skills/run-<name>/`. After that, `/run`, `/verify`, and any other agent in the repo follow the recorded recipe instead of rediscovering it. Run `/run-skill-generator` once per project, and again if the build or launch process changes. ## @@ -400,7 +416,7 @@ 2. The output replaces the placeholder in the skill content 3. Claude receives the fully-rendered prompt with actual PR data -This is preprocessing, not something Claude executes. Claude only sees the final result. Substitution runs once over the original file. Command output is inserted as plain text and is not re-scanned for further `!`<command>`` placeholders, so a command cannot emit a placeholder for a later pass to expand. For multi-line commands, use a fenced code block opened with ````!` instead of the inline form: +This is preprocessing, not something Claude executes. Claude only sees the final result. Substitution runs once over the original file. Command output is inserted as plain text and is not re-scanned for further `!`<command>`` placeholders, so a command cannot emit a placeholder for a later pass to expand. The inline form is only recognized when `!` appears at the start of a line or immediately after whitespace. If `!` follows another character, as in `KEY=!`cmd``, the placeholder is left as literal text and the command does not run. For multi-line commands, use a fenced code block opened with ````!` instead of the inline form: ## Environment ```!
modified Customize your status line View current →
--- a/statusline.md +++ b/statusline.md @@ -151,6 +151,7 @@ `workspace.project_dir`| Directory where Claude Code was launched, which may differ from `cwd` if the working directory changes during a session `workspace.added_dirs`| Additional directories added via `/add-dir` or `--add-dir`. Empty array if none have been added `workspace.git_worktree`| Git worktree name when the current directory is inside a linked worktree created with `git worktree add`. Absent in the main working tree. Populated for any git worktree, unlike `worktree.*` which applies only to `--worktree` sessions +`workspace.repo.host`, `workspace.repo.owner`, `workspace.repo.name`| Repository identity parsed from the `origin` remote, for example `"github.com"`, `"anthropics"`, `"claude-code"`. Absent outside a git repository or when no `origin` remote is configured `cost.total_cost_usd`| Estimated session cost in USD, computed client-side. May differ from your actual bill `cost.total_duration_ms`| Total wall-clock time since the session started, in milliseconds `cost.total_api_duration_ms`| Total time spent waiting for API responses in milliseconds @@ -172,6 +173,8 @@ `output_style.name`| Name of the current output style `vim.mode`| Current vim mode (`NORMAL`, `INSERT`, `VISUAL`, or `VISUAL LINE`) when [vim mode](</docs/en/interactive-mode#vim-editor-mode>) is enabled `agent.name`| Agent name when running with the `--agent` flag or agent settings configured +`pr.number`, `pr.url`| Open pull request for the current branch. Mirrors the PR badge in the bottom status bar. Absent until a PR is found, when not in a git repository, or once the PR merges or closes +`pr.review_state`| Review status of the open PR: `approved`, `pending`, `changes_requested`, or `draft`. May be independently absent even when `pr` is present `worktree.name`| Name of the active worktree. Present only during `--worktree` sessions `worktree.path`| Absolute path to the worktree directory `worktree.branch`| Git branch name for the worktree (for example, `"worktree-my-feature"`). Absent for hook-based worktrees @@ -195,7 +198,12 @@ "current_dir": "/current/working/directory", "project_dir": "/original/project/directory", "added_dirs": [], - "git_worktree": "feature-xyz" + "git_worktree": "feature-xyz", + "repo": { + "host": "github.com", + "owner": "anthropics", + "name": "claude-code" + } }, "version": "2.1.90", "output_style": { @@ -244,6 +252,11 @@ "agent": { "name": "security-reviewer" }, + "pr": { + "number": 1234, + "url": "https://github.com/anthropics/claude-code/pull/1234", + "review_state": "pending" + }, "worktree": { "name": "my-feature", "path": "/path/to/.claude/worktrees/my-feature", @@ -257,9 +270,11 @@ * `session_name`: appears only when a custom name has been set with `--name` or `/rename` * `workspace.git_worktree`: appears only when the current directory is inside a linked git worktree + * `workspace.repo`: appears only inside a git repository with an `origin` remote configured * `effort`: appears only when the current model supports the reasoning effort parameter * `vim`: appears only when vim mode is enabled * `agent`: appears only when running with the `--agent` flag or agent settings configured + * `pr`: appears only while an open PR is found for the current branch, and is removed once the PR merges or closes. `pr.review_state` may be independently absent * `worktree`: appears only during `--worktree` sessions. When present, `branch` and `original_branch` may also be absent for hook-based worktrees * `rate_limits`: appears only for Claude.ai subscribers (Pro/Max) after the first API response in the session. Each window (`five_hour`, `seven_day`) may be independently absent. Use `jq -r '.rate_limits.five_hour.used_percentage // empty'` to handle absence gracefully. @@ -288,7 +303,7 @@ * `cache_creation_input_tokens`: tokens written to cache * `cache_read_input_tokens`: tokens read from cache -The `used_percentage` field is calculated from input tokens only: `input_tokens + cache_creation_input_tokens + cache_read_input_tokens`. It does not include `output_tokens`. If you calculate context percentage manually from `current_usage`, use the same input-only formula to match `used_percentage`. The `current_usage` object is `null` before the first API call in a session, and again immediately after `/compact` until the next API call repopulates it. +For what the cache fields mean and how they’re billed, see [check cache performance](</docs/en/prompt-caching#check-cache-performance>). The `used_percentage` field is calculated from input tokens only: `input_tokens + cache_creation_input_tokens + cache_read_input_tokens`. It does not include `output_tokens`. If you calculate context percentage manually from `current_usage`, use the same input-only formula to match `used_percentage`. The `current_usage` object is `null` before the first API call in a session, and again immediately after `/compact` until the next API call repopulates it. ##
modified Create custom subagents View current →
--- a/sub-agents.md +++ b/sub-agents.md @@ -859,7 +859,7 @@ Permissions| Prompts surface in your terminal| Auto-denied when running in the background Prompt cache| Shared with main session| Separate cache -Because a fork’s system prompt and tool definitions are identical to the parent, its first request reuses the parent’s prompt cache. This makes forking cheaper than spawning a fresh subagent for tasks that need the same context. When Claude spawns a fork through the Agent tool, it can pass `isolation: "worktree"` so the fork’s file edits are written to a separate git worktree instead of your checkout. +Because a fork’s system prompt and tool definitions are identical to the parent, its first request reuses the parent’s [prompt cache](</docs/en/prompt-caching#subagents-and-the-cache>). This makes forking cheaper than spawning a fresh subagent for tasks that need the same context. When Claude spawns a fork through the Agent tool, it can pass `isolation: "worktree"` so the fork’s file edits are written to a separate git worktree instead of your checkout. ###
modified Tools reference View current →
--- a/tools-reference.md +++ b/tools-reference.md @@ -130,7 +130,7 @@ * **Match** : `old_string` must appear in the file exactly as written. A single character of whitespace or indentation difference is enough to miss. * **Uniqueness** : `old_string` must appear exactly once. When it appears more than once, Claude either supplies a longer string with enough surrounding context to pin down one occurrence, or sets `replace_all: true` to replace them all. -Viewing a file with Bash also satisfies the read-before-edit requirement when the command is `cat path/to/file` or `sed -n 'X,Yp' path/to/file` on a single file with no pipes or redirects. Other Bash commands such as `head`, `tail`, or piped output do not count, and Claude must use Read before editing in those cases. This affects edit eligibility only, not permissions. [Read and Edit deny rules](</docs/en/permissions#tool-specific-permission-rules>) also apply to file commands Claude Code recognizes in Bash, such as `cat`, `head`, `tail`, and `sed`, but not to arbitrary subprocesses that read or write files indirectly, like a Python or Node script that opens files itself. For OS-level enforcement that covers every process, [enable the sandbox](</docs/en/sandboxing>). +Viewing a file with Bash also satisfies the read-before-edit requirement when the command is `cat`, `head`, `tail`, or `sed -n 'X,Yp'` on a single file with no pipes, redirects, or other flags. Piped output and other Bash commands do not count, and Claude must use Read before editing in those cases. This affects edit eligibility only, not permissions. [Read and Edit deny rules](</docs/en/permissions#tool-specific-permission-rules>) also apply to file commands Claude Code recognizes in Bash, such as `cat`, `head`, `tail`, and `sed`, but not to arbitrary subprocesses that read or write files indirectly, like a Python or Node script that opens files itself. For OS-level enforcement that covers every process, [enable the sandbox](</docs/en/sandboxing>). ## @@ -263,7 +263,7 @@ Read tool behavior -The Read tool takes a file path and returns the contents with line numbers. Claude is instructed to always pass absolute paths. By default, Read returns the file from the start. Files over a size threshold return an error rather than partial content, prompting Claude to retry with `offset` and `limit` to read a specific range. Read handles several file types beyond plain text: +The Read tool takes a file path and returns the contents with line numbers. Claude is instructed to always pass absolute paths. By default, Read returns the file from the start. When a whole-file read exceeds the token limit, Read returns the first page with a `PARTIAL view` notice that tells Claude how much of the file it received and how to read more with `offset` and `limit`. A read that passes an explicit `offset` or `limit` and still exceeds the token limit returns an error. Read handles several file types beyond plain text: * **Images** : PNG, JPG, and other image formats are returned as visual content that Claude can see, not as raw bytes. Claude Code resizes and recompresses large images to fit the model’s image size limits before sending them, so Claude may see a downscaled version of a large screenshot. If Claude misses fine pixel-level detail in a large image, ask it to crop the region of interest first, for example with ImageMagick via Bash. * **PDFs** : Claude reads short `.pdf` files whole. For PDFs longer than 10 pages, it reads in ranges with a `pages` parameter, such as `"1-5"`, up to 20 pages at a time. @@ -302,7 +302,7 @@ Write tool behavior -The Write tool creates a new file or overwrites an existing one with the full content provided. It does not append or merge. If the target path already exists, Claude must have read that file at least once in the current conversation before overwriting it. A Write to an unread existing file fails with an error. This constraint does not apply to new files. Viewing the file with Bash `cat` or `sed -n` also satisfies this requirement, as described in Edit tool behavior. For partial changes to an existing file, Claude uses Edit instead of Write. +The Write tool creates a new file or overwrites an existing one with the full content provided. It does not append or merge. If the target path already exists, Claude must have read that file at least once in the current conversation before overwriting it. A Write to an unread existing file fails with an error. This constraint does not apply to new files. Viewing the file with Bash also satisfies this requirement under the same rules described in Edit tool behavior. For partial changes to an existing file, Claude uses Edit instead of Write. ##
modified Agent SDK reference - TypeScript View current →
Show diff (266 lines)
--- a/typescript.md +++ b/typescript.md @@ -13,6 +13,32 @@ npm install @anthropic-ai/claude-agent-sdk The SDK bundles a native Claude Code binary for your platform as an optional dependency such as `@anthropic-ai/claude-agent-sdk-darwin-arm64`. You don’t need to install Claude Code separately. If your package manager skips optional dependencies, the SDK throws `Native CLI binary for <platform> not found`; set `pathToClaudeCodeExecutable` to a separately installed `claude` binary instead. + +### + +​ + +Compile to a single executable + +When you compile your application into a single-file executable with `bun build --compile`, the SDK cannot resolve the bundled CLI binary at runtime. `require.resolve` does not work inside the compiled executable’s `$bunfs` virtual filesystem, so the SDK throws `Native CLI binary for <platform> not found`. To work around this, embed the platform binary as a file asset, extract it to a real path at startup with `extractFromBunfs()`, and pass that path to `pathToClaudeCodeExecutable`. The `extractFromBunfs()` helper requires `@anthropic-ai/claude-agent-sdk` v0.3.144 or later. The example below builds for macOS on Apple Silicon: + + import binPath from "@anthropic-ai/claude-agent-sdk-darwin-arm64/claude" with { type: "file" }; + import { extractFromBunfs } from "@anthropic-ai/claude-agent-sdk/extract"; + import { query } from "@anthropic-ai/claude-agent-sdk"; + + const cliPath = extractFromBunfs(binPath); + + for await (const message of query({ + prompt: "Hello", + options: { pathToClaudeCodeExecutable: cliPath }, + })) { + console.log(message); + } + +`extractFromBunfs()` copies the embedded binary out of the compiled executable’s virtual filesystem to a per-user temp directory and returns the real path. Outside a compiled executable it returns the input path unchanged, so the same code runs in development without modification. Each compiled executable embeds a single platform’s binary. Match the platform package in the import to your `--target`: + + * To cross-compile, install the non-matching platform package, for example `npm install @anthropic-ai/claude-agent-sdk-linux-x64 --force`. + * On Windows, the binary subpath is `claude.exe`, for example `@anthropic-ai/claude-agent-sdk-win32-x64/claude.exe`. ## @@ -285,7 +311,7 @@ `uuid`| `string`| Unique message identifier `session_id`| `string`| Session this message belongs to `message`| `unknown`| Raw message payload from the transcript -`parent_tool_use_id`| `null`| Reserved +`parent_tool_use_id`| `string | null`| For subagent messages, the `tool_use_id` of the spawning `Agent` tool call. `null` for main-session messages and older sessions #### @@ -467,6 +493,7 @@ `additionalDirectories`| `string[]`| `[]`| Additional directories Claude can access `agent`| `string`| `undefined`| Agent name for the main thread. The agent must be defined in the `agents` option or in settings `agents`| `Record<string, [`AgentDefinition`](#agentdefinition)>`| `undefined`| Programmatically define subagents +`agentProgressSummaries`| `boolean`| `false`| When `true`, generate one-line progress summaries for subagents and forward them on `task_progress` events via the `summary` field. Applies to foreground and background subagents `allowDangerouslySkipPermissions`| `boolean`| `false`| Enable bypassing permissions. Required when using `permissionMode: 'bypassPermissions'` `allowedTools`| `string[]`| `[]`| Tools to auto-approve without prompting. This does not restrict Claude to only these tools; unlisted tools fall through to `permissionMode` and `canUseTool`. Use `disallowedTools` to block tools. See [Permissions](</docs/en/agent-sdk/permissions#allow-and-deny-rules>) `betas`| `SdkBeta``[]`| `[]`| Enable beta features @@ -475,7 +502,7 @@ `cwd`| `string`| `process.cwd()`| Current working directory `debug`| `boolean`| `false`| Enable debug mode for the Claude Code process `debugFile`| `string`| `undefined`| Write debug logs to a specific file path. Implicitly enables debug mode -`disallowedTools`| `string[]`| `[]`| Tools to always deny. Deny rules are checked first and override `allowedTools` and `permissionMode` (including `bypassPermissions`) +`disallowedTools`| `string[]`| `[]`| Tools to deny. A bare name such as `"Bash"` removes the tool from Claude’s context. A scoped rule such as `"Bash(rm *)"` leaves the tool available and denies matching calls in every permission mode, including `bypassPermissions`. See [Permissions](</docs/en/agent-sdk/permissions#allow-and-deny-rules>) `effort`| `'low' | 'medium' | 'high' | 'xhigh' | 'max'`| `'high'`| Controls how much effort Claude puts into its response. Works with adaptive thinking to guide thinking depth `enableFileCheckpointing`| `boolean`| `false`| Enable file change tracking for rewinding. See [File checkpointing](</docs/en/agent-sdk/file-checkpointing>) `env`| `Record<string, string | undefined>`| `process.env`| Environment variables. See [Environment variables](</docs/en/env-vars>) for variables the underlying CLI reads, and Handle slow or stalled API responses for timeout-related variables. Set `CLAUDE_AGENT_SDK_CLIENT_APP` to identify your app in the User-Agent header @@ -484,20 +511,25 @@ `extraArgs`| `Record<string, string | null>`| `{}`| Additional arguments `fallbackModel`| `string`| `undefined`| Model to use if primary fails `forkSession`| `boolean`| `false`| When resuming with `resume`, fork to a new session ID instead of continuing the original session +`forwardSubagentText`| `boolean`| `false`| Forward subagent text and thinking blocks as assistant and user messages with `parent_tool_use_id` set, so consumers can render a nested transcript. By default only `tool_use` and `tool_result` blocks from subagents are emitted `hooks`| `Partial<Record<``HookEvent``, ``HookCallbackMatcher``[]>>`| `{}`| Hook callbacks for events `includeHookEvents`| `boolean`| `false`| Include hook lifecycle events in the message stream as `SDKHookStartedMessage`, `SDKHookProgressMessage`, and `SDKHookResponseMessage` `includePartialMessages`| `boolean`| `false`| Include partial message events +`loadTimeoutMs`| `number`| `60000`| _Alpha._ Timeout in milliseconds for each `sessionStore.load()` and `sessionStore.listSubkeys()` call during resume materialization. If the adapter doesn’t settle within this window, the query fails instead of hanging. Ignored when `sessionStore` is not set +`managedSettings`| `Settings`| `undefined`| Policy-tier settings supplied by the spawning parent process. Dropped when an IT-controlled managed-settings tier already exists on the machine, unless that admin opts in with `parentSettingsBehavior: 'merge'`. Filtered to restrictive-only keys regardless `maxBudgetUsd`| `number`| `undefined`| Stop the query when the client-side cost estimate reaches this USD value. Compared against the same estimate as `total_cost_usd`; see [Track cost and usage](</docs/en/agent-sdk/cost-tracking>) for accuracy caveats `maxThinkingTokens`| `number`| `undefined`| _Deprecated:_ Use `thinking` instead. Maximum tokens for thinking process `maxTurns`| `number`| `undefined`| Maximum agentic turns (tool-use round trips) `mcpServers`| `Record<string, [`McpServerConfig`](#mcpserverconfig)>`| `{}`| MCP server configurations `model`| `string`| Default from CLI| Claude model to use +`onElicitation`| `(request: ElicitationRequest, options: { signal: AbortSignal }) => Promise<ElicitationResult>`| `undefined`| Callback for handling MCP elicitation requests. Called when an MCP server requests user input and no hook handles it first. When not provided, unhandled elicitation requests are declined automatically `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>) +`outputStyle`| `string`| `undefined`| Not an `Options` field. Set `outputStyle` in the inline [`settings`](</docs/en/settings>) object or a settings file instead. See [Activate an output style](</docs/en/agent-sdk/modifying-system-prompts#activate-an-output-style>) `pathToClaudeCodeExecutable`| `string`| Auto-resolved from bundled native binary| Path to Claude Code executable. Only needed if optional dependencies were skipped during install or your platform isn’t in the supported set `permissionMode`| `PermissionMode`| `'default'`| Permission mode for the session `permissionPromptToolName`| `string`| `undefined`| MCP tool name for permission prompts `persistSession`| `boolean`| `true`| When `false`, disables session persistence to disk. Sessions cannot be resumed later +`planModeInstructions`| `string`| `undefined`| Custom workflow instructions for plan mode. When `permissionMode` is `'plan'`, this string replaces the default plan-mode workflow body. The CLI still wraps it with the read-only enforcement preamble and the ExitPlanMode protocol footer `plugins`| `SdkPluginConfig``[]`| `[]`| Load custom plugins from local paths. See [Plugins](</docs/en/agent-sdk/plugins>) for details `promptSuggestions`| `boolean`| `false`| Enable prompt suggestions. Emits a `prompt_suggestion` message after each turn with a predicted next user prompt `resume`| `string`| `undefined`| Session ID to resume @@ -505,6 +537,7 @@ `sandbox`| `SandboxSettings`| `undefined`| Configure sandbox behavior programmatically. See Sandbox settings for details `sessionId`| `string`| Auto-generated| Use a specific UUID for the session instead of auto-generating one `sessionStore`| [`SessionStore`](</docs/en/agent-sdk/session-storage#the-sessionstore-interface>)| `undefined`| Mirror session transcripts to an external backend so any host can resume them. See [Persist sessions to external storage](</docs/en/agent-sdk/session-storage>) +`sessionStoreFlush`| `'batched' | 'eager'`| `'batched'`| _Alpha._ Flush mode for `sessionStore`. Ignored when `sessionStore` is not set `settings`| `string | Settings`| `undefined`| Inline [settings](</docs/en/settings>) object or path to a settings file. Populates the flag-settings layer in the [precedence order](</docs/en/settings#settings-precedence>). Change at runtime with `applyFlagSettings()` `settingSources`| `SettingSource``[]`| CLI defaults (all sources)| Control which filesystem settings to load. Pass `[]` to disable user, project, and local settings. Managed policy settings load regardless. See [Use Claude Code features](</docs/en/agent-sdk/claude-code-features#what-settingsources-does-not-control>) `skills`| `string[] | 'all'`| `undefined`| Skills available to the session. Pass `'all'` to enable every discovered skill, or a list of skill names. When set, the SDK enables the Skill tool automatically without listing it in `allowedTools`. See [Skills](</docs/en/agent-sdk/skills>) @@ -512,7 +545,10 @@ `stderr`| `(data: string) => void`| `undefined`| Callback for stderr output `strictMcpConfig`| `boolean`| `false`| Use only the servers passed in `mcpServers` and ignore project `.mcp.json`, user settings, and plugin-provided MCP servers `systemPrompt`| `string | { type: 'preset'; preset: 'claude_code'; append?: string; excludeDynamicSections?: boolean }`| `undefined` (minimal prompt)| System prompt configuration. Pass a string for custom prompt, or `{ type: 'preset', preset: 'claude_code' }` to use Claude Code’s system prompt. When using the preset object form, add `append` to extend it with additional instructions, and set `excludeDynamicSections: true` to move per-session context into the first user message for [better prompt-cache reuse across machines](</docs/en/agent-sdk/modifying-system-prompts#improve-prompt-caching-across-users-and-machines>) +`taskBudget`| `{ total: number }`| `undefined`| _Alpha._ API-side task budget in tokens. When set, the model is told its remaining token budget so it can pace tool use and wrap up before the limit `thinking`| `ThinkingConfig`| `{ type: 'adaptive' }` for supported models| Controls Claude’s thinking/reasoning behavior. See `ThinkingConfig` for options +`title`| `string`| `undefined`| Display title for the session. When resuming via `resume` or `continue`, the resumed session’s persisted title takes precedence; use `renameSession()` to retitle an existing session +`toolAliases`| `Record<string, string>`| `undefined`| Map built-in tool names to MCP tool names so Claude calls your MCP implementation in place of the built-in. For example, `{ Bash: 'mcp__workspace__bash' }` `toolConfig`| `ToolConfig`| `undefined`| Configuration for built-in tool behavior. See `ToolConfig` for details `tools`| `string[] | { type: 'preset'; preset: 'claude_code' }`| `undefined`| Tool configuration. Pass an array of tool names or use the preset to get Claude Code’s default tools @@ -1051,11 +1087,17 @@ | SDKTaskStartedMessage | SDKTaskProgressMessage | SDKTaskUpdatedMessage + | SDKSessionStateChangedMessage + | SDKNotificationMessage | SDKFilesPersistedEvent | SDKToolUseSummaryMessage + | SDKMemoryRecallMessage | SDKRateLimitEvent + | SDKElicitationCompleteMessage | SDKPermissionDeniedMessage - | SDKPromptSuggestionMessage; + | SDKPromptSuggestionMessage + | SDKAPIRetryMessage + | SDKMirrorErrorMessage; ### @@ -1074,7 +1116,7 @@ error?: SDKAssistantMessageError; }; -The `message` field is a [`BetaMessage`](<https://platform.claude.com/docs/en/api/messages/create>) from the Anthropic SDK. It includes fields like `id`, `content`, `model`, `stop_reason`, and `usage`. `SDKAssistantMessageError` is one of: `'authentication_failed'`, `'oauth_org_not_allowed'`, `'billing_error'`, `'rate_limit'`, `'invalid_request'`, `'server_error'`, `'max_output_tokens'`, or `'unknown'`. +The `message` field is a [`BetaMessage`](<https://platform.claude.com/docs/en/api/messages/create>) from the Anthropic SDK. It includes fields like `id`, `content`, `model`, `stop_reason`, and `usage`. `SDKAssistantMessageError` is one of: `'authentication_failed'`, `'oauth_org_not_allowed'`, `'billing_error'`, `'rate_limit'`, `'invalid_request'`, `'model_not_found'`, `'server_error'`, `'max_output_tokens'`, or `'unknown'`. `'model_not_found'` means the selected model doesn’t exist or isn’t available to your account or deployment. ### @@ -1135,15 +1177,19 @@ duration_ms: number; duration_api_ms: number; is_error: boolean; + api_error_status?: number | null; num_turns: number; result: string; stop_reason: string | null; + ttft_ms?: number; total_cost_usd: number; usage: NonNullableUsage; modelUsage: { [modelName: string]: ModelUsage }; permission_denials: SDKPermissionDenial[]; structured_output?: unknown; deferred_tool_use?: { id: string; name: string; input: Record<string, unknown> }; + terminal_reason?: TerminalReason; + fast_mode_state?: FastModeState; origin?: SDKMessageOrigin; } | { @@ -1165,8 +1211,17 @@ modelUsage: { [modelName: string]: ModelUsage }; permission_denials: SDKPermissionDenial[]; errors: string[]; + terminal_reason?: TerminalReason; + fast_mode_state?: FastModeState; origin?: SDKMessageOrigin; }; + +Several fields on the result carry diagnostic detail beyond `subtype`: + + * `api_error_status`: the HTTP status code of the API error that terminated the conversation. Absent or `null` when the turn ended without an API error. + * `ttft_ms`: time to first token in milliseconds. Present on the success arm only. + * `terminal_reason`: why the loop ended. One of `"completed"`, `"max_turns"`, `"tool_deferred"`, `"aborted_streaming"`, `"aborted_tools"`, `"hook_stopped"`, `"stop_hook_prevented"`, `"blocking_limit"`, `"rapid_refill_breaker"`, `"prompt_too_long"`, `"image_error"`, or `"model_error"`. + * `fast_mode_state`: one of `"on"`, `"off"`, or `"cooldown"`. The `origin` field forwards the `SDKMessageOrigin` of the user message that triggered this result. When a background task finishes and the SDK injects a synthetic follow-up turn, the resulting `SDKResultMessage` carries `origin: { kind: "task-notification" }`. Check this field to distinguish results that answer your prompt from results emitted for background-task follow-ups, so you can route or suppress the latter. The field is absent for results emitted before any user turn, such as startup errors. When a `PreToolUse` hook returns `permissionDecision: "defer"`, the result has `stop_reason: "tool_deferred"` and `deferred_tool_use` carries the pending tool’s `id`, `name`, and `input`. Read this field to surface the request in your own UI, then resume with the same `session_id` to continue. See [Defer a tool call for later](</docs/en/hooks#defer-a-tool-call-for-later>) for the full round trip. @@ -1555,6 +1610,8 @@ hook_event_name: "Stop"; stop_hook_active: boolean; last_assistant_message?: string; + background_tasks?: BackgroundTaskSummary[]; + session_crons?: SessionCronSummary[]; }; #### @@ -1582,6 +1639,27 @@ agent_transcript_path: string; agent_type: string; last_assistant_message?: string; + background_tasks?: BackgroundTaskSummary[]; + session_crons?: SessionCronSummary[]; + }; + + type BackgroundTaskSummary = { + id: string; + type: string; + status: string; + description: string; + command?: string; + agent_type?: string; + server?: string; + tool?: string; + name?: string; + }; + + type SessionCronSummary = { + id: string; + schedule: string; + recurring: boolean; + prompt: string; }; #### @@ -3056,14 +3134,25 @@ `Usage` -Token usage statistics (from `@anthropic-ai/sdk`). +Token usage statistics. This is the `BetaUsage` type from `@anthropic-ai/sdk`. type Usage = { - input_tokens: number | null; - output_tokens: number | null; - cache_creation_input_tokens?: number | null; - cache_read_input_tokens?: number | null; - }; + input_tokens: number; + output_tokens: number; + cache_creation_input_tokens: number | null; + cache_read_input_tokens: number | null; + cache_creation: { + ephemeral_5m_input_tokens: number; + ephemeral_1h_input_tokens: number; + } | null; + server_tool_use: BetaServerToolUsage | null; + service_tier: "standard" | "priority" | "batch" | null; + speed: "standard" | "fast" | null; + inference_geo: string | null; + iterations: BetaIterationsUsage | null; + }; + +`BetaServerToolUsage` and `BetaIterationsUsage` are defined in `@anthropic-ai/sdk`. ### @@ -3357,7 +3446,7 @@ `SDKTaskProgressMessage` -Emitted periodically while a background task is running. +Emitted periodically while a subagent or background task is running. The `summary` field is populated only when `agentProgressSummaries` is enabled. type SDKTaskProgressMessage = { type: "system"; @@ -3365,12 +3454,14 @@ task_id: string; tool_use_id?: string; description: string; + subagent_type?: string; usage: { total_tokens: number; tool_uses: number; duration_ms: number; }; last_tool_name?: string; + summary?: string; uuid: UUID; session_id: string; };