modified Escalate hard decisions with the advisor tool View current →
--- a/advisor.md +++ b/advisor.md @@ -71,7 +71,7 @@ * Your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist excludes the requested model * You requested Fable and your account still requires the usage-credits consent -If you start a [background session](</docs/en/agent-view>) with `--advisor` and one of these applies, Claude Code starts the session without the advisor instead of exiting. If the requested model can act as an advisor but ranks below the session’s main model, Claude Code starts the session anyway. Outside background sessions, it also warns at launch that the model `cannot advise` the main model. +If you start a [background session](</docs/en/agent-view>) with `--advisor` and one of these applies, Claude Code starts the session without the advisor instead of exiting. If the model you pass can act as an advisor but ranks below your main model, the session starts whether or not it’s a background session. Your main model then runs without the advisor. ##
modified Manage multiple agents with agent view View current →
Show diff (213 lines)
--- a/agent-view.md +++ b/agent-view.md @@ -44,7 +44,13 @@ This step needs a running session. If you followed the earlier steps you don’t have one open in this terminal, so open a regular `claude` session in another terminal and send it a message first.To move a session you already have open into agent view, run `/bg` inside it, or press `←` on an empty prompt to background it and open agent view in one step. In a fresh session with no messages yet, `/bg` asks you to send a message first, while `←` works right away. The session keeps running and appears as a row alongside the ones you dispatched. -Inside a regular `claude` session, the prompt footer’s `←` hint counts the background agents that are waiting on you, such as `← 2 agents`, and returns to `← for agents` when none need input. Counts above 99 show as `99+`. The count refreshes about every ten seconds while the terminal is focused and immediately when focus returns. It briefly changes color when it moves and when an agent completes, and when a background session finishes while none need your input it briefly shows the number completed, such as `← 2 done`. Both flashes are off when the [`prefersReducedMotion` setting](</docs/en/settings-reference#prefersreducedmotion>) is on, and the hint is hidden in [screen reader mode](</docs/en/accessibility>). +In a regular `claude` session, pressing `←` on an empty prompt opens agent view, and a `←` hint in the footer reports on your background sessions: + + * **Hint** : the footer shows `← for agents` for ten seconds after the session opens. Pressing `←` still works after the hint disappears + * **Waiting count** : while background sessions wait on your input, the same spot counts them, such as `← 2 agents`, or `← 99+ agents` when more than 99 wait. The count refreshes about every ten seconds while the terminal is focused and immediately when focus returns + * **Finished count** : when background sessions finish successfully while none wait on your input, the footer briefly shows how many finished, such as `← 2 done` for two + +The waiting count briefly changes color when it goes up or down and when a background session finishes successfully. If you turn on [`prefersReducedMotion`](</docs/en/settings-reference#prefersreducedmotion>), you see neither the color change nor the `done` count. In [screen reader mode](</docs/en/accessibility>), the `←` hint and its counts are hidden. ### @@ -236,15 +242,24 @@ * Press `Shift+↑` or `Shift+↓` to reorder sessions * Press `Ctrl+R` to rename a session * Press `Enter` on a group header to collapse it, except while a filter is active, when every group stays expanded - -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. The second press deletes the session even when the stop attempt fails, for example because the background service isn’t responding: the confirmation stays active for another two seconds, and the delete ends the session’s process itself. Press `Esc` to dismiss the confirmation without deleting. Except in the kept cases covered in What deleting a session removes, deleting removes the session from the list, and a worktree Claude created for it is removed, kept, or left in place depending on how you delete and what the worktree holds. The conversation transcript stays on your local machine, available through `claude --resume`. To bring a session back on Claude Code v2.1.212 or later, type `/resume` in the dispatch input. A picker opens with past sessions of the repository you opened agent view from, newest first, including sessions you deleted from the list; sessions that already have a row aren’t listed. `↑`/`↓` move the selection, `Enter` resumes the selected session as a background session so it rejoins the list as a row, and `Esc` closes the picker. The picker opens only for a bare `/resume`. A targeted, scoped, or restricted resume can’t be served by the picker, so agent view shows the `attach to a session to run it` hint instead when: + * Press `Ctrl+X` to stop a session and `Ctrl+X` again within two seconds to delete it from the list, or `Esc` to dismiss the confirmation without deleting. The second press deletes the session even when the stop attempt fails, for example because the background service isn’t responding. In that case the confirmation stays active for another two seconds, and the delete ends the session’s process itself + +Pressing `Ctrl+X` on a group header deletes every session in that group after confirmation. Except in the kept cases covered in What deleting a session removes, deleting removes the session from the list. A worktree Claude created for it is removed, kept, or left in place depending on how you delete and what the worktree holds. The conversation transcript stays on your local machine, available through `claude --resume`. Completed sessions that don’t fit on screen fold into a `… N more` row. The `Completed` group fills the vertical space left after the live groups. On a short terminal, the header compacts to a single summary line so sessions that are working or need input stay visible. + +#### + +​ + +Bring back a past session + +To bring a session back on Claude Code v2.1.212 or later, type `/resume` in the dispatch input. A picker opens with past sessions of the repository you opened agent view from, newest first, including sessions you deleted from the list. Sessions that already have a row aren’t listed. Press `Enter` to resume the selected session as a background session, so it rejoins the list as a row. `/resume` fails with `isn't available in agent view` when: * `/resume` names an id or a search term * the view is scoped with `--cwd` * the view was started with [`--safe-mode`](</docs/en/cli-reference#cli-flags>) * the view was opened with a flag such as `--permission-mode` or `--settings` -Completed sessions that don’t fit on screen fold into a `… N more` row. The `Completed` group fills the vertical space left after the live groups, and on a short terminal the header compacts to a single summary line so sessions that are working or need input stay visible. +If you typed anything after `/resume`, retype without it. If you used one of those flags, run `claude agents` in your shell without it, then type `/resume` alone. ### @@ -329,11 +344,11 @@ * `/exit` and `/quit` close agent view * `/logout` signs you out - * `/model` sets the dispatch model + * `/model`, `/effort`, and `/fast` set what the sessions you dispatch next start with. `/effort` and `/fast` require Claude Code v2.1.299 or later. * `/login` opens the sign-in dialog so you can sign in again without attaching to a session * A bare `/resume`, or its `/continue` alias, opens a picker of the repository’s past sessions to bring one back as a background session. Requires Claude Code v2.1.212 or later -Skills, your own commands, and prompt-expanding built-ins such as `/init` are sent to a new background session as their first prompt. Other built-in commands show an `attach to a session to run it` hint instead. Everything you typed stays in the input next to the hint so you can edit it. Packaging a recurring task as a [skill](</docs/en/skills>) lets you start the same workflow from agent view repeatedly without retyping the prompt. When the same `@name` matches both a subagent and a sibling repository, the subagent takes precedence. The bare first-word match also applies, so a prompt that happens to begin with one of your subagent names dispatches that subagent rather than treating the word as plain text. Use the `@` form when you want to be explicit, or start the prompt with a different word to avoid the match. +Skills, your own commands, and prompt-expanding built-ins such as `/init` are sent to a new background session as its first prompt. The hint `isn't available in agent view` means the built-in command you entered didn’t run. To run it, attach to a session and enter it there. Everything you typed stays in the input next to the hint so you can edit it. Packaging a recurring task as a [skill](</docs/en/skills>) lets you start the same workflow from agent view repeatedly without retyping the prompt. When the same `@name` matches both a subagent and a sibling repository, the subagent takes precedence. The bare first-word match also applies, so a prompt that happens to begin with one of your subagent names dispatches that subagent rather than treating the word as plain text. Use the `@` form when you want to be explicit, or start the prompt with a different word to avoid the match. #### @@ -390,7 +405,7 @@ What carries over when you background -Backgrounding starts a fresh process that resumes from the saved conversation, and in-flight background work moves to it: running background shell commands, backgrounded subagents, dynamic workflows, scheduled tasks you created with [`/loop`](</docs/en/scheduled-tasks>), and Claude’s [automatic replies to artifact comments](</docs/en/artifacts#let-claude-reply-to-comments-on-its-own>) all carry over and keep running there. A subagent moves together with everything it started, so it carries over only when all of that work can move too. To stop in-flight background work instead of carrying it over, set the [`CLAUDE_DISABLE_ADOPT=1`](</docs/en/env-vars#variables>) environment variable; Claude Code then asks you to confirm before backgrounding. When a [dynamic workflow](</docs/en/workflows>) still has subagents running, Claude Code asks before backgrounding with the `Background this session?` dialog, which says how many subagents would restart. Choose `Stay` to let them finish first. If you confirm, Claude Code replays the run in the background session: subagents that were still running start over from the beginning, so the tokens they used so far are spent again. See [Resume after a pause](</docs/en/workflows#resume-after-a-pause>) for which completed subagents return their saved results and which run again. Claude Code stops background work that can’t carry over, such as a running [monitor](</docs/en/tools-reference#monitor-tool>), and stops a backgrounded subagent that owns a monitor along with it. When any such work is running, Claude Code shows the `Background this session?` dialog so you can confirm before it stops the work. Once in the background, the session can start new subagents, monitors, and background commands, and those keep running across later detach and reattach. Configuration flags from the original launch carry through to the backgrounded session, so its MCP servers, settings, and fallback model remain in effect: +Backgrounding starts a fresh process that resumes from the saved conversation, and in-flight background work moves to it. Running background shell commands, backgrounded subagents, dynamic workflows, scheduled tasks you created with [`/loop`](</docs/en/scheduled-tasks>), and Claude’s [automatic replies to artifact comments](</docs/en/artifacts#let-claude-reply-to-comments-on-its-own>) all carry over and keep running there. A subagent moves together with everything it started, so it carries over only when all of that work can move too. When a [dynamic workflow](</docs/en/workflows>) still has subagents running, Claude Code asks before backgrounding with the `Background this session?` dialog, which says how many subagents would restart. Choose `Stay` to let them finish first. If you confirm, Claude Code replays the run in the background session: subagents that were still running start over from the beginning, so the tokens they used so far are spent again. See [Resume after a pause](</docs/en/workflows#resume-after-a-pause>) for which completed subagents return their saved results and which run again. Claude Code stops background work that can’t carry over, such as a running [monitor](</docs/en/tools-reference#monitor-tool>), and stops a backgrounded subagent that owns a monitor along with it. When any such work is running, Claude Code shows the `Background this session?` dialog so you can confirm before it stops the work. Once in the background, the session can start new subagents, monitors, and background commands, and those keep running across later detach and reattach. Configuration flags from the original launch carry through to the backgrounded session, so its MCP servers, settings, and fallback model remain in effect: * `--mcp-config` and `--strict-mcp-config` * `--settings` @@ -511,9 +526,15 @@ ​ -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 comes from the [`model` setting](</docs/en/settings-reference#model>) in your user settings. Set it by selecting a model in the [`/model` picker](</docs/en/model-config>), or edit the setting directly. To override the dispatch default for the whole agent view session, pass `--model` when opening agent view. See Permission mode, model, and effort. To change the dispatch default from inside agent view, type `/model` followed by a model name in the dispatch input and press `Enter`. The header updates to show that model with a `(session)` marker, and sessions you dispatch afterward use it. Type `/model default` to clear the override and return to the dispatch default. This override lasts for the rest of the current `claude agents` run and doesn’t write to your settings file. The following example dispatches one session on Opus and the next on Sonnet: +Set the model, effort, and fast mode + +In agent view, type `/model`, `/effort`, or `/fast` in the dispatch input and press `Enter`, and the sessions you dispatch afterward start with what you set. Your choice stays with that agent view window and isn’t saved to a settings file. `/effort` and `/fast` require Claude Code v2.1.299 or later, as does `/model` typed with nothing after it. Give the value after the command, or type the command alone to choose one from a list: + + * **Model** : `/model <name>`, for example `/model opus` + * **[Effort level](</docs/en/model-config#adjust-effort-level>)** : `/effort` with `low`, `medium`, `high`, `xhigh`, or `max`, for example `/effort high` + * **Fast mode** : `/fast on` or `/fast off`. The session starts in fast mode only if fast mode is [available to you](</docs/en/fast-mode#requirements>) and its model supports fast mode. On a model that doesn’t, the session starts with fast mode off, so first use `/model` to pick one of the [models that support fast mode](</docs/en/fast-mode>). + +To undo a choice, give `default` as the value, for example `/effort default`. The following example dispatches one session on Opus and the next on Sonnet: /model opus refactor auth @@ -523,8 +544,8 @@ 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` to switch: a pick from the picker, or a typed `/model <name>`, saves as your default for new sessions unless you press `s` in the picker for a session-only switch. A session-only switch persists if the session is respawned. - * Dispatch a [subagent](</docs/en/sub-agents>) whose frontmatter sets a `model` field. + * Attach to a running session and run `/model` to switch. A pick from the picker, or a typed `/model <name>`, saves as your default for new sessions unless you press `s` in the picker for a session-only switch. A session-only switch persists if the session is respawned. + * Dispatch a [subagent](</docs/en/sub-agents>) that sets `model` in its frontmatter, by starting the prompt with its name or mentioning `@name`. While a `/model` choice in the dispatch input applies, the subagent’s `model` isn’t used, so enter `/model default` there. If you launched with `claude agents --model`, the subagent’s isn’t used either, so run `claude agents` in your shell without `--model`. ### @@ -553,6 +574,7 @@ * You background your own session with `←` or `/background` * You dispatch a session into the directory you’re in * You wake a stopped session in the directory you’re in by attaching or replying to it + * You restart a session in the directory you’re in with `claude respawn` Claude Code forwards a gateway in front of a cloud provider. If the shell you dispatch from selects the provider and exports its gateway endpoint with its auth-bypass flag, Claude Code forwards the endpoint-and-flag pair to the session under the conditions that apply to `ANTHROPIC_BASE_URL`, together with `ANTHROPIC_CUSTOM_HEADERS`. For example, export `CLAUDE_CODE_USE_VERTEX=1` with `ANTHROPIC_VERTEX_BASE_URL` and `CLAUDE_CODE_SKIP_VERTEX_AUTH=1`, and Claude Code forwards that endpoint and flag. Claude Code applies a forwarded gateway to that session’s running process only and never writes it to disk. @@ -562,18 +584,13 @@ Permission mode -The [permission mode](</docs/en/permissions>) depends on how you started the session: - - * **Backgrounded with`/bg` or `←`**: Claude Code keeps the permission mode the session was in, so one you switched to `acceptEdits` or `auto` stays there after detaching - * **Dispatched from an agent view you opened with`←`**: Claude Code takes the new session’s permission mode from the target directory’s configuration first, then from the session you came from + * **Backgrounded with`/bg` or `←`**: Claude Code keeps the [permission mode](</docs/en/permissions>) the session was in, so one you switched to `acceptEdits` or `auto` stays there after detaching * **Dispatched from`claude agents` started in a shell, or with `claude --bg`**: the new session starts the way a new `claude` session in that directory would, unless you dispatched it from an agent view you opened with dispatch defaults. [Which permission mode a session starts in](</docs/en/permission-modes#which-mode-a-session-starts-in>) lists the order For a session you dispatch from an agent view opened with `←`, Claude Code takes the permission mode from the first of these that applies: - 1. The target directory’s [`permissions.defaultMode`](</docs/en/settings-reference#permissions-defaultmode>). Two source rules apply: - * `auto` and `bypassPermissions` [take effect only from managed settings, a `--settings` file, or `~/.claude/settings.json`](</docs/en/settings-reference#permissions-defaultmode>). - * Claude Code refuses a `defaultMode` from the project’s `.claude/settings.json` or `.claude/settings.local.json` that selects a more permissive mode than the session you came from was in. - 2. The permission mode of the session you came from. If that session was in `bypassPermissions` mode, the new session can start in Manual mode instead, with the notice `Bypass permissions was requested at launch and ignored`. That happens when your acceptance of the bypass disclaimer is only in `.claude/settings.local.json` or a `--settings` file. Continue in Manual mode, or [add that acceptance to `~/.claude/settings.json`](</docs/en/permission-modes#bypass-permissions-acceptance>). + 1. The target directory’s [`permissions.defaultMode`](</docs/en/settings-reference#permissions-defaultmode>). `auto` and `bypassPermissions` [take effect only from managed settings, a `--settings` file, or `~/.claude/settings.json`](</docs/en/settings-reference#permissions-defaultmode>). Claude Code refuses a `defaultMode` from the project’s `.claude/settings.json` or `.claude/settings.local.json` that selects a more permissive mode than the session you came from was in. + 2. The permission mode of the session you came from. If that session was in `bypassPermissions` mode, the new session can start in Manual mode instead, with the notice `Bypass permissions was requested at launch and ignored`. That happens when your acceptance of the bypass disclaimer is only in `.claude/settings.local.json` or a `--settings` file. Continue in Manual mode, or [add that acceptance to `~/.claude/settings.json`](</docs/en/permission-modes#bypass-permissions-ignored-in-a-background-session>). When Claude Code refuses a source’s mode as too permissive, the next source in the list decides. For example, if you dispatch from a plan-mode session into a directory whose checked-in settings ask for `acceptEdits`, the new session starts in plan mode. If you move that `defaultMode` to `~/.claude/settings.json`, it applies regardless of the permission mode of the session you came from. Permissiveness runs plan, then Manual and `dontAsk`, then `acceptEdits` and auto, which each count as more permissive than the other, then `bypassPermissions`. @@ -701,9 +718,21 @@ * **Finished or waiting for your next message, and unattached for about an hour** : the supervisor stops the process to free resources. A session that ended its turn by asking you a question counts as waiting for your next message. The conversation stays on disk, and the next time you attach or reply, the session resumes where it left off. Pin a session with `Ctrl+T` to keep its process running. * **Exited unexpectedly while the supervisor is running** : the supervisor restarts the process. Ending a session you backgrounded yourself with `←` or `/background`, for example with `kill`, marks it stopped instead of restarting it. For sessions that ended with a shutdown, see Sessions show as failed or stopped after shutdown. * **After an auto-update** : the supervisor restarts itself onto the new version and moves idle sessions over in the background. Sessions that are working, waiting on you, or attached aren’t interrupted. - * **The supervisor itself stops** , for example because its process was ended from outside Claude Code: on macOS and Linux, each session’s process waits about a minute for a new supervisor to reconnect to it, and stops if none does. Run `claude agents` in your shell within that minute to start a new supervisor and keep your sessions running. If the minute passes first, the sessions stop, but their saved conversations stay on disk: attach or reply to a session and it restarts from its saved conversation, as described under Sessions show as failed or stopped after shutdown. + * **The supervisor itself stops** , for example because its process was ended from outside Claude Code: on macOS and Linux, your sessions stop unless a new supervisor connects within about a minute. To start one, run `claude agents` in your shell. After that minute, see Keep sessions running after the supervisor stops. When a session’s process stops or restarts, the background shell commands, dynamic workflows, and background subagents Claude started in it carry over to its next process; running monitors and shell commands a subagent started stop with the process. Deleting the session stops everything it carried over. To stop all of it with the process instead, set [`CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`](</docs/en/env-vars#variables>) to `1`. The supervisor and its sessions authenticate with the same stored credentials as your interactive sessions. For which settings and shell variables reach a session, including `PATH`, see Settings and provider. For gateway endpoints, see LLM gateway. + +#### + +​ + +Keep sessions running after the supervisor stops + +If agent view prints this notice as it exits, no supervisor is running: + + Background sessions still running will stop in about a minute. Run 'claude agents' to keep them. + +Run `claude agents` in your shell within that minute to start a new supervisor and keep your sessions running. If the minute passes first, the sessions stop, but their saved conversations stay on disk. To restart a session from its saved conversation, attach or reply to it, as described under Sessions show as failed or stopped after shutdown. ### @@ -847,7 +876,14 @@ claude daemon stop --any --keep-workers -Then run `claude agents` in your shell to start the new supervisor. If you do that within about a minute of the stop, it reconnects to the still-running sessions, and their work continues uninterrupted. If you take longer, on macOS and Linux the sessions have stopped on their own by then, and attaching or replying to one restarts it from its saved conversation. Without `--keep-workers`, the command ends the background sessions too. The `--any` flag makes the command stop a supervisor that Claude Code started on demand. A supervisor that starts but can’t accept connections exits and releases its lock on its own, so the next `claude agents` starts a fresh one without this manual stop. The steps above apply when a running supervisor stalls. If the command instead exits saying the recorded process couldn’t be verified as the supervisor, check the reported process ID: if it’s a supervisor you own, stop it yourself, then delete `~/.claude/daemon.lock` so the next `claude agents` starts fresh. On Windows, if the supervisor doesn’t respond to the stop request, the command prints its process ID. End that process with `taskkill /PID <pid>` to finish the recovery. Background sessions are still preserved when you passed `--keep-workers`. +Next, run `claude agents` in your shell to start a new supervisor. On macOS and Linux, do so within about a minute of the old one ending, or the sessions stop without a supervisor. If you saw `stopped` but the same error returns, and you’re on macOS or Linux with Claude Code older than v2.1.300, run `claude update`, then both commands again. If the stop command instead printed one of these four messages, the old process wasn’t stopped. Do what the matching row says in your shell, then run `claude agents`: + +Message contains| Platform| Action +---|---|--- +`could not be verified as the daemon, so it was not signalled`| All| Find out which program has that process ID. If it’s your own supervisor, stop it; leave any other program alone. Then delete `~/.claude/daemon.lock`. +`is still running after SIGKILL`| macOS, Linux| Wait for the process to exit. If it never does, restart your computer. +`was not sent SIGKILL`| macOS, Linux| Run the stop command again. If the process remains, check it with `ps -ww -o args= -p <pid>`: Claude Code started with `daemon` is a supervisor, so run `kill -9 <pid>`. Leave anything else; if `claude agents` then can’t start a supervisor, delete `~/.claude/daemon.lock`. +`supervisor (pid=<pid>) is still running`| Windows| End the process with `taskkill /PID <pid>` ### @@ -860,6 +896,18 @@ claude daemon stop --any --keep-workers Within about a minute, run `claude agents` or `claude --bg` in your shell to start a fresh supervisor that reads your stored credentials. If you authenticate with an environment variable such as `ANTHROPIC_API_KEY` rather than `/login`, run that next command from a shell where the variable is set. See the [error reference](</docs/en/errors#could-not-resolve-authentication-method>) for the full list of causes and fixes. + +### + +​ + +A background session shows `No LLM gateway` + +If a background session shows [`No LLM gateway`](</docs/en/errors#no-llm-gateway-opened-from-another-folder>), it didn’t get your gateway `ANTHROPIC_BASE_URL`, so its requests fail. Claude Code withheld it because you dispatched, woke, or restarted the session from a directory other than the folder the message names. You see the message, for example, after you dispatch into a repository with `@<repo>` or wake a stopped session by running `claude attach` from another directory. To give the session your gateway, pick the fix that matches where your gateway is set: + + * **You exported the gateway in your terminal** : in a terminal where you’ve exported the gateway variables, `cd` to the folder the message names and run the message’s `claude respawn <id>` command. + * The gateway reaches the session only when the supervisor was itself started from a shell that exported the same gateway. If the supervisor wasn’t, restart it from the terminal where you ran the respawn command, as Dispatch fails with `Could not resolve authentication method` describes, then run that command again. + * **You used agent view in a project whose settings set the gateway** : put `ANTHROPIC_BASE_URL` and its credential in [a settings file’s `env` block](</docs/en/llm-gateway-connect#set-in-a-settings-file>). Use `~/.claude/settings.json`, or `.claude/settings.local.json` in the session’s own project, both of which a respawned session reads. Then run `claude respawn <id>` in your shell from any directory to restart this session on the gateway. ### @@ -929,6 +977,7 @@ Version| Change ---|--- +v2.1.299| `/effort` and `/fast` in the dispatch input set the effort level and fast mode for the sessions you dispatch next. `/model`, `/effort`, or `/fast` typed with no value opens a picker. v2.1.290| `claude attach` and `claude logs` can take part of a session’s name in place of the ID. v2.1.290| `/model`, `/effort`, `/rename`, and `/usage` sent as a peek reply to a working session run right away. v2.1.290| A peek reply that can’t be delivered is no longer saved for the next restart when it starts with `/`, or when it answers a question with predefined choices while the session’s process is running. @@ -995,7 +1044,8 @@ Worktree deletion: a session whose worktree directory belongs to no git repository can be deleted; before this release every attempt to delete such a session was refused. A directory that’s already gone clears immediately. The agent view double-press removes a directory that still has files, running your `WorktreeRemove` hook for a hook-created directory, unless another session’s records also name it. `claude rm` keeps such a directory whenever files remain. v2.1.214| A session backgrounded with `←` or `/background` and left idle with nothing running has its process stopped like any other idle session, instead of keeping its process and the background service running indefinitely. A completed session can be removed with `claude rm` or from agent view after the background service has gone idle, and a session that entered a worktree after being dispatched from a directory that isn’t a git repository, such as a multi-repo workspace folder, can be deleted from agent view when the worktree itself belongs to a git repository, because the cleanup is resolved from the worktree instead of the directory the session was dispatched from; both removals were refused on every attempt before. Reopening a stopped session restores its saved conversation even when a folder in the transcript store can’t be read. v2.1.213| `/install-github-app`, the [`/mcp`](</docs/en/mcp>) settings list, and MCP authentication actions work in a background session while a terminal is attached, and are refused only when nobody is attached, with a message telling you to attach and run the command again; from v2.1.208 through v2.1.212 they were refused even with a terminal attached. -v2.1.212| `/fork` in an interactive session copies the conversation into a new background session that appears as its own row, named after the session it came from or, for a prompted fork of an unnamed session, after the fork prompt, while the original keeps running; the earlier forked-subagent behavior of `/fork` moved to `/subtask`. With agent view turned off, `/fork` keeps the forked-subagent behavior. A focused row that is waiting for its first prompt shows `space to send it a prompt`. `Ctrl+J` inserts a newline in the dispatch input on terminals with extended key reporting, where the keypress was previously ignored, and the `?` overlay lists the shortcut. The `←` footer hint in an interactive session briefly shows `N done` when a background session finishes while none need your input. Typing a bare `/resume` in agent view opens a picker of past sessions of the repository you opened agent view from, including sessions deleted from the list, and picking one resumes it as a background session; before this release `/resume` wasn’t available in agent view and deleted sessions were reachable only with `claude --resume` or `/resume` from an interactive session. Targeted, scoped, and restricted forms keep the `attach to a session to run it` hint that earlier versions showed for every form. Sessions waiting on a sandbox network-host prompt, an MCP input request, or a managed-settings prompt show as `Needs input` instead of `Working`, in agent view and in `claude agents --json`, and a question from Claude reports `waitingFor: input needed` instead of `permission prompt`. Attaching to a session whose process has stopped shows its transcript formatted the way the live session renders it, instead of as raw text. A stopped session whose transcript is in an unexpected place resumes from it via a last-resort scan of your saved transcripts, and opening a row that has no saved transcript shows `Press enter again to restart this session fresh`, restarting it fresh on the second press; v2.1.211 showed the refusal with no way to restart from agent view. +v2.1.212| `/fork` in an interactive session copies the conversation into a new background session while the original keeps running; the earlier forked-subagent behavior of `/fork` moved to `/subtask`. With agent view turned off, `/fork` keeps the forked-subagent behavior. +v2.1.212| Typing a bare `/resume` in agent view opens a picker of past sessions of the repository you opened agent view from. v2.1.211| Waking a stopped session by attaching or replying from the directory it runs in forwards your shell’s gateway `ANTHROPIC_BASE_URL` again, under the same conditions as a fresh dispatch, so a session authenticated through a gateway `ANTHROPIC_AUTH_TOKEN` resumes on the gateway instead of reporting `Not logged in`. Attaching to a stopped session that was backgrounded from another conversation before its first response finished is refused with `This session has no saved transcript` instead of silently starting a blank conversation under the same session id; opening the same row from agent view showed the refusal in the footer. Ending the process of a `←` or `/background` session from outside Claude Code marks it stopped instead of the supervisor restarting it, a stop already recorded on disk is honored unless a reply you sent is still waiting to be delivered, a session restarted after a crash is told it was restarted, and a restarted `←` or `/background` session doesn’t resume an interrupted response older than about an hour. A session-naming reply that answers or refuses the prompt instead of labeling it, such as for a prompt that’s mostly a link, is discarded and the row keeps a name taken from the prompt text. Deleting a session whose worktree git no longer recognizes succeeds, leaving the worktree directory on disk and naming its path, instead of every attempt being refused. A refused delete shows the reason on the session’s row, including the underlying git error when the worktree couldn’t be removed, instead of the row silently reappearing. v2.1.210| `claude attach` waits while the background service is starting or reconnecting instead of failing with a `job not found` or `still starting` error, reports a session that finished during the attach as exited, and applies a terminal resize made during a slow attach when the attach completes. The prompt footer’s `←` needs-input count appears on every provider, including third-party providers that previously showed the plain `← for agents` form. Backgrounding a session with `←` carries Claude’s task list to the background session instead of dropping it. The row you pressed `←` from keeps a bold, undimmed name after the selection moves. `claude agents --effort` accepts `ultracode` instead of silently dropping it. v2.1.208| Attaching to a session whose process has stopped shows the last screenful of its transcript while the process starts, instead of only a `Session is starting` note. A reply that can’t be delivered because the background service is unreachable or the send fails is saved and sent as the session’s next prompt when its process starts again; before this release, a reply lost while the background service was unreachable was discarded. A process whose own binary was replaced by an update can still start the supervisor, from the installed `claude` launcher or the newest version on disk, instead of failing until Claude Code was restarted. A supervisor running an older version never restarts an idle session started by a newer version onto its own older binary. Deleting a session removes its worktree even after the session moved the worktree onto a different branch, and keeps the worktree together with the session row when the worktree has commits that aren’t pushed anywhere or another session claims it, instead of destroying the commits or orphaning the worktree. `/install-github-app` and the `/mcp` settings list and its authentication actions are refused in a background session with a message naming the alternative; in v2.1.208 only, the `/model` picker was refused the same way and a typed `/model <name>` switched that session only instead of also saving your default model. @@ -1008,7 +1058,7 @@ v2.1.199| A background session whose process exits before it finishes starting on a low-memory host shows `possibly low memory — free some up and retry` in its row status instead of only the bare exit reason. Backgrounding a session with `←` or `/background` carries its `/color` over to the new row. v2.1.198| Agent view sends a notification through `preferredNotifChannel` when a background session needs input, finishes, or fails, and fires the `Notification` hook with the `agent_needs_input` or `agent_completed` type. `←` and `/exit` inside `claude attach <id>` return to agent view instead of exiting to the shell; `Ctrl+Z` returns to the shell. A background session that isolated its work in a worktree commits, pushes its own isolated branch, never `main` or `master`, and opens a draft pull request when it finishes instead of asking first. `/login` runs in agent view and opens the sign-in dialog. The `Background work is running` exit dialog offers `Move to background and exit`. The exit handoff also covers background subagents, which resume from their transcript on the next wake instead of being reported as failed. `claude --bg` combined with `-p` or `--print` is rejected with an error. The background session host requests macOS Local Network permission on first LAN access instead of failing with `connect: no route to host`. v2.1.196| A single `←` press backgrounds a foreground session; earlier versions required two presses, with a footer hint and a confirm. `--dangerously-skip-permissions` passed to `claude agents` shows the bypass disclaimer instead of being silently dropped. Interactive sessions you never named carry a default name such as `my-app-3f` in session listings and `claude agents --json`. Background shell commands and dynamic workflows survive the session’s process being stopped, restarted, or updated, including on Windows; set `CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF=1` to turn the handoff off. A transcript misread as empty on restart is renamed with an `.orphaned-` suffix instead of deleted. -v2.1.195| In-flight background work carries over when you background a session on Windows too; set `CLAUDE_DISABLE_ADOPT=1` to stop it instead. The `Completed` group fills the remaining vertical space and the header compacts on short terminals. An older Claude Code version no longer drops newer sessions’ `state.json` fields or hides those sessions from `claude agents`. Attaching to a stopped session switches immediately instead of showing a blank screen for up to five seconds. A supervisor that can’t accept connections exits and releases its lock on its own. +v2.1.195| In-flight background work carries over when you background a session on Windows too. The `Completed` group fills the remaining vertical space and the header compacts on short terminals. An older Claude Code version no longer drops newer sessions’ `state.json` fields or hides those sessions from `claude agents`. Attaching to a stopped session switches immediately instead of showing a blank screen for up to five seconds. A supervisor that can’t accept connections exits and releases its lock on its own. v2.1.191| `claude --bg` with an `--agent` name that doesn’t match any of your subagents fails the launch: the session exits immediately with an `--agent '<name>' not found` error instead of running with the default agent. v2.1.174| Background sessions no longer inherit gateway endpoint variables such as `ANTHROPIC_BASE_URL` from the supervisor’s launch shell; the supervisor supplies a fresh credential snapshot to pre-warmed workers, fixing spurious `Could not resolve authentication method` errors. v2.1.172| `/model` in the dispatch input sets a session-scoped dispatch model override.
modified Use the mods API View current →
--- a/api.md +++ b/api.md @@ -209,6 +209,30 @@ `$.ui.status(text)`| One line under the prompt that stays until you change it. It starts with `⚠` and the mod’s name, as in `⚠ my-mod: checks: 3 passing`. `$.ui.toast(text)`| A toast notification with the mod’s name that disappears after a few seconds. It’s a box at the top right in [fullscreen rendering](</docs/en/fullscreen>), and one line at the right under the prompt in the classic renderer. `$.ui.log(text)`| A dim line in the transcript that Claude doesn’t read. It starts with `●` and the mod’s name, as in `● my-mod: build finished`. +`$.ui.notify(text)`| A notification from their terminal, outside Claude Code, sent the way their [`preferredNotifChannel`](</docs/en/settings-reference#preferrednotifchannel>) setting says. The mod’s name is its title unless you pass a non-empty `{ title }`, which is shown as you give it. + +`$.ui.notify` is the only one of these that answers. It resolves to `{ isSent: true, channel }` when the user’s channel wrote the notification to their terminal. `channel` is the setting’s value that sent it, such as `kitty` or `terminal_bell`. The `terminal_bell` channel rings the bell and shows neither your text nor the title. Otherwise the call resolves to `{ isSent: false, reason }`: + +`reason`| Meaning +---|--- +`disabled`| The user set `preferredNotifChannel` to `notifications_disabled` +`no-channel`| The setting is `auto` and their terminal has no notification Claude Code can send +`no-surface`| The session has no terminal, as in a `-p` run, the Agent SDK, the desktop app, the VS Code extension, or a cloud session. Also the answer to a call made before the session starts, while your mod is loading, and to a call made while Claude Code is exiting +`refused`| Another mod’s hook on `ui.notify` answered in Claude Code’s place without sending + +The call rejects instead of resolving when `text` isn’t a string, when another mod’s hook on `ui.notify` returns `{ deny }`, or when writing to the terminal fails. Your mod can’t choose the channel, and Claude Code doesn’t limit how often a mod notifies. The user’s setting is the only switch. When the call reaches a running session, the user’s [`Notification` hooks](</docs/en/hooks#notification>) run with the type `plugin_notification`. They run even when the answer is `disabled`, and in a session with no terminal, where the answer is `no-surface`. No hook runs for a call made before the session starts or while Claude Code is exiting. The hook your mod called `$.ui.notify` from is left out of that run, so a `classic.Notification` hook that notifies isn’t called again for its own notification. A terminal doesn’t report whether it showed the notification, so `isSent: true` means it was sent, not that the user saw it. This example notifies when the main conversation’s turn ends without an interruption, and falls back to a toast when no notification with text went out. It doesn’t wait for the notification before passing the event on, because the user’s `Notification` hooks run first and can take a while: + + on('turn.complete', ($, e, next) => { + const isMainTurn = e.agentId === undefined && !e.isAborted + const fallBack = () => $.ui.toast('Turn finished') + if (isMainTurn) { + $.ui.notify('Turn finished').then(sent => { + const hasText = sent.isSent && sent.channel !== 'terminal_bell' + if (!hasText) fallBack() + }, fallBack) + } + return next(e) + }) In the [VS Code extension](</docs/en/plugins/mods/interface#draw-in-the-vs-code-extension>), status lines and toasts show above the prompt box instead, and log lines in the conversation. @@ -247,7 +271,7 @@ * **`the session was stopped and nobody has sent input since`** : the call was refused * **`was removed from the queue before it ran`** : the prompt or command left the queue without running and was dropped, for example when the user stopped the turn -In this example, call `submitPrompt` from your background job in place of `$.prompt.submit`. When the result or the error carries one of those strings, `submitPrompt` keeps the text in `pendingText` for the `turn.complete` hook to submit again: +In this example, call `submitPrompt` from your background job in place of `$.prompt.submit`. Put the `pendingText` variable and the `submitPrompt` function above [`register`](</docs/en/plugins/mods/reference#files>), and the `turn.complete` hook inside it, because [validation](</docs/en/plugins/mods/create#check-what-claude-code-reads-from-your-mod>) refuses `$` passed to a function declared inside `register`. When the result or the error carries one of those strings, `submitPrompt` keeps the text in `pendingText` for the `turn.complete` hook to submit again: // The text of the last refused or dropped prompt, or null let pendingText = null
modified Share session output as artifacts View current →
--- a/artifacts.md +++ b/artifacts.md @@ -92,8 +92,9 @@ * **`Enter`** : opens it in your browser when it’s already attached to the current session, and attaches it when it isn’t. Before v2.1.216, `Enter` opened it in your browser * **`o`** : opens it in your browser * **`c`** : copies its link - -Claude Code reads the list from your claude.ai account, so it works in a new session and after `/clear`, when the link has scrolled out of the terminal. + * **`d`** : outside a [cloud session](</docs/en/claude-code-on-the-web>), permanently deletes an artifact you own after you confirm. Its link stops working for everyone, including you + +Claude Code reads the list from your claude.ai account, so `/artifacts` works in a new session and after `/clear`, when an artifact’s link has scrolled out of the terminal. ## @@ -462,11 +463,11 @@ Method| Endpoint ---|--- -`GET`| `/v1/compliance/code/artifacts` -`GET`| `/v1/compliance/code/artifacts/{artifact_id}/versions/{version_id}` -`DELETE`| `/v1/compliance/code/artifacts/{artifact_id}` - -For the request and response schemas, see the [Compliance API reference](<https://docs.claude.com/en/api/compliance/code/artifacts>). +`GET`| `/v1/compliance/apps/code/artifacts` +`GET`| `/v1/compliance/apps/code/artifacts/{artifact_id}/versions/{version_id}` +`DELETE`| `/v1/compliance/apps/code/artifacts/{artifact_id}` + +For the request and response schemas, see the [Compliance API reference](<https://platform.claude.com/docs/en/api/compliance/apps/code/artifacts>). ##
modified Configure auto mode View current →
--- a/auto-mode-config.md +++ b/auto-mode-config.md @@ -141,7 +141,7 @@ Run `/auto-mode-setup` to have Claude Code draft `autoMode.environment` entries, and sometimes rule entries too, from your project and your recent sessions in it. If you accept the draft, Claude Code writes it to `~/.claude/settings.json`. -`/auto-mode-setup` requires a Pro, Max, or Team plan and Claude Code v2.1.228 or later. On native Windows it requires v2.1.233 or later. You can’t run it in a [cloud session](</docs/en/claude-code-on-the-web>). It also needs [feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>), so you can’t run it in a session where you’ve turned flag fetching off. +`/auto-mode-setup` is available on Pro, Max, Team, and Enterprise plans and with a Claude Console API key. On a Pro, Max, or Team plan, you need v2.1.228 or later, or v2.1.233 or later on native Windows. On an Enterprise plan or with a Claude Console API key, you need v2.1.283 or later. If the command is missing from your session, see `/auto-mode-setup` returns “Unknown command”. ### @@ -189,6 +189,20 @@ } `/auto-mode-setup` is a built-in command rather than a [bundled skill](</docs/en/skills#bundled-skills>), so this `skillOverrides` entry still applies to it, but [`disableBundledSkills`](</docs/en/settings-reference#disablebundledskills>) doesn’t turn it off. + +### + +​ + +`/auto-mode-setup` returns “Unknown command” + +If typing `/auto-mode-setup` at the Claude Code prompt prints `Unknown command: /auto-mode-setup`, check for these causes: + + * **First session after an install or upgrade** : start a new session. If the command is still missing there, see the [setups where later sessions also start without it](</docs/en/env-vars#first-session-after-an-install-or-upgrade>). + * **Outdated version** : run `claude --version` in your shell. If the version is below the minimum for your plan, [update Claude Code](</docs/en/setup#update-claude-code>). + * **Telemetry off, third-party provider, or Claude apps gateway** : before v2.1.304, the command isn’t available in [sessions where feature-flag fetching is off](</docs/en/env-vars#features-that-need-feature-flag-fetching>). If your session is one of them, [update Claude Code](</docs/en/setup#update-claude-code>) to v2.1.304 or later. + +In a [cloud session](</docs/en/claude-code-on-the-web>), the command prints `/auto-mode-setup isn't available in this environment.` instead. Run it in an interactive session in your terminal. ##
modified Claude Code changelog View current →
Show diff (147 lines)
--- a/changelog.md +++ b/changelog.md @@ -1,4 +1,69 @@ This page is generated from the [CHANGELOG.md on GitHub](<https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md>). Longer releases are grouped by type of change, with long lists of improvements and bug fixes collapsed. Run `claude --version` to check your installed version. + +​ + +2.1.306 + +October 21, 2026 + + * Fixed `claude -p` inside cloud sessions reporting “Not logged in” when started without the session’s environment variables + * Fixed an API error being replaced by “prompt is too long”, and an unneeded compaction, in sessions with many MCP tools + +​ + +2.1.305 + +October 20, 2026 + +**Added** + + * Added `sandbox.allowNestedUserNamespaces` so sandboxed commands on Linux can create user namespaces (Chromium, rootless podman); this lets them get around the sandbox’s file protections + * Added `CLAUDE_CODE_RETRY_WATCHDOG_USAGE_LIMIT_RECHECK_MS` so unattended retry mode (`CLAUDE_CODE_RETRY_WATCHDOG`) notices a usage limit that was lifted before its reset + * [VSCode] Added a “Running start-up hooks” spinner status, with a screen reader announcement, while SessionStart or Setup hooks run + * [Claude Tag] Added public Slack channels Claude hasn’t joined to the Claude Tag admin Add place search, so admins can set one up from there + +**Changed** + + * Changed `allowedMcpServers` to stop filtering `managed-mcp.json` stdio servers that use `${VAR}` only in `env`: one your allowlist left out now loads on upgrade; use `deniedMcpServers` to keep it off + * Changed plugins that Claude Desktop mounts by path to no longer keep their `allowed-tools` when your organization’s managed settings set `allowManagedPermissionRulesOnly` + * Changed the `/artifacts` delete confirmation to take 1 or Enter to keep, 2 to delete, and Esc to cancel; `y` and `n` no longer answer it + * Changed a mod’s docked pane to stay within 45% of the terminal’s width, including a width kept from a wider terminal + * [VSCode] Changed the message shown when a session does not start in time and no hook is running: it now leads with the output logs and lists causes instead of pointing to sign-in and network first + * [Code Review] Changed Code Review re-reviews so they no longer open with LGTM while earlier blocking findings are still open + +Show 6 improvements + + * Improved `/usage`: each warning is now a one-line fix that names its source, and `f` applies the fixes; the same fixes appear in VS Code and `/doctor` + * Improved MCP consent dialogs so an Enter meant for the prompt is less likely to be taken as Accept + * Improved a mod’s `Image` to draw its picture in iTerm2 3.5 and later with fullscreen rendering, where it showed only its `alt` text + * Remote Control: Improved the spawn-mode messages: pressing `w` now says the new mode is saved for the folder, and a later `claude remote-control` start that uses the saved mode says where it came from + * [Cloud sessions] Improved deleting a self-hosted environment so the dialog and error messages say what blocks the delete and what it will affect + * [Claude Tag] Improved Claude Tag admin pages in large organizations so plugin, skill and bundle edits work while the channel list is still loading + +Show 22 bug fixes + + * Fixed every request failing on Vertex, Bedrock and other providers when the endpoint or a gateway rejects tool search, and behind gateways with ToolSearch disallowed or left out of `--tools` (a 2.1.304 regression): Claude Code now retries without it + * Fixed `/effort` and `/autocompact` settings not applying when the model name differed from a `modelOverrides` value by letter case or a `[1m]` tag + * Fixed new worktrees in a bare repository sometimes starting from local HEAD instead of the default branch, and unchanged subagent worktrees sometimes not being cleaned up + * Fixed Bash commands on a full disk failing with a raw `ENOSPC` file path: the error now says the disk is full and that nothing ran + * Fixed an MCP server passed by a cloud session or by the SDK’s `setMcpServers` being replaced later in the session by a same-named server from your own settings + * Fixed Claude naming the wrong model for a subagent’s work after the subagent switched to a fallback model + * Fixed cloud sessions and teammates not telling Claude when a compaction had to leave the oldest messages out of its summary to fit + * Fixed more cases of scheduled Cowork cloud sessions waiting five minutes for each subagent whose WebFetch needed a URL approval that nobody was there to give + * Fixed Workflow resume re-running already-completed `pipeline()` and `parallel()` agents instead of serving them from the run’s journal + * Fixed Remote Control leaving empty “(session)” entries in `/resume` after switching conversations with `/resume` + * Fixed `/usage` rows being cut off in narrow terminals + * Fixed startup warnings printing as raw text above the logo: they now go to the debug log, and permission rules that restrict nothing show as warning rows under the banner + * Fixed screen reader mode: search boxes now say “Search:” instead of a symbol VoiceOver read as “telephone recorder”, and highlighted prompt text, such as Ctrl+R search matches and “ultrathink”, no longer has spaces inside words + * Self-hosted runner: Fixed a start script that shares only its stdout with the runner or orchestrator failing with `Resource temporarily unavailable` when `TERM` is set (a 2.1.300 regression) + * Self-hosted runner: Fixed repository access failing since 2.1.296 when a git credential helper or askpass program reads its settings through `GIT_CONFIG` + * Self-hosted runner: Fixed the orchestrator reporting a spawn-runner hook as timed out when a runner it started in the background kept its output open + * [VSCode] Fixed the spinner cutting off “Compacting…” when your `spinnerVerbs` setting replaces the built-in verbs with short ones + * [Cloud sessions] Fixed the Cloud environments admin page wrongly refusing to save an existing environment with an “installs packages” error + * [Claude Tag] Fixed Claude Tag access bundles so a repository that moved to another GitHub account can be added again + * [Claude Tag] Fixed a routine set up in a Slack DM thread no longer posting after another routine in that thread restarted the conversation; both now keep posting there + * [Claude Tag] Fixed routines set up in a Slack thread reporting success without posting after the conversation ended; those runs are now skipped and the creator is told + * [Code Review] Fixed Code Review sometimes not reviewing the newest commit when several pushes landed on a pull request during a review ​ @@ -585,7 +650,7 @@ **Changed** - * Updated `/cost`, the status line, `--max-budget-usd` and the SDK’s cost figures to price Sonnet 5.5 cache reads at 0.10permilliontokens(was0.10 per million tokens (was 0.10permilliontokens(was0.20) + * Updated `/cost`, the status line, `--max-budget-usd` and the SDK’s cost figures to price Sonnet 5.5 cache reads at $0.10 per million tokens (was $0.20) * Updated the bundled dataviz skill: lighter violet for the seventh series in light mode, softer primary text in dark mode, and compact y-axis labels like 1K * Changed the default limit on MCP tool descriptions sent up front and on MCP server instructions from 2,048 to 4,096 characters * Changed `←`: a turn or `!` command started while the session moves to the background is now stopped instead of finishing out of sight @@ -841,7 +906,7 @@ **Added** - * Added Claude Haiku 5.5 (`claude-haiku-5-5`), now the default Haiku model on the Anthropic API — 1M context, 0.10/0.10/0.10/0.50 per Mtok (0.50/0.50/0.50/2.50 for prompts over 100K) + * Added Claude Haiku 5.5 (`claude-haiku-5-5`), now the default Haiku model on the Anthropic API — 1M context, $0.10/$0.50 per Mtok ($0.50/$2.50 for prompts over 100K) * Added `agentType` to the `subagentStatusLine` payload, so scripts can tell custom subagent types apart * Added `isDeferred` to `$.tool.register` for mods: `false` lists the tool’s schema in the prompt from the start instead of behind tool search @@ -1778,9 +1843,9 @@ **Added** - * Added Claude Sonnet 5.5 (`claude-sonnet-5-5`), now the default Sonnet model on the Anthropic API — 1M context, 2/2/2/10 per Mtok with $0.20/Mtok cache reads + * Added Claude Sonnet 5.5 (`claude-sonnet-5-5`), now the default Sonnet model on the Anthropic API — 1M context, $2/$10 per Mtok with $0.20/Mtok cache reads * Added a “Yes, but ask again next time” answer to auto mode’s prompt before a read outside the working directories, so you can allow that one read and still be asked about later ones - * Added dollar amounts to the Claude apps gateway spend limit in `/usage` and the status line (for example “271.40/271.40 / 271.40/500.00 spent this month”) when the gateway runs this version or later; the status line’s `rate_limits.spend_limit` also gains `used_usd`, `limit_usd` and `period` + * Added dollar amounts to the Claude apps gateway spend limit in `/usage` and the status line (for example “$271.40 / $500.00 spent this month”) when the gateway runs this version or later; the status line’s `rate_limits.spend_limit` also gains `used_usd`, `limit_usd` and `period` * Added `effortSlider:decreaseEffort`, `increaseEffort` and `toggleUltracode` keybinding actions, so the `/effort` slider’s arrow and Tab keys can be rebound in `keybindings.json` * Added `/rate-limit-options` to `/help` and the command menu for claude.ai subscribers, so the usage-limit notices that mention it point to a command you can find * Added `/mcp reconnect all` in the interactive terminal to retry every MCP server that failed to connect or needs authentication at once @@ -2307,7 +2372,7 @@ **Added** - * Added Claude Opus 5.5 (`claude-opus-5-5`), now the default Opus model — 1M context, 4/4/4/20 per Mtok with $0.20/Mtok cache reads + * Added Claude Opus 5.5 (`claude-opus-5-5`), now the default Opus model — 1M context, $4/$20 per Mtok with $0.20/Mtok cache reads * Added mouse support to more lists in fullscreen mode: the wheel scrolls the `/skills` list, and a skill’s state options in `/plugin` can be clicked * Added `CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH` to change the 2,048-character cap on MCP tool descriptions and server instructions for every MCP server in the session * Added hook output sizes and the number of oversized outputs saved to a file to the `hook_execution_complete` OpenTelemetry event @@ -3630,7 +3695,7 @@ **Added** - * Added Claude Fable 5.1 (`claude-fable-5-1`), now the default Fable model — 1M context, 10/10/10/50 per Mtok with $0.25/Mtok cache reads + * Added Claude Fable 5.1 (`claude-fable-5-1`), now the default Fable model — 1M context, $10/$50 per Mtok with $0.25/Mtok cache reads * Added “Time format” (`timeFormat`) and `timeZone` settings: 12-hour, 24-hour, 24-hour UTC, or a strftime pattern for the turn-end clock and transcript-view timestamps * Added a Containment Escape rule to auto mode so cloud metadata-credential fetches, egress evasion, and cross-tenant reach are no longer auto-approved unless your environment marks them expected * Added `CLAUDE_CODE_SUBAGENT_MODEL_FORCE` to apply `CLAUDE_CODE_SUBAGENT_MODEL` (or the main model) to every subagent, ignoring per-spawn and agent-definition model overrides @@ -4079,7 +4144,7 @@ **Changed** * Changed the sandboxed Bash tool prompt to no longer list allowed network hosts, so Claude attempts requests (and you can approve new hosts) instead of assuming unlisted hosts are blocked - * Updated the `/model` picker and the bundled `claude-api` skill to show Sonnet 5’s 2/2/2/10 per Mtok pricing as its standard list price rather than a limited-time promo + * Updated the `/model` picker and the bundled `claude-api` skill to show Sonnet 5’s $2/$10 per Mtok pricing as its standard list price rather than a limited-time promo * Changed computer use on macOS so clicking the desktop, Dock, or a Finder window requires granting Finder via the access dialog, like any other app * Changed `/model`, `/fast`, and `/effort` to also run immediately instead of queueing until the turn ends on Bedrock, Vertex, and Foundry and when telemetry is disabled * Changed the cross-session messaging inbox socket to close connections that send no complete line within 30 seconds; scripts posting to it should connect once their data is ready @@ -4891,7 +4956,7 @@ **Added** - * Added Claude Opus 5 (`claude-opus-5`), now the default Opus model — 1M context, fast mode at 10/10/10/50 per Mtok + * Added Claude Opus 5 (`claude-opus-5`), now the default Opus model — 1M context, fast mode at $10/$50 per Mtok * Added `sandbox.network.strictAllowlist` setting to deny non-allowlisted hosts for sandboxed commands without prompting * Added `DirectoryAdded` hook that fires after `/add-dir` or the SDK `register_repo_root` control request registers a new working directory mid-session * Added `mcp_server_errors` to the headless stream-json init event, listing `--mcp-config` entries skipped by config validation; terminal runs print a startup warning @@ -5749,7 +5814,7 @@ June 30, 2026 - * Introducing Claude Sonnet 5: now the default model in Claude Code, with a native 1M-token context window and promotional pricing of 2/2/2/10 per Mtok through August 31. Update to version 2.1.197 for access. <https://www.anthropic.com/news/claude-sonnet-5> + * Introducing Claude Sonnet 5: now the default model in Claude Code, with a native 1M-token context window and promotional pricing of $2/$10 per Mtok through August 31. Update to version 2.1.197 for access. <https://www.anthropic.com/news/claude-sonnet-5> ​
modified Checkpointing View current →
--- a/checkpointing.md +++ b/checkpointing.md @@ -41,6 +41,14 @@ * **Never mind** : return to the message list without making changes The two code restore options appear only when the selected checkpoint has tracked file changes to revert. If no file edits were captured after that point, the menu offers only **Restore conversation** , the summarize options, and **Never mind**. After restoring the conversation or choosing Summarize from here, the original prompt from the selected message is restored into the input field so you can re-send or edit it. Choosing Summarize up to here leaves you at the end of the conversation with the input empty. With either summarize option, a **Summarized conversation** marker appears in the conversation where the compressed messages were. + +#### + +​ + +Rewound messages can return if you exit before your next prompt + +To remove the returned messages again, run `/rewind` in the session and select the same prompt, then **Restore conversation**. Before you exit, send Claude a prompt, because Claude Code saves the rewound conversation together with that prompt. Files you restored stay as the rewind left them. ####
modified Use Claude Code with Chrome View current →
--- a/chrome.md +++ b/chrome.md @@ -358,7 +358,8 @@ ”Browser extension is not connected”| The extension isn’t installed and running in Chrome, the extension is signed in to a different claude.ai account or organization than Claude Code, or your organization’s IP allowlist rejects the connection to `bridge.claudeusercontent.com`| Check that the extension is signed in to the same claude.ai account and organization as Claude Code, restart Chrome and Claude Code, then run `/chrome` to reconnect. If your organization uses IP allowlisting and the error persists, see [Organization IP allowlists and proxy egress](</docs/en/network-config#organization-ip-allowlists-and-proxy-egress>) Extension shows “Not detected” in `/chrome`| Chrome extension is not installed or is disabled| Install or enable the extension in `chrome://extensions` ”No tab available”| Claude tried to act before a tab was ready| Ask Claude to create a new tab and retry -”Receiving end does not exist”| Extension service worker went idle| Run `/chrome` and select “Reconnect extension” +”Receiving end does not exist”| Extension service worker went idle| Run `/chrome` and select “Reconnect extension" +"No browsers are connected”| Chrome isn’t open with the extension signed in to the same claude.ai account and organization as Claude Code, or Claude Code can’t reach `bridge.claudeusercontent.com`| Confirm Chrome is open and the extension is signed in to the same claude.ai account and organization as Claude Code. If so, check that your network lets Claude Code reach `bridge.claudeusercontent.com`, listed under [Network access requirements](</docs/en/network-config#network-access-requirements>) ##
modified Claude apps gateway configuration View current →
--- a/claude-apps-gateway-config.md +++ b/claude-apps-gateway-config.md @@ -783,7 +783,7 @@ A `match: {}` catch-all, conventionally listed last, is treated as a base layer. Every other policy inherits any key it doesn’t set from the catch-all, so per-role entries only need to list what differs from the org default. The merge rules depend on the key type: * **Allow-lists** : `availableModels` and `permissions.allow`. A specific policy’s list fully replaces the base’s. - * **Deny-lists and hook arrays** : `permissions.deny`, `permissions.ask`, `disabledMcpjsonServers`, `deniedMcpServers`, `blockedMarketplaces`, and every `hooks` event-type array. These take the union of base and policy, so an org-wide deny or audit hook can’t be accidentally dropped by a per-role override. + * **Deny-lists and hook arrays** : `permissions.deny`, `permissions.ask`, `disabledMcpjsonServers`, `deniedMcpServers`, `blockedMarketplaces`, `deniedModels`, and every `hooks` event-type array. These take the union of base and policy, so an org-wide deny or audit hook can’t be accidentally dropped by a per-role override. * **Record-typed keys** : `env`, `modelOverrides`, and `skillOverrides`. These shallow-merge, so a per-role `env` block overrides keys it sets and inherits the rest from the base. `availableModels` is also enforced server-side at `/v1/messages`, so a denied model returns `400` regardless of what the client sends. An empty list denies every model. The check also covers the model a session starts on before the developer picks one, so start sessions on a model the policy allows. The gateway validates the `model` value itself before it relays a request, so a malformed value never reaches an upstream. It rejects the request with a `400` in two cases: @@ -917,6 +917,7 @@ Key| Enforced by| Effect ---|---|--- `availableModels`| Gateway + CLI| Model allowlist. Also checked at `/v1/messages`, so a patched client can’t bypass it. +[`deniedModels`](</docs/en/settings-reference#deniedmodels>), [`availableModelsMatch`](</docs/en/settings-reference#availablemodelsmatch>)| Gateway + CLI| [Block specific models or versions](</docs/en/model-config#block-specific-models-or-versions>) that `availableModels` would otherwise permit. A blocked model is rejected with a `400` at `/v1/messages` and is left out of `/v1/models`. The gateway’s own check requires Claude Code v2.1.299 or later on the gateway server. The CLI’s check requires v2.1.283 or later on clients, and earlier clients ignore both keys. `permissions.allow` / `.deny`| CLI| Tool and command rules. See [Permissions](</docs/en/permissions>). `permissions.disableBypassPermissionsMode`| CLI| Set to `disable` to block [`bypassPermissions`](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>), the mode that skips permission prompts, and the `--dangerously-skip-permissions` flag `allowManagedPermissionRulesOnly`| CLI| When `true`, managed settings become the only settings source of permission rules. The [`allowManagedPermissionRulesOnly`](</docs/en/settings-reference#allowmanagedpermissionrulesonly>) entry lists every source Claude Code then ignores. @@ -975,7 +976,7 @@ The gateway derives much of the bootstrap response from the matched policy’s `cli` or `code` block and from top-level gateway config: - * The model list, from `availableModels`. Extended context in Claude Desktop covers each model’s 1M context option + * The model list, from `availableModels`. The list leaves out models that the policy blocks with `deniedModels` or `availableModelsMatch: exact`. This filter requires Claude Code v2.1.299 or later on the gateway server. Extended context in Claude Desktop covers each model’s 1M context option * Disabled tools, from bare tool-name `permissions.deny` entries. If you set `disabledBuiltinTools` in the policy’s `desktop` block, the gateway serves the union of your value and the derived list, so you can disable more tools this way but can’t re-enable one you disabled through `permissions.deny` * The egress allowlist, from `sandbox.network.allowedDomains`. If you set `coworkEgressAllowedHosts` in the policy’s `desktop` block, the gateway uses that value instead of the derived list. If the allowlist the gateway serves includes `*` and the gateway doesn’t also serve Claude Desktop’s [`allowedWorkspaceFolders`](<https://claude.com/docs/third-party/claude-desktop/code#applied-as-managed-policy>), Claude Desktop doesn’t turn on the [Bash sandbox](</docs/en/sandboxing>) in the Code tab * An OTLP endpoint that points at the gateway itself, and the signed-in user’s identity attributes. The gateway relays the exports it receives at that endpoint to your `forward_to` destinations. It includes the endpoint and the attributes when you set both `telemetry.forward_to` and `listen.public_url`. Claude Desktop exports every signal with one encoding: `http/protobuf`, or `http/json` when you set `OTEL_EXPORTER_OTLP_PROTOCOL` or one of its per-signal variants to `http/json` in the policy’s `env`. Before Claude Code v2.1.261 on the gateway server, the response set `http/json` regardless, so a collector that accepts only protobuf rejected Claude Desktop’s exports
modified Use Claude Code in the cloud View current →
--- a/claude-code-on-the-web.md +++ b/claude-code-on-the-web.md @@ -85,7 +85,7 @@ claude --cloud "Fix the authentication bug in src/auth/login.ts" -This creates a new cloud session on claude.ai. The cloud VM clones your current directory’s GitHub remote at your current branch, not your local checkout, so push first if you have local commits. See Send local repositories without GitHub for the cases where Claude Code uploads your local repository instead of cloning. `--cloud` works with a single repository at a time. The task runs in the cloud while you continue working locally. The older `--remote` spelling still works as a deprecated alias for `--cloud`. While the cloud container starts, the CLI shows a live checklist of setup steps, such as cloning the repository and running your [setup script](</docs/en/cloud-environments#setup-scripts>). It queues messages you type during provisioning and sends them once the session is ready. +This creates a new cloud session on claude.ai. The cloud VM clones your current directory’s GitHub remote at your current branch, not your local checkout, so push first if you have local commits. See Send local repositories without GitHub for the cases where Claude Code uploads your local repository instead of cloning. If the terminal prints `Branch <name> is not on GitHub`, see Branch is not on GitHub. `--cloud` works with a single repository at a time. The task runs in the cloud while you continue working locally. The older `--remote` spelling still works as a deprecated alias for `--cloud`. While the cloud container starts, the CLI shows a live checklist of setup steps, such as cloning the repository and running your [setup script](</docs/en/cloud-environments#setup-scripts>). It queues messages you type during provisioning and sends them once the session is ready. `--cloud` creates cloud sessions. `--remote-control` is unrelated: it lets you monitor and steer a local CLI session from claude.ai or the Claude app. See [Remote Control](</docs/en/remote-control>). @@ -258,7 +258,7 @@ * **`/model`, `/effort`, `/color`, and `/rename`**: pass the value as an argument, for example `/model sonnet`, instead of opening the terminal picker or slider. The argument forms follow each command’s [availability notes](</docs/en/commands#all-commands>). * **`/fast`** : toggles [fast mode](</docs/en/fast-mode#use-fast-mode-in-cloud-sessions>) for the session when fast mode is [available on your account](</docs/en/fast-mode#requirements>). Requires Claude Code v2.1.271 or later in the session’s environment. - * **`/config`** : in your browser at claude.ai/code, opens the Claude Code section of your settings instead of setting a value, and text after the command, including `key=value`, is ignored. To change a setting for a cloud session, set an [environment variable](</docs/en/cloud-environments#set-environment-variables>) on the environment, or in a session with one repository, commit the key to that repository’s `.claude/settings.json`. [Settings in cloud sessions](</docs/en/settings#settings-in-cloud-sessions>) lists what each session reads. + * **`/config`** : in your browser at claude.ai/code, opens the Claude Code section of your settings instead of setting a value, and text after the command, including `key=value`, is ignored. To change a setting for a cloud session, set an [environment variable](</docs/en/cloud-environments#set-environment-variables>) on the environment. In a session with one repository outside a [project](</docs/en/claude-projects>), commit the key to that repository’s `.claude/settings.json` instead. [Settings in cloud sessions](</docs/en/settings#settings-in-cloud-sessions>) lists what each session reads. For context management specifically: @@ -268,7 +268,7 @@ `/context`| Yes| Shows what’s currently in the context window `/clear`| No| Start a new session from the sidebar instead -Auto-compaction runs automatically when the context window approaches capacity. Cloud sessions set [`CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`](</docs/en/env-vars>) themselves, so compaction triggers partway through the [auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) rather than when the window fills. That value overrides one you add in your [environment variables](</docs/en/cloud-environments#set-environment-variables>), so adding the variable there doesn’t change when compaction triggers. To change the auto-compact window instead, set [`CLAUDE_CODE_AUTO_COMPACT_WINDOW`](</docs/en/env-vars>) in your environment variables, or run [`/autocompact`](</docs/en/commands#all-commands>) with a token count in a session where the variable isn’t set. [Subagents](</docs/en/sub-agents>) work the same way they do locally. Claude can spawn them with the Agent tool to offload research or parallel work into a separate context window, keeping the main conversation lighter. Subagents defined in your repo’s `.claude/agents/` are picked up automatically. [Agent teams](</docs/en/agent-teams>) are off by default but can be enabled by adding `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` to your [environment variables](</docs/en/cloud-environments#set-environment-variables>). +Auto-compaction runs automatically when the context window approaches capacity. Cloud sessions set [`CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`](</docs/en/env-vars>) themselves, so compaction triggers partway through the [auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) rather than when the window fills. That value overrides one you add in your [environment variables](</docs/en/cloud-environments#set-environment-variables>), so adding the variable there doesn’t change when compaction triggers. To change the auto-compact window instead, set [`CLAUDE_CODE_AUTO_COMPACT_WINDOW`](</docs/en/env-vars>) in your environment variables, or run [`/autocompact`](</docs/en/commands#all-commands>) with a token count in a session where the variable isn’t set. [Subagents](</docs/en/sub-agents>) work the same way they do locally. Claude can spawn them with the Agent tool to offload research or parallel work into a separate context window, keeping the main conversation lighter. Outside a [project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>)’s threads, subagents defined in your repo’s `.claude/agents/` load automatically. [Agent teams](</docs/en/agent-teams>) are off by default but can be enabled by adding `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` to your [environment variables](</docs/en/cloud-environments#set-environment-variables>). ### @@ -416,6 +416,14 @@ * `Error loading Claude Code sessions` in the session picker, when you run `claude --teleport` without a session ID Run [`claude auth login`](</docs/en/cli-reference#cli-commands>) in your shell to sign in with your claude.ai account, then retry the command. Inside a running session, `/login` does the same. If the error names your provider instead, see the error table: cloud sessions aren’t available through third-party providers. From v2.1.274 through v2.1.289, the sign-in message read `Claude Code cloud sessions require authentication with a Claude.ai account. API key authentication is not sufficient. Please run /login to authenticate, or check your authentication status with /status.` + +### + +​ + +Branch is not on GitHub + +When `claude --cloud` prints a line starting with `Branch <name> is not on GitHub`, the cloud session still starts, but not from your branch. The line names where the session starts instead: a pushed commit from your branch’s history, or the repository’s default branch. Commits that exist only on your machine and uncommitted changes aren’t in the session. You see this line when, for example, you never pushed the branch, or GitHub deleted it after its pull request merged. If the starting point the line names has what your task needs, use the session as it is. Otherwise, push the branch and start a new session so that it clones your branch. ###
modified Let Claude coordinate ongoing work with Projects View current →
--- a/claude-projects.md +++ b/claude-projects.md @@ -50,7 +50,7 @@ * **Threads** : the workers. Each is a separate session with its own context window that does one piece of work and reports back to the conversation when it finishes. A cloud thread works on its own branch and opens a pull request when the work calls for one. * **What every cloud thread starts with** : * The project’s repositories and files, plus its instructions and memory - * The `CLAUDE.md` and skills in each of the project’s repositories, and in a project with one repository, that repository’s permission rules and hooks too + * The `CLAUDE.md` in each of the project’s repositories, but not the repositories’ skills, `.claude/settings.json`, or `.mcp.json` * The connectors on your claude.ai account * A cloud environment that sets its network access, environment variables, network secrets, and installed tools * **The Overview pane** : where you see all the threads at once and which of them need you. Its other tabs are **Library** for the files you added and the files threads produced, **Pull requests** for the ones threads opened, and **Scheduled tasks** for scheduled work in the project. @@ -289,11 +289,7 @@ Unblock a thread waiting on approval -Threads run in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) when the thread’s model supports it, so most tool calls run without asking you. When a thread needs your approval, the prompt is inside that thread and the thread waits until you answer it there. Telling Claude in the project conversation to go ahead doesn’t reach it. Each approval covers that prompt, or the rest of that thread if you choose the broader option. To let every thread run certain commands without asking, or to block some, add [permission rules](</docs/en/permissions>) to the repository’s `.claude/settings.json`. Check that cloud threads in your project apply them: - - * **One repository** : cloud threads apply the rules. See What threads pick up from your repositories. - * **Several repositories, Anthropic-hosted environment** : no repository’s permission rules reach a cloud thread, so you rely on auto mode and on the approvals you give inside each thread. - * **Several repositories, self-hosted environment** : see [which repository’s settings apply](</docs/en/self-hosted-environments-configuration#repository-settings-in-sessions-with-several-repositories>). +Threads run in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) when the thread’s model supports it, so most tool calls run without asking you. When a thread needs your approval, the prompt is inside that thread and the thread waits until you answer it there. Telling Claude in the project conversation to go ahead doesn’t reach it. Each approval covers that prompt, or the rest of that thread if you choose the broader option. Cloud threads don’t read [permission rules](</docs/en/permissions>) from a repository’s `.claude/settings.json`, so you rely on auto mode and on the approvals you give inside each thread. ### @@ -377,10 +373,10 @@ Decide which repositories to add -The repositories you add to a project come with everything in them, their code, `CLAUDE.md`, and skills, in every cloud thread. Repositories you don’t add are still within reach: a cloud thread can add one to itself when its task needs it. Most projects use both: - - * **Add it to the project** , in the **New project** dialog, in **Project settings > Environment**, or by asking Claude in the conversation to add it to the project. Every cloud thread from then on clones it and starts with its `CLAUDE.md` and skills loaded, whether or not the task touches it. Going from one repository to several also changes what threads take from each repository’s `.claude/settings.json`; see What threads pick up from your repositories. - * **Leave it off and let threads add it when needed.** A cloud thread whose task needs a repository the project doesn’t have can add it to itself, and a note in the thread says it was added to this thread only. The clone happens partway through the task, so that repository’s `CLAUDE.md` and skills weren’t there when the thread started. The next thread starts without it. A repository added this way needs the same prerequisites as a project repository: the Claude GitHub App installed on it and push access from your GitHub account. +The repositories you add to a project come with their code and `CLAUDE.md` in every cloud thread, but not their skills, `.claude/settings.json`, or `.mcp.json`. Repositories you don’t add are still within reach: a cloud thread can add one to itself when its task needs it. Most projects use both: + + * **Add it to the project** , in the **New project** dialog, in **Project settings > Environment**, or by asking Claude in the conversation to add it to the project. Every cloud thread from then on clones it and starts with its `CLAUDE.md` loaded, whether or not the task touches it. + * **Leave it off and let threads add it when needed.** A cloud thread whose task needs a repository the project doesn’t have can add it to itself, and a note in the thread says it was added to this thread only. The clone happens partway through the task, so that repository’s `CLAUDE.md` wasn’t there when the thread started. The next thread starts without it. A repository added this way needs the same prerequisites as a project repository: the Claude GitHub App installed on it and push access from your GitHub account. A project doesn’t need a repository at all. Its cloud threads can still research, write documents, and write and run code in their own sandbox, and they deliver files to the **Library** tab. Any of its cloud threads can still add a repository to itself when a task calls for one. Once the project has repositories, Claude can only add repositories from a GitHub owner the project already uses, whether it adds one to the project or a thread adds one to itself. To bring in a repository from a different owner, add it to the project yourself in **Project settings > Environment**. For a project that spans many repositories, such as one feature with server, web, mobile, and desktop code, add the one or two repositories nearly every task touches and name the others in project instructions so Claude knows where the rest of the code lives. Cloud threads then start small and pull in the other repositories only for the tasks that need them. @@ -403,16 +399,18 @@ What threads pick up from your repositories -Each cloud thread clones every repository in the project and loads `CLAUDE.md` and skills from all of them. Permission rules, hooks, and `env` come only from the `.claude/settings.json` in the directory the thread starts in. - -In each repository| One repository| Several repositories ----|---|--- -`CLAUDE.md`| Loaded when the thread starts| Loaded from every repository when the thread starts -Skills, agents, and commands under `.claude/`| Loaded| Loaded from every repository -Plugins enabled in `.claude/settings.json`| Not loaded. Add the plugin in **Project settings > Plugins** instead| Not loaded. Add the plugin in **Project settings > Plugins** instead -Permission rules, hooks, and `env` defined in `.claude/settings.json`| Apply to the thread, except the `env` keys that [no cloud session honors](</docs/en/cloud-environments#what-carries-over-from-your-setup>)| Don’t apply in an Anthropic-hosted environment. For a self-hosted environment, see [which repository’s settings apply](</docs/en/self-hosted-environments-configuration#repository-settings-in-sessions-with-several-repositories>) - -In a project with several repositories, put standing rules in project instructions and give threads environment variables through the cloud environment. +Cloud threads load each repository’s `CLAUDE.md` instructions but not its skills, `.mcp.json` servers, or `.claude/settings.json`, whether the project has one repository or several. + +In each repository| In a cloud thread +---|--- +`CLAUDE.md`, `.claude/CLAUDE.md`, and `.claude/rules/` at the repository root| Loaded from every repository when the thread starts. `CLAUDE.md` files in subdirectories and [path-specific rules](</docs/en/memory#path-specific-rules>) aren’t loaded +Skills under `.claude/skills/`| Not loaded. Enable the skill for your claude.ai account instead, as Get skills, plugins, connectors, and tools into threads describes +Agents and commands under `.claude/`| Not loaded. To use them, run the thread on your own computer +MCP servers in `.mcp.json`| Not loaded. Use the connectors on your claude.ai account instead, as Get skills, plugins, connectors, and tools into threads describes +Plugins enabled in `.claude/settings.json`| Not loaded. Add the plugin in **Project settings > Plugins** instead +Permission rules in `.claude/settings.json`| Not applied. Approve tool calls inside the thread, as Unblock a thread waiting on approval describes, or run the thread on your own computer +Hooks in `.claude/settings.json`| Not run. To use your hooks, run the thread on your own computer +`env` in `.claude/settings.json`| Not applied. Set environment variables in the cloud environment ### @@ -430,9 +428,9 @@ Cloud threads don’t have the skills, MCP servers, plugins, and tools installed only on your machine. A thread that Claude runs on your machine through [Remote Control](</docs/en/remote-control>) uses what’s installed there. To make each of these available to cloud threads: - * Skills, subagents, and commands: commit them to a repository you added to the project, for example a skill at `.claude/skills/<skill-name>/SKILL.md`. Each cloud thread clones every repository in the project and loads `.claude/skills/`, `.claude/agents/`, and `.claude/commands/` from each of them, so a skill committed to one repository is available in every cloud thread. Cloud threads also load the [skills you enable for your claude.ai account](</docs/en/skills#skills-in-cowork-and-cloud-sessions>). + * Skills: enable them for your claude.ai account, and cloud threads load the [skills you enable there](</docs/en/skills#skills-in-cowork-and-cloud-sessions>), apart from [some threads in a self-hosted environment](</docs/en/self-hosted-environments-configuration#how-each-session%E2%80%99s-config-is-assembled>). Skills committed to a repository’s `.claude/skills/` don’t load in cloud threads. * Plugins: add them in **Project settings > Plugins**; they load into each new cloud thread. Plugins that a repository declares in its `.claude/settings.json` [don’t load in cloud threads](</docs/en/cloud-environments#what-carries-over-from-your-setup>). - * MCP servers: cloud threads get their MCP tools from the connectors on your claude.ai account, which are MCP servers you connect once at [claude.ai/customize/connectors](<https://claude.ai/customize/connectors>). Every cloud thread can use all of them with no per-project setup. The project conversation itself has no connectors, so send work that needs one as a task for a cloud thread. In a project with one repository, cloud threads also load MCP servers from that repository’s [`.mcp.json`](</docs/en/cloud-environments#what-carries-over-from-your-setup>). [How connectors reach Claude Code](</docs/en/mcp#how-connectors-reach-claude-code>) lists the rules for cloud sessions and the settings that turn connectors off. + * MCP servers: cloud threads get their MCP tools from the connectors on your claude.ai account, which are MCP servers you connect once at [claude.ai/customize/connectors](<https://claude.ai/customize/connectors>). Every cloud thread can use all of them with no per-project setup. The project conversation itself has no connectors, so send work that needs one as a task for a cloud thread. [How connectors reach Claude Code](</docs/en/mcp#how-connectors-reach-claude-code>) lists the rules for cloud sessions and the settings that turn connectors off. * Command-line tools and packages: install them in the environment’s [setup script](</docs/en/cloud-environments#setup-scripts>). To see which connectors a running cloud thread has at claude.ai/code, open the thread and select **Connectors** from the **+** menu beside its message box. Turning a connector off there removes it from that thread and saves that as your account default, so new threads and claude.ai chats start without it until you turn it back on. A cloud thread picks up a connector you add or reconnect after the next message you send it.
modified Configure cloud environments View current →
--- a/cloud-environments.md +++ b/cloud-environments.md @@ -310,6 +310,8 @@ ​ What carries over from your setup + +Of the repository configuration in this table, a cloud thread in a [project](</docs/en/claude-projects>) loads only the repository root’s `CLAUDE.md`, `.claude/CLAUDE.md`, and `.claude/rules/` files that aren’t [path-specific](</docs/en/memory#path-specific-rules>). See [What threads pick up from your repositories](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>). Cloud sessions start from a fresh clone of your repository. Anything you commit to the repo is available. Anything you’ve installed or configured only on your own machine isn’t available in the session. Your organization’s policy arrives separately through [server-managed settings](</docs/en/server-managed-settings>). @@ -509,7 +511,7 @@ If you have SessionStart hooks in your user-level `~/.claude/settings.json`, don’t expect them in the cloud. User-level settings stay on your machine. Which other hooks run depends on where the session runs: - * **Anthropic-hosted environment** : Claude Code runs hooks from the repository and from your organization’s [server-managed settings](</docs/en/server-managed-settings>). [Claude Tag](<https://claude.com/docs/claude-tag/overview>) sessions don’t receive server-managed settings, so hooks from server-managed settings don’t run there. + * **Anthropic-hosted environment** : Claude Code runs hooks from your organization’s [server-managed settings](</docs/en/server-managed-settings>) and, outside a [project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>) thread, from the repository. [Claude Tag](<https://claude.com/docs/claude-tag/overview>) sessions don’t receive server-managed settings, so hooks from server-managed settings don’t run there. * **[Self-hosted environment](</docs/en/self-hosted-environments-configuration#permissions-and-tool-approval>)** : Claude Code also runs the hooks the operator seeded from the runner host’s `~/.claude/`, and the hooks in the runner image’s managed settings file when that file is one of the [managed sources Claude Code applies](</docs/en/managed-settings#how-claude-code-combines-managed-sources>). ### @@ -518,7 +520,7 @@ Install dependencies with a SessionStart hook -To install dependencies only in cloud sessions, pair a SessionStart hook with a script that checks where it’s running. First, add a SessionStart hook to your repo’s `.claude/settings.json`. This configuration tells Claude Code to run `scripts/install_pkgs.sh` from your repository whenever a session starts or resumes: +To install dependencies only in cloud sessions outside a [project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>), pair a SessionStart hook with a script that checks where it’s running. First, add a SessionStart hook to your repo’s `.claude/settings.json`. This configuration tells Claude Code to run `scripts/install_pkgs.sh` from your repository whenever a session starts or resumes: { "hooks": { @@ -572,6 +574,7 @@ SessionStart hooks behave the same in the cloud as locally, with these caveats: * **One repository per session** : in an Anthropic-hosted environment, a session with several repositories doesn’t load hooks from any repository’s `.claude/settings.json`, so a SessionStart hook you define there doesn’t run. Install dependencies for those sessions with a setup script instead. For a self-hosted environment, see [which repository’s settings apply](</docs/en/self-hosted-environments-configuration#repository-settings-in-sessions-with-several-repositories>). + * **Not in a project’s cloud threads** : a cloud thread in a [project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>) doesn’t run hooks from a repository’s `.claude/settings.json`, whatever the number of repositories. In an Anthropic-hosted environment, install dependencies for threads with a setup script. In a self-hosted environment, use a hook in the [runner host’s settings](</docs/en/self-hosted-environments-configuration#repository-settings-in-sessions-with-several-repositories>) instead. * **No cloud-only scoping** : hooks run in both local and cloud sessions. To skip local execution, exit early unless the `CLAUDE_CODE_REMOTE` environment variable is `true`, the way the dependency install script does. * **Requires network access** : install commands need to reach package registries. If your environment uses **None** network access, these hooks fail. The default allowlist under **Trusted** covers npm, PyPI, RubyGems, and crates.io. * **Proxy compatibility** : in Anthropic-hosted environments, all outbound traffic passes through a security proxy, and some package managers don’t work correctly with it; Bun is a known example. In a [self-hosted environment](</docs/en/self-hosted-environments-deploy#default-deny-egress>), outbound traffic goes through your own network boundary instead.
modified Customize Code Review View current →
--- a/code-review-customize.md +++ b/code-review-customize.md @@ -88,6 +88,42 @@ ​ +Include other files in REVIEW.md + +You can split review instructions across several files and pull them into your root `REVIEW.md`. Use this when `REVIEW.md` grows long or when you already keep review rules in another file. To include a file, add a line to the root `REVIEW.md` with only `@` and the file name on it. Code Review puts the file’s contents in place of that line, so they apply as part of `REVIEW.md`. In this example, the root file gives one instruction of its own and then includes two rule files: + + # Review instructions + + Report at most five Nits per review. + + @review-security.md + @review-api.md + +Save the included files at the repository root, beside `REVIEW.md`: + + your-repo/ + ├── REVIEW.md + ├── review-security.md + └── review-api.md + +Code Review includes the files when it reads `REVIEW.md` from a protected branch, so check which branch a review reads for your repository: + + * **Protected branch** : Code Review puts the included file in place of its `@` line + * **Unprotected default branch** : the `@` line stays in `REVIEW.md` as plain text. If the pull request changes the file the line names, the line is left out. + +When a review doesn’t apply an included file, check each of these: + + * **Location** : move the file to the repository root. A path into a subdirectory such as `@docs/review-rules.md` isn’t included. + * **Name** : match the file name exactly, including case, and use a name without spaces. A line whose name matches no file beside `REVIEW.md` stays in `REVIEW.md` as plain text, and the check run doesn’t report it as a skipped include. + * **One level** : list every file in the root `REVIEW.md`. An `@` line in an included file or in a subdirectory `REVIEW.md` stays as plain text, and a Markdown link to another file isn’t an include. + * **Limits** : include at most eight different files, and keep `REVIEW.md` and the files it includes under 150,000 bytes combined. A file that would reach the byte limit is skipped whole, not cut short. The check run reports how many include lines it skipped for either limit. + * **Links** : keep Markdown links at 64 or fewer across `REVIEW.md` and the files it includes. Links to `http`, `https`, or `mailto` addresses and to `#` anchors don’t count. Past that limit, the review skips your whole root `REVIEW.md`, not only the included files. The check run then [says the instructions weren’t applied](</docs/en/code-review-troubleshooting#the-check-run-mentions-review-md>). + * **Merged copy** : merge the included file into the branch `REVIEW.md` is read from. The review reads both from the same commit, never from the pull request’s own changes. + +### + +​ + Which branch REVIEW.md is read from Code Review reads `REVIEW.md` from the pull request’s base branch or from the default branch, never from the pull request’s own changes. To change review behavior, merge the `REVIEW.md` change first. Keep `REVIEW.md` on your default branch and protect that branch. When a review reads the copy on a protected default branch, the first row of the table below, it honors these instructions from the root file: @@ -119,8 +155,8 @@ Branch protection| Copy read| Files read ---|---|--- -The default branch is protected, and the pull request targets it or targets a branch no ruleset protects| Default branch| Root and subdirectory files -The pull request targets another branch that a ruleset protects| That base branch| Root and subdirectory files +The default branch is protected, and the pull request targets it or targets a branch no ruleset protects| Default branch| Root file, the files it includes, and subdirectory files +The pull request targets another branch that a ruleset protects| That base branch| Root file, the files it includes, and subdirectory files The default branch isn’t protected, and the base branch has no protection rule of either kind| Default branch| Root file Code Review can’t confirm the protection settings. This includes an unprotected default branch with a base branch that has only a classic rule| None| None
modified Read and request reviews on a pull request View current →
--- a/code-review-pull-requests.md +++ b/code-review-pull-requests.md @@ -53,7 +53,11 @@ Read the result from a script -To gate a merge or post a summary from your own CI, parse the last line of the Details text with `gh` and jq. That line is a machine-readable comment. +To gate a merge or post a summary from your own CI, parse the last line of the Details text with `gh` and jq. That line is an HTML comment that holds the severity counts as JSON: + + <!-- bughunter-severity: {"nit":1,"normal":2,"pre_existing":0} --> + +The lines above it can include file names from the pull request. If you parse the text your own way, take the counts from the last line only, as the command in these steps does. 1 @@ -67,10 +71,12 @@ Read the severity counts -Read the counts from that check run, replacing `CHECK_RUN_ID` with the ID: +Read the counts from the check run’s `output.text` field, which holds the Details text. Replace `CHECK_RUN_ID` with the ID: - gh api repos/OWNER/REPO/check-runs/CHECK_RUN_ID \ - --jq '.output.text | split("bughunter-severity: ")[1] | split(" -->")[0] | fromjson' + gh api repos/OWNER/REPO/check-runs/CHECK_RUN_ID --jq ' + (.output.text | split("\n") | last + | scan("^<!-- bughunter-severity: (.*) -->$")[0] | fromjson)? + // error("no severity line")' This prints a JSON object with a count per severity and its keys in alphabetical order, for example `{"nit": 1, "normal": 2, "pre_existing": 0}`. The counts include findings from earlier reviews of the pull request whose threads are still open. @@ -80,8 +86,8 @@ Have your script handle these cases: - * **`normal` is above zero**: fail the job if you want to gate the merge. The `normal` key holds the count of Important findings, so Claude found at least one bug worth fixing before merge. - * **The line is missing** : treat it as no verdict rather than as zero findings. A check run for a review that failed, timed out, was canceled, or was superseded by a newer one has no such line, and some completed reviews have none either. + * **`normal` is above zero**: fail the job if you want to gate the merge. The `normal` key holds the count of Important findings, so Claude found at least one bug worth fixing before merge. To print only that count, add `| .normal` before the closing single quote. + * **The line is missing** : the command prints an error that contains `no severity line` instead of counts, and exits with a non-zero status. Treat that as no verdict rather than as zero findings. A check run for a review that failed, timed out, was canceled, or was superseded by a newer one has no such line, and some completed reviews have none either. ## @@ -107,18 +113,20 @@ Command| What it does| When to use it ---|---|--- -`@claude review`| Starts a single review without subscribing the PR to future pushes| You want one review now, such as on a pull request in a repository set to Manual, or another review right away in the other modes -`@claude review always`| Starts a review and subscribes the PR to push-triggered reviews going forward| You want every subsequent push to start a fresh review, such as on a high-priority PR in a repository set to Manual +`@claude review`| Starts a single review without subscribing the PR to future pushes| You want one review now, such as on a pull request in a repository set to **Manual** , or another review right away in the other modes +`@claude review always`| Starts a review and subscribes the PR to push-triggered reviews going forward| You want every subsequent push to start a fresh review, such as on a high-priority PR in a repository set to **Manual** `@claude review once`| Same as `@claude review`: starts a single review without subscribing| The same cases as `@claude review` +`@claude review stop`| Ends the PR’s subscription to push-triggered reviews, without starting a review or canceling one that’s already queued or running. Claude replies with a comment instead of a check run.| You subscribed a PR with `@claude review always` in a repository set to **Manual** or **Once after PR creation** , and no longer want each push to start a review +`@claude review off` or `@claude review pause`| Same as `@claude review stop`| The same cases as `@claude review stop` -For any of these commands to start a review, all of these conditions have to hold: +In a repository set to **After every push** , you can’t stop reviews with a comment, because pushes there start reviews with or without a subscription. To stop pushes from starting reviews on one pull request there, convert it to a draft. When you mark it ready for review again, a review starts. For any comment command to take effect, all of these conditions have to hold: * Post it as a new top-level pull request comment, not an inline comment on a diff line and not the body of a review. Editing an earlier comment doesn’t count. - * Put the command at the start of the comment, with `always` on the same line as the rest of the command. Capitalization doesn’t matter. + * Put the whole command on one line at the start of the comment. Other text can follow it. If `always` or `stop` is misspelled or on a later line, Claude reads the comment as a plain `@claude review` and starts a single review. Capitalization doesn’t matter. * You need write, maintain, or admin permission on the repository. Claude checks this with GitHub for each person who comments, and comments from bots don’t start reviews. * The pull request must be open. -When the command is accepted, a **Claude Code Review** check run appears on the pull request with the title **Code review queued…**. The title changes to **Code review in progress…** when the review starts. Claude may also react to your comment with 👀, but that reaction can appear when no review starts, so look for the check run instead. If a review is already running on the pull request’s latest commit, a new request doesn’t start a second one. +When a command that starts a review is accepted, a **Claude Code Review** check run appears on the pull request with the title **Code review queued…**. The title changes to **Code review in progress…** when the review starts. Claude may also react to your comment with 👀, but that reaction can appear when no review starts, so look for the check run instead. If a review is already running on the pull request’s latest commit, a new request doesn’t start a second one. Before a July 2026 update, `@claude review` subscribed the PR to push-triggered reviews. If you relied on that behavior, comment `@claude review always` instead.
modified Troubleshoot Code Review View current →
--- a/code-review-troubleshooting.md +++ b/code-review-troubleshooting.md @@ -82,10 +82,14 @@ The check run mentions REVIEW.md -Two of the messages a check run can carry about `REVIEW.md` concern branch protection: +These are three of the messages a check run can carry about `REVIEW.md`: * **“This review applied the repository’s review instructions (REVIEW.md) from its default branch, which is not protected against direct pushes.”** : the review read the root file only. See [Which branch REVIEW.md is read from](</docs/en/code-review-customize#which-branch-review-md-is-read-from>) for what protecting the branch changes. * **“were not applied to this review: branch protection could not be confirmed”** : the review read no `REVIEW.md`. + * **“they link to a file this pull request modifies, or carry more links than the review checks”** : the review skipped the root `REVIEW.md`, or the number of subdirectory `REVIEW.md` files the message gives. Check the skipped file for each cause. For the root `REVIEW.md`, check the [files it includes](</docs/en/code-review-customize#include-other-files-in-review-md>) too: + * **Too many links** : it carries more than 64 Markdown links. Cut links to [64 or fewer](</docs/en/code-review-customize#include-other-files-in-review-md>). + * **A link the review can’t parse** : it has a malformed Markdown link. Fix or remove the link. + * **A link to a changed file** : it links to a file or folder this pull request changes, and the review couldn’t leave out only the lines with that link. Write the rule in `REVIEW.md` itself. ##
modified Commands View current →
--- a/commands.md +++ b/commands.md @@ -33,7 +33,7 @@ `/artifact-capabilities`| **[Skill](</docs/en/skills#bundled-skills>).** Load the reference for the runtime capabilities a published [artifact](</docs/en/artifacts>) can use, such as [calling your connectors](</docs/en/artifacts#pull-live-data-with-mcp-connectors>) or [offering a file download](</docs/en/artifacts#offer-a-file-download>), including which ones your account has. Claude normally loads it on its own before building a page that uses one. Available where [artifacts](</docs/en/artifacts#availability>) are `/artifact-diagramming`| **[Skill](</docs/en/skills#bundled-skills>).** Load diagramming guidance for Claude to follow in [artifacts](</docs/en/artifacts>): when a diagram helps, what to draw, and how to write inline SVG that stays legible in light and dark themes. Requires Claude Code v2.1.221 or later `/artifacts`| List the [artifacts](</docs/en/artifacts#find-an-artifact-again>) you own or that are shared with you, then attach one to the session, open it in your browser, or copy its link. Available where [artifacts](</docs/en/artifacts#availability>) are. Requires Claude Code v2.1.208 or later; attaching with `Enter` requires v2.1.216 -`/auto-mode-setup`| [Draft `autoMode.environment` entries](</docs/en/auto-mode-config#generate-environment-entries>) from your project and recent sessions, then review the draft and save it to your user settings. Requires a Pro, Max, or Team plan and Claude Code v2.1.228 or later. On native Windows, requires v2.1.233 or later +`/auto-mode-setup`| [Draft `autoMode.environment` entries](</docs/en/auto-mode-config#generate-environment-entries>) from your project and recent sessions, then review the draft and save it to your user settings. On a Pro, Max, or Team plan, requires Claude Code v2.1.228 or later, or v2.1.233 or later on native Windows. On an Enterprise plan or with a Claude Console API key, requires v2.1.283 or later. If the command is missing, see [`/auto-mode-setup` returns “Unknown command”](</docs/en/auto-mode-config#auto-mode-setup-returns-unknown-command>) `/autocompact [auto|<tokens>]`| Set the auto-compact window: how full the context window gets before Claude Code compacts automatically. Pass a size such as `500k`, or `auto` to return to the window tuned for your model. Claude Code saves the value to user settings and applies it to the current session. See [Set the auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) for accepted values and what overrides it. Without an argument, opens a dialog that shows the current window. Requires Claude Code v2.1.221 or later `/autofix-pr [prompt]`| Spawn a [cloud session](</docs/en/claude-code-on-the-web#auto-fix-pull-requests>) that watches the current branch’s PR and pushes fixes when CI fails or reviewers leave comments. Detects the open PR from your checked-out branch with `gh pr view`; to watch a different PR, check out its branch first. By default the cloud session is told to fix every CI failure and review comment; pass a prompt to give it different instructions, for example `/autofix-pr only fix lint and type errors`. Requires the `gh` CLI and access to [cloud sessions](</docs/en/claude-code-on-the-web>) `/background [prompt]`| Detach the current session to run as a [background agent](</docs/en/agent-view>) and free this terminal. Pass a prompt to send one more instruction before detaching. Monitor the session with `claude agents`. To copy the conversation into a new background session while this one keeps running, use `/fork`. Alias: `/bg` @@ -43,7 +43,7 @@ `/bug [report]`| Report a bug or share your conversation. You choose how much session history to include and confirm on a consent screen before anything is sent. When you’re signed in to Anthropic on a first-party connection, the report goes to Anthropic; on a third-party provider, or without Anthropic credentials, Claude Code writes the report to a [local archive under `~/.claude/feedback-bundles/`](</docs/en/data-usage#telemetry-services>) that you forward yourself. In the [VS Code extension](</docs/en/vs-code#use-the-prompt-box>), `/bug` opens the extension’s own feedback dialog instead; requires Claude Code v2.1.229 or later. When you run it while Claude is responding, Claude Code opens the dialog immediately. Before v2.1.232, Claude Code queued the command until the turn finished. Alias: `/share`. Before v2.1.212, `/bug` and `/share` were aliases of `/feedback` `/cd <path>`| Move this session to a new working directory, keeping the conversation. Type a partial path to see matching directory suggestions; press `Tab` to accept one. For what Claude Code applies from the new directory as soon as you move, and how `/cd` differs from `/add-dir`, see [Move the session to another directory](</docs/en/permissions#move-the-session-to-another-directory>) `/chrome`| Configure [Claude in Chrome](</docs/en/chrome>) settings -`/claude-api [migrate|upgrade|managed-agents-onboard|prompt-audit|cost-optimize|build-eval|hillclimb|preserved-thinking-migration]`| **[Skill](</docs/en/skills#bundled-skills>).** Load [Claude API](<https://platform.claude.com/docs/en/api/overview>) and [Managed Agents](<https://platform.claude.com/docs/en/managed-agents/overview>) reference material for your project’s language. Also activates automatically when your code imports `anthropic` or `@anthropic-ai/sdk`. For what each subcommand does and the version it requires, see [Work on Claude API projects](</docs/en/skills#work-on-claude-api-projects>) +`/claude-api [migrate|upgrade|managed-agents-onboard|managed-agents-secure|prompt-audit|cost-optimize|build-eval|hillclimb|preserved-thinking-migration]`| **[Skill](</docs/en/skills#bundled-skills>).** Load [Claude API](<https://platform.claude.com/docs/en/api/overview>) and [Managed Agents](<https://platform.claude.com/docs/en/managed-agents/overview>) reference material for your project’s language. Also activates automatically when your code imports `anthropic` or `@anthropic-ai/sdk`. For what each subcommand does and the version it requires, see [Work on Claude API projects](</docs/en/skills#work-on-claude-api-projects>) `/claude-in-chrome [task]`| **[Skill](</docs/en/skills#bundled-skills>).** Have Claude carry out a task in your browser, such as testing a page, filling a form, or reading console logs, through [Claude in Chrome](</docs/en/chrome>). Available when Chrome integration is enabled for the session, for example with `claude --chrome`, or when Claude Code can offer to [install the extension](</docs/en/chrome#install-the-extension-when-claude-asks>) `/clear [name]`| Start a new conversation with empty context. Pass a name to label the previous conversation in the `/resume` picker. To free up context while continuing the same conversation, use `/compact` instead. Resume the previous conversation with `/resume`, or, in the same Claude Code process, restore it from [the rewind menu’s previous-session entry](</docs/en/checkpointing#rewind-past-a-cleared-conversation>). Aliases: `/reset`, `/new` `/code-review [low|medium|high|xhigh|max|ultra] [--fix] [--comment] [--max-findings n|all|default] [pr#|branch|path]`| **[Skill](</docs/en/skills#bundled-skills>).** Review the current diff, or a PR number, branch, or path you pass, for correctness bugs. Depending on your model and effort level, the review also covers cleanup opportunities. Pass `--fix` to have Claude apply the findings, `--comment` to post them on the GitHub PR or GitLab merge request, or `ultra` to run a deep [cloud review](</docs/en/ultrareview>). Posting to a GitLab merge request requires Claude Code v2.1.257 or later. With `ultra` on a `github.com` PR target, pass `--post` to preselect [posting the finished findings to the PR](</docs/en/ultrareview#post-findings-to-the-pull-request>) in the launch dialog; `--post` requires Claude Code v2.1.227 or later. See [Review locally with `/code-review`](</docs/en/code-review-local>) for the effort levels, targeting, and how it relates to `/simplify`. Alias: `/review` @@ -57,8 +57,9 @@ `/debug [description]`| **[Skill](</docs/en/skills#bundled-skills>).** Enable debug logging for the current session and troubleshoot issues by reading the session debug log. Debug logging is off by default unless you started with `claude --debug`, so running `/debug` mid-session starts capturing logs from that point forward. Optionally describe the issue to focus the analysis `/deep-research <question>`| **[Workflow](</docs/en/workflows#bundled-workflows>).** Fan out web searches on a question, fetch and cross-check sources, and synthesize a cited report `/design [brief]`| **[Skill](</docs/en/skills#bundled-skills>).** Draft UI mockups, screen flows, landing pages, or posters as artboards on one canvas, published as a Claude Design [artifact](</docs/en/artifacts#draft-a-design-canvas>), for example `/design a settings screen for a mobile banking app`. You edit the artboards in a desktop browser, and your edits save automatically. You can export each artboard as PNG or PDF. Requires Claude Code v2.1.265 or later, a session where [artifacts are available](</docs/en/artifacts#availability>), and an account where the [Design template is available](</docs/en/artifacts#start-from-a-slides-design-or-docs-template>); if your organization has turned that template off, `/design` doesn’t draft designs. Available on the Anthropic API. On Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and Claude Platform on AWS, artifacts aren’t available, so the command is unavailable there -`/design-login`| Authorize design-system access for `/design-sync` with your claude.ai account -`/design-sync [hint]`| **[Skill](</docs/en/skills#bundled-skills>).** Convert your repo’s React design system and upload it to [Claude Design](<https://claude.ai/design>), so designs it produces use your real components. Optionally name the design system, for example `/design-sync Acme DS`. A first-time sync verifies every component and can take a few hours on a large repo. Available on the Anthropic API. It needs claude.ai, which the CLI doesn’t contact on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or Claude Platform on AWS, or through a [Claude apps gateway](</docs/en/claude-apps-gateway#availability-and-limitations>), so the command is unavailable there +`/design consent`, `/design revoke`| Grant Claude access to [Claude Design](<https://claude.ai/design>), or withdraw it. When a reply from Claude asks you to run `/design consent`, type it at the Claude Code prompt yourself +`/design-login`| Authorize design-system access for `/design-sync` with your claude.ai account. Sign in with `/design-login` whenever `/design-sync` or `/design consent` tells you to. This sign-in is for the standalone Claude Design site at claude.ai/design, which closes by December 14, 2026; see [Migrate from standalone Claude Design to Claude](<https://support.claude.com/en/articles/17440474-migrate-from-standalone-claude-design-to-claude>) +`/design-sync [hint]`| **[Skill](</docs/en/skills#bundled-skills>).** Convert your repo’s React design system and upload it to [Claude Design](<https://claude.ai/design>), so designs it produces use your real components. Optionally name the design system, for example `/design-sync Acme DS`. A first-time sync verifies every component and can take a few hours on a large repo. Available on the Anthropic API. It needs claude.ai, which the CLI doesn’t contact on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or Claude Platform on AWS, or through a [Claude apps gateway](</docs/en/claude-apps-gateway#availability-and-limitations>). The command is unavailable there. This command uploads to the standalone claude.ai/design site, which closes by December 14, 2026; see [Migrate from standalone Claude Design to Claude](<https://support.claude.com/en/articles/17440474-migrate-from-standalone-claude-design-to-claude>) `/desktop`| Continue the current session in the Claude Code Desktop app. Requires macOS or x64 Windows and a Claude subscription. Alias: `/app` `/diff`| Review the changes in your working tree, including the edits Claude has made so far. See [Review changes with /diff](</docs/en/interactive-mode#review-changes-with-%2Fdiff>) `/doctor [prompt-audit [path]]`| **[Skill](</docs/en/skills#bundled-skills>).** Run a setup checkup that diagnoses installation, settings, extension, and `CLAUDE.md` problems and proposes fixes that Claude applies after you confirm. For what the checkup covers, or to audit your instructions with `prompt-audit` instead, see [Check your setup with `/doctor`](</docs/en/skills#check-your-setup-with-/doctor>). The `prompt-audit` subcommand requires Claude Code v2.1.283 or later. Alias: `/checkup`
modified Add components to a plugin View current →
--- a/components.md +++ b/components.md @@ -295,7 +295,7 @@ Executables -Files in `bin/` at the plugin root are on the `PATH` of the Bash tool’s shell while the plugin is enabled, so Claude can run them as bare commands. Add an executable script: +Files in `bin/` at the plugin root are on the `PATH` of the Bash tool’s shell while the plugin is enabled, so Claude can run them as bare commands. A command that Claude runs with the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) outside the [sandbox](</docs/en/sandboxing>) finds them on its `PATH` too, and a sandboxed PowerShell command doesn’t. Add an executable script: bin/hello-plugin
modified Manage costs effectively View current →
--- a/costs.md +++ b/costs.md @@ -49,15 +49,36 @@ Plan usage breakdown -On a Pro, Max, Team, or Enterprise plan, `/usage` also shows a breakdown of what counts against your plan limits: +On a Pro, Max, Team, or Enterprise plan, `/usage` also shows a breakdown of what counts against your plan limits, with recommendations: * **Attribution** : recent usage attributed to skills, subagents, plugins, and individual MCP servers, each shown as a percentage of the total. An MCP server’s share counts only the requests that consumed one of its tool results. Before v2.1.222, after one call to an MCP server, Claude Code attributed every subsequent request to that server, overstating its share. - * **Behavior flags** : behaviors such as long context or cache misses, flagged when one accounts for 10% or more of recent usage. + * **Recommendations** : changes that lower your usage, one per row. Each row starts with the share of recent usage it addresses, at least 10%, as in `25% Trim ~/code/api/CLAUDE.md · 49k tokens per request`. To have Claude Code apply the ones it can, see Apply recommendations with the fix shortcut. * **Loops** : a row for each of the heaviest [`/loop` or other session-scoped scheduled tasks](</docs/en/scheduled-tasks>) that ran recently, ordered by total tokens, with a count of the rest. Requires Claude Code v2.1.242 or later. * **What each row reports** : how often the task fires, how many times it ran, its total and per-run tokens, and when it last ran * **Stopped and re-created loops** : Claude Code keys a row by the task’s prompt, so a loop you stop and re-create stays one row -Press `d` or `w` to switch between the last 24 hours and the last 7 days. The figures are approximate and computed from local session history on this machine, so usage from other devices or claude.ai is not included. In the [VS Code extension](</docs/en/vs-code#check-account-and-usage>), the attribution shares and behavior flags appear in the Account & usage dialog with a Day and Week toggle, without the Loops rows. +Press `d` or `w` to switch between the last 24 hours and the last 7 days. The figures are approximate and computed from local session history on this machine, so usage from other devices or claude.ai is not included. In the [VS Code extension](</docs/en/vs-code#check-account-and-usage>), the attribution shares and recommendations appear in the Account & usage dialog with a Day and Week toggle, without the Loops rows. + +#### + +​ + +Apply recommendations with the fix shortcut + +When the `/usage` footer shows a hint such as `f to fix 2 of 3`, press `f` to have Claude Code act on the recommendations it can. The `f` shortcut requires Claude Code v2.1.305 or later. + + 1. After any turn in progress ends, Claude Code runs each [`/effort`](</docs/en/model-config#adjust-effort-level>) command shown in a row without `run`. + 2. Claude then gets one prompt with a step for each of the other rows it can act on. The prompt asks Claude to show you each change before making it. + +To see what pressing `f` does with each of your rows, find the row’s shape in the first column: + +Row shape| Example row| When you press `f` +---|---|--- +Ends in an `/effort` command with no `run` before it| `40% Switch from max to high effort · /effort high`| Claude Code runs the command +Ends in `run` and a command| `30% Compact before you step away · run /compact`| Nothing happens for this row. Run the command yourself at the Claude Code prompt +Ends in anything else| `25% Trim ~/code/api/CLAUDE.md · 49k tokens per request`| Claude gets a step in the prompt for some of these rows, and nothing happens for the rest. If Claude shows you no change for a row, follow that recommendation yourself + +In `f to fix 2 of 3`, the first number counts the rows Claude Code acts on when you press `f`, and the second counts the rows shown. A hint with no `of` in it, such as `f to fix both`, means Claude Code acts on every row shown. While [Remote Control](</docs/en/remote-control>) is connected, the footer shows no `f` hint. If pressing `f` closes `/usage` with `Nothing was sent. Turn off Remote Control to use fixes.`, Remote Control connected while `/usage` was open. To use `f` again, [disconnect Remote Control](</docs/en/remote-control#check-connection-status>), then run `/usage` at the Claude Code prompt and press `f` again. #### @@ -78,7 +99,7 @@ When the usage request fails -When the request for your plan limits fails, most often because the usage endpoint is rate limited, `/usage` shows the last usage bars it loaded on this machine within the past 60 minutes, along with a `Showing last-known usage` note stating how long ago that data was fetched. Press `r` to retry; a successful retry replaces the last-known bars with fresh data. Without a snapshot from the past 60 minutes, `/usage` reports that the usage endpoint is rate limited and offers the same retry shortcut. Before v2.1.208, a rate-limited request in a session that hadn’t loaded usage yet always showed the error with no bars. +When the request for your plan limits fails, most often because the usage endpoint is rate limited, `/usage` shows the last usage bars it loaded on this machine within the past 60 minutes, along with a `Showing last-known usage` note stating how long ago that data was fetched. Press `r` to retry; a successful retry replaces the last-known bars with fresh data. Without a snapshot from the past 60 minutes, `/usage` reports that the usage endpoint is rate limited and offers the same retry shortcut. Before v2.1.208, a rate-limited request in a session that hadn’t loaded usage yet always showed the error with no bars. A message such as `rate limited until 3:14am` in `/usage` means Claude Code can’t fetch your plan limits again until then, not that your work with Claude is limited. If you press `r` earlier, expect the same message. Press `r` after that time for fresh data. ### @@ -427,7 +448,7 @@ A session that has been open for hours can use far more of your plan limits than your activity suggests, usually for one of these reasons: * **Long context** : Claude Code sends your full conversation with every request, and each time Claude uses tools it sends another request carrying that batch of tool results. With [prompt caching](</docs/en/prompt-caching>), Claude Code re-reads that history at the [cached token rate](<https://platform.claude.com/docs/en/about-claude/pricing>), so a one-line question in a session that has been open all day still draws usage for the whole conversation. See Manage context proactively for ways to keep your context small - * **Cache misses** : your first message after a break longer than the [cache lifetime](</docs/en/prompt-caching#cache-lifetime>) misses the cache and reprocesses your full context. The lifetime is an hour on a subscription and drops to five minutes once you’re drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>); on an API key or cloud provider, it’s five minutes by default. To keep the one-hour lifetime while drawing on usage credits, [choose the TTL yourself](</docs/en/prompt-caching#choose-the-ttl-yourself>) + * **Cache misses** : your first message after a break longer than the [cache lifetime](</docs/en/prompt-caching#cache-lifetime>) misses the cache and reprocesses your full context. See [which lifetime your requests get](</docs/en/prompt-caching#which-ttl-each-request-gets>) and [the controls for setting it](</docs/en/prompt-caching#choose-the-ttl-yourself>) * **Scheduled tasks** : a [session-scoped scheduled task](</docs/en/scheduled-tasks>) fires on its interval even while the session is idle, sending your full context each time * **Cross-session messages** : Claude Code delivers a [message from another of your sessions](</docs/en/cross-session-messaging>) as a new turn when this session sits idle, sending your full context each time. To hold inbound messages instead of delivering them, set [`crossSessionInbound`](</docs/en/settings-reference#crosssessioninbound>) to `hold` * **Goal check-ins** : while background work keeps an active [goal](</docs/en/goal>) waiting, Claude Code [asks Claude to check on that work](</docs/en/goal#background-work-defers-evaluation>) even when the session sits idle, starting a new turn that sends your full context. Claude Code starts at most three idle check-ins per goal between your prompts. Before v2.1.246, idle check-ins were uncapped. To turn check-ins off, set [`CLAUDE_CODE_GOAL_CHECKIN_MINUTES`](</docs/en/env-vars>) to `0`. Idle check-ins require Claude Code v2.1.236 or later @@ -435,7 +456,7 @@ * **Agent teammates** : each active teammate keeps consuming tokens until it exits * **Compaction** : `/compact` reads the conversation it summarizes, so [compacting a large context](</docs/en/prompt-caching#compacting-the-conversation>) is itself a large request. When you want a fresh start instead of continuity, `/clear` costs nothing -On a Pro, Max, Team, or Enterprise plan, the `/usage` breakdown flags behaviors that account for 10% or more of your recent usage, such as long context or cache misses, each with a tip to reduce it. +On a Pro, Max, Team, or Enterprise plan, the `/usage` breakdown recommends a change for behaviors behind 10% or more of your recent usage, such as long context or cache misses. ##
modified Message your other Claude Code sessions View current →
--- a/cross-session-messaging.md +++ b/cross-session-messaging.md @@ -59,7 +59,7 @@ * **Held** : Claude Code sets the message aside undelivered. A held message reaches Claude only when you approve it or a later mode or settings change allows it. * **Refused** : Claude Code drops the message without delivering it. -Once delivered, the message counts toward [usage](</docs/en/costs>) like a prompt you type, and the receiving Claude can reply to the sender the same way, except in the one-way cross-machine case. Permission boundaries stay per-session. Claude is instructed never to ask another session for an action that was denied or blocked in its own session, or that its own permission settings would block, and to route that work back to you instead. On the receiving side, the receiving session’s own permission prompts and rules still apply to anything the message asks for. +Once delivered, the message counts toward [usage](</docs/en/costs>) like a prompt you type. The receiving Claude can reply to the sender with `SendMessage`, except in the cases under Replies from other machines and cloud sessions and Turn off cross-session messaging. Permission boundaries stay per-session. Claude is instructed never to ask another session for an action that was denied or blocked in its own session, or that its own permission settings would block, and to route that work back to you instead. On the receiving side, the receiving session’s own permission prompts and rules still apply to anything the message asks for. ### @@ -146,7 +146,15 @@ * **`offline`** : that session’s Remote Control connection has dropped. The message goes through, but arrives only after that session’s machine reconnects. * **`can't receive cross-session messages (off in that session)`** : messaging isn’t available in that session, or its [`crossSessionInbound`](</docs/en/settings-reference#crosssessioninbound>) value is `refuse`. Claude Code refuses a message to that session before the message leaves this machine. The result under Claude’s `SendMessage` call begins `Not sent` and names the reason. Once the cause is fixed in that session, a later listing no longer shows this condition, and Claude can message that session. -A session inside a container and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). A session inside WSL 2 and a native Windows session on the same computer can’t reach each other either. If this session isn’t connected to Remote Control when Claude sends to a session beyond this machine, the message still goes through, but without a reply address, so the receiving Claude can’t answer it. To require your approval before any message goes beyond this machine, set `isolatePeerMachines`. +A session inside a container and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). A session inside WSL 2 and a native Windows session on the same computer can’t reach each other either. To require your approval before any message goes beyond this machine, set `isolatePeerMachines`. + +#### + +​ + +Replies from other machines and cloud sessions + +A [cloud session](</docs/en/claude-code-on-the-web>), including one on a [self-hosted runner](</docs/en/self-hosted-environments>), can’t use `SendMessage` to answer a message from another machine, even when the message carries a reply address. The message still arrives. Read the cloud session’s response in its transcript at [claude.ai/code](<https://claude.ai/code>). If this session isn’t connected to Remote Control when Claude sends to a session beyond this machine, the message still goes through, but without a reply address. The receiving Claude can’t answer it. ## @@ -218,7 +226,7 @@ * **Before the deadline** : if a mode or settings change allows the message, Claude Code delivers it. * **Past the deadline** : Claude Code drops the message and reports it as expired to a sender it can reach. -Set `dialogExpiry` to `"never"` to keep default-held messages until the session ends. A message held by an explicit `hold` setting doesn’t expire; Claude Code delivers it only when an `accept` later applies. To let a `-p` worker take messages unattended, start it with `crossSessionInbound` set to `accept` in its `--settings` value. An `accept` in your user settings also works but applies to every session you run. +Set `dialogExpiry` to `"never"` to keep default-held messages until the session ends. A message held by an explicit `hold` setting doesn’t expire; Claude Code delivers it when an `accept` later applies. To let a `-p` worker take messages unattended, start it with `crossSessionInbound` set to `accept` in its `--settings` value. An `accept` in your user settings also works but applies to every session you run. ###
modified Desktop application View current →
--- a/desktop.md +++ b/desktop.md @@ -1782,6 +1782,7 @@ *.livepreview.claude.ai claude.com platform.claude.com + sso.claude.com *.livepreview.claude.app *.claudeusercontent.com *.claudemcpcontent.com
modified Claude Desktop on Linux (beta) View current →
--- a/desktop-linux.md +++ b/desktop-linux.md @@ -65,7 +65,7 @@ Launch and sign in -Launch **Claude** from your application launcher, or run `claude-desktop` from a terminal, and sign in with your Anthropic account.The Linux app signs in the same way as on macOS and Windows: with a claude.ai subscription, or through your organization’s SSO. Desktop doesn’t accept a Claude Console API key directly; use the [CLI](</docs/en/quickstart>) for API-key authentication. For enterprise deployments that route Desktop to Google Cloud’s Agent Platform or an LLM gateway, see [Claude Desktop on 3P](<https://claude.com/docs/third-party/claude-desktop/overview>) and [network configuration](</docs/en/network-config>). +Launch **Claude** from your application launcher, or run `claude-desktop` from a terminal, and sign in with your Anthropic account.The Linux app signs in the same way as on macOS and Windows: with a claude.ai subscription, or through your organization’s SSO. For API-key authentication, use the [CLI](</docs/en/quickstart>). To use Desktop with Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or an LLM gateway instead, see [Claude Desktop on 3P](<https://claude.com/docs/third-party/claude-desktop/overview>). For proxy servers and custom certificate authorities in those deployments, see [network configuration](</docs/en/network-config>). ###
modified Environment variables View current →
Show diff (134 lines)
--- a/env-vars.md +++ b/env-vars.md @@ -106,7 +106,6 @@ * `DISABLE_TELEMETRY` * `DISABLE_ERROR_REPORTING` * `CLAUDE_CODE_TMUX_TRUECOLOR` - * `FALLBACK_FOR_ALL_PRIMARY_MODELS` * `IS_DEMO` One other variable has its own rule: `FORCE_HYPERLINK` reads a number, so only `0` turns it off. Each variable’s row also states its own rule. @@ -118,7 +117,7 @@ `ANTHROPIC_AWS_API_KEY`| Workspace API key for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), generated in the AWS Console. Sent as `x-api-key` and takes precedence over AWS SigV4 `ANTHROPIC_AWS_BASE_URL`| Override the [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) endpoint URL. Use for custom regions or when routing through an [LLM gateway](</docs/en/llm-gateway>). Defaults to `https://aws-external-anthropic.{region}.api.aws`. Claude Code resolves the region with the [same precedence as on Amazon Bedrock](</docs/en/amazon-bedrock#3-configure-claude-code>) `ANTHROPIC_AWS_WORKSPACE_ID`| Required for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>). Sent on every request as the `anthropic-workspace-id` header -`ANTHROPIC_BASE_URL`| Override the API endpoint to route requests through a proxy or gateway. When set to a non-first-party host, [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled by default. Set `ENABLE_TOOL_SEARCH=true` if your proxy forwards `tool_reference` blocks. As of v2.1.196, [Remote Control](</docs/en/remote-control#requirements>) is disabled when this points at a host other than `api.anthropic.com`, matching its behavior on Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry +`ANTHROPIC_BASE_URL`| Override the API endpoint to route requests through a proxy or gateway. For what happens when that gateway rejects MCP tool search, see [Tool search through an LLM gateway](</docs/en/mcp#tool-search-through-a-gateway>). As of v2.1.196, [Remote Control](</docs/en/remote-control#requirements>) is disabled when this points at a host other than `api.anthropic.com`, matching its behavior on Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry `ANTHROPIC_BEDROCK_BASE_URL`| Override the Amazon Bedrock endpoint URL. Use for custom Amazon Bedrock endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Amazon Bedrock](</docs/en/amazon-bedrock>) `ANTHROPIC_BEDROCK_MANTLE_BASE_URL`| Override the Amazon Bedrock Mantle endpoint URL. See [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) `ANTHROPIC_BEDROCK_REGION_PREFIX`| Cross-region inference profile prefix (`us`, `eu`, `apac`, `jp`, `au`, or `global`) Claude Code tries first instead of the one derived from the AWS region. Ignored in AWS GovCloud regions. Requires Claude Code v2.1.224 or later. See [Amazon Bedrock](</docs/en/amazon-bedrock#cross-region-inference-profile-prefixes>) @@ -160,7 +159,7 @@ `ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID that Google Cloud’s Agent Platform requests are addressed to. See [Configure GCP credentials](</docs/en/google-vertex-ai#3-configure-gcp-credentials>) `ANTHROPIC_WORKSPACE_ID`| Workspace ID for [workload identity federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). Set this when your federation rule is scoped to more than one workspace so the token exchange knows which workspace to target `API_FORCE_IDLE_TIMEOUT`| Override the 5-minute body idle timeout that aborts a streaming model response when no bytes arrive. Set to `0` to turn the timeout off, for example when a slow [gateway](</docs/en/llm-gateway>) or local model pauses longer than 5 minutes between chunks, or `1` to keep it on for every provider. When unset, the timeout is active on providers other than the direct Anthropic API, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and Amazon Bedrock with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1` set. The [stream watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) run independently of it and abort a long silent pause even when you set `0` here -`API_TIMEOUT_MS`| Time in milliseconds that each API request attempt has to receive its response headers (default: 600000, or 10 minutes; maximum: 2147483647). It doesn’t limit how long a streaming response runs after that. When you set a positive value, each attempt at a [non-streaming request](</docs/en/errors#streaming-response-ended-before-any-complete-data-was-received>) has to finish within it. Increase this when requests time out on slow networks or when routing through a proxy +`API_TIMEOUT_MS`| Time in milliseconds that each API request attempt has to receive its response headers. It doesn’t limit how long a streaming response runs after that. The default is 600000, or 10 minutes, and the maximum is 2147483647. When you set a positive value, each attempt at a [non-streaming request](</docs/en/errors#streaming-response-ended-before-any-complete-data-was-received>) has to finish within it. Increase this when requests time out on slow networks or when routing through a proxy. Set to `0` to remove this limit, which requires Claude Code v2.1.305 or later. With `0`, a non-streaming attempt still times out after 300 seconds in a local session `AWS_BEARER_TOKEN_BEDROCK`| Amazon Bedrock API key for authentication (see [Amazon Bedrock API keys](<https://aws.amazon.com/blogs/machine-learning/accelerate-ai-development-with-amazon-bedrock-api-keys/>)) `BASH_DEFAULT_TIMEOUT_MS`| Default timeout for a foreground Bash or PowerShell tool command, in milliseconds (default: 120000, or 2 minutes). A value above the [default time limit for background commands](</docs/en/tools-reference#time-limit-for-background-commands>) replaces that default in unattended sessions. The background time limit requires Claude Code v2.1.285 or later `BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters of bash output that Claude Code reads back into a command’s result (default: 30000; maximum: 150000). If you set the [`bashOutputMaxChars`](</docs/en/settings-reference#bashoutputmaxchars>) setting, Claude Code ignores this variable. See [Output limits](</docs/en/tools-reference#output-limits>) @@ -168,8 +167,6 @@ `BETA_TRACING_ENDPOINT`| OTLP/HTTP endpoint for [detailed beta tracing](</docs/en/monitoring-usage#traces-beta>): with `ENABLE_BETA_TRACING_DETAILED=1`, logs and traces go there instead of to the configured exporters. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CCR_FORCE_BUNDLE`| Set to `1` to force [`claude --cloud`](</docs/en/claude-code-on-the-web#send-local-repositories-without-github>) to bundle and upload your local repository instead of cloning from its remote `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, stdio [MCP server](</docs/en/mcp>) subprocesses). IDE extensions also set this in their integrated terminals. Use to detect when a script is running inside a subprocess spawned by Claude Code. To check whether the current process was spawned directly by a tool call or hook, rather than inside a stdio MCP server that Claude Code started, use `CLAUDE_CODE_CHILD_SESSION` instead -`CLAUDE_AFK_COUNTDOWN_MS`| How many milliseconds before auto-continue the on-screen countdown appears on an unanswered [`AskUserQuestion`](</docs/en/tools-reference>) dialog. Default `20000` (20 seconds), capped at the auto-continue timeout. Has no effect unless auto-continue is on; see the [`askUserQuestionTimeout`](</docs/en/settings-reference#askuserquestiontimeout>) setting and `CLAUDE_AFK_TIMEOUT_MS`. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.198 or later -`CLAUDE_AFK_TIMEOUT_MS`| How many milliseconds of idle time before an unanswered [`AskUserQuestion`](</docs/en/tools-reference>) dialog auto-continues without you. Auto-continue is off by default; opt in with the [`askUserQuestionTimeout`](</docs/en/settings-reference#askuserquestiontimeout>) setting. This variable is an override for demos and automated tests: when set, it takes precedence over that setting and turns auto-continue on even when the setting is unset or `never`. Setting `0` doesn’t turn the timeout off; it closes the dialog immediately. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Before v2.1.200, auto-continue was on by default with a `60000` (60 seconds) timeout. Requires Claude Code v2.1.198 or later `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. This also removes `general-purpose`, the subagent Claude Code runs when an Agent tool call omits `subagent_type`. Such a call then fails with [`subagent_type is required`](</docs/en/errors#subagent-type-is-required>) `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 subagents. Also covers [workflow agents](</docs/en/workflows#when-an-agent-stalls-and-restarts>) on Claude Code v2.1.286 or later. Default `600000` (10 minutes); if you raise `CLAUDE_STREAM_IDLE_TIMEOUT_MS` while the stream watchdog is on, the default rises with it, as [Handle slow or stalled API responses](</docs/en/agent-sdk/typescript#handle-slow-or-stalled-api-responses>) describes @@ -211,7 +208,6 @@ `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise `CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to turn off [1M context window](</docs/en/model-config#extended-context>) support. Claude Code removes `[1m]` model variants from the model picker and holds models that run with the 1M window by default to a 200K window. See [Turn off 1M context](</docs/en/model-config#turn-off-1m-context>). Useful for enterprise environments with compliance requirements. For its role in correcting the window for an unrecognized `[1m]` model ID, see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. Has no effect on [Fable models](</docs/en/model-config#extended-thinking>), Sonnet 5 and later, Haiku 5.5, or Opus 4.7 and later, which always use adaptive reasoning -`CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION`| Set to `1` to stop Claude Code from merging [managed settings](</docs/en/managed-settings#precedence-within-the-managed-tier>) `env` blocks per key across admin sources, so only the highest-priority source’s whole `env` block applies, as before v2.1.223. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_ADVISOR_TOOL`| Set to `1` to disable the [advisor tool](</docs/en/advisor>). The `/advisor` command becomes unavailable, any configured `advisorModel` is ignored, and the `--advisor` flag is accepted but has no effect, so existing scripts that pass it continue to work without errors `CLAUDE_CODE_DISABLE_AGENT_VIEW`| Set to `1` to turn off [background agents and agent view](</docs/en/agent-view>): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Equivalent to the [`disableAgentView`](</docs/en/settings-reference#disableagentview>) setting `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN`| Set to `1` to disable [fullscreen rendering](</docs/en/fullscreen>) and use the classic main-screen renderer. The conversation stays in your terminal’s native scrollback so `Cmd+f` and tmux copy mode work as usual. Takes precedence over `CLAUDE_CODE_NO_FLICKER` and the [`tui`](</docs/en/settings-reference#tui>) setting. You can also switch with `/tui default`. Does not apply to background sessions opened from [agent view](</docs/en/agent-view>), which always use fullscreen rendering @@ -222,7 +218,7 @@ `CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`| Set to `1` to disable all background task functionality, including the `run_in_background` parameter on Bash and subagent tools, auto-backgrounding, and the Ctrl+B shortcut `CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_DEFAULT`| Set to `1` to stop Claude Code from treating an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response with a missing or empty `Content-Type` header as Amazon Bedrock’s binary event stream. By default, Claude Code assumes a gateway dropped the header from an otherwise unmodified response, so it decodes the body and streaming keeps working. Set this only for a gateway that also re-emits the stream as server-sent events; Claude Code then reads the header-less body as server-sent events instead. Requires Claude Code v2.1.239 or later `CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD`| Set to `1` to skip the check that an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response carries the `application/vnd.amazon.eventstream` content-type. Without this variable, when a response carries a different content-type, Claude Code fails the request with an error naming that type, which means a [gateway or proxy is transforming the response](</docs/en/amazon-bedrock#streaming-errors-behind-a-gateway-or-proxy>). Configure the gateway to forward the `Content-Type` header and body unmodified rather than setting this variable. Requires Claude Code v2.1.208 or later -`CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) running background shell commands, dynamic workflows, and, as of v2.1.198, background subagents when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing them to the session’s next process. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight background work over, and `CLAUDE_DISABLE_ADOPT` turns off both. Requires Claude Code v2.1.196 or later +`CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) in-flight work when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing it to the session’s next process. That work is the session’s running background shell commands and dynamic workflows, plus background subagents as of v2.1.198. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight background work over. Requires Claude Code v2.1.196 or later `CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`| Set to `1` to stop Claude Code from terminating [background shell commands](</docs/en/interactive-mode#background-bash-commands>) under memory pressure. By default, on macOS and Linux, Claude Code terminates background shells when the operating system reports critical memory pressure and the session has been idle for 30 minutes with no turn or subagent running. Windows has no memory-pressure signal, so this variable has no effect there. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings-reference#disablebundledskills>) setting `CLAUDE_CODE_DISABLE_CFC_PROMPT`| Set to `1` to keep the [Claude in Chrome](</docs/en/chrome>) browser tools available while omitting the Chrome section of the system prompt and the `/claude-in-chrome` [bundled skill](</docs/en/skills#bundled-skills>). For hosts that embed Claude Code and supply their own browser guidance. Requires Claude Code v2.1.257 or later @@ -281,7 +277,7 @@ `CLAUDE_CODE_FORCE_SESSION_PERSISTENCE`| Set to `1` to force transcript persistence, prompt history, and `claude agents` registration even when this `claude` was launched from inside another Claude Code session. Use when an inherited `CLAUDE_CODE_CHILD_SESSION` value, for example from a `screen` session or a background launcher first started by Claude Code’s Bash tool, causes a genuine top-level session to be misclassified as nested. As of v2.1.178, Claude Code detects the tmux case automatically and ignores the inherited marker, so tmux no longer needs this variable. Also honored on v2.1.169 and earlier; has no effect on v2.1.170 and v2.1.171, where the nested-session detection it overrides was removed `CLAUDE_CODE_FORCE_STRIKETHROUGH`| Set to `1` to force strikethrough rendering for `~~text~~` in Claude’s responses when your terminal supports it but is not auto-detected, such as over SSH without `TERM_PROGRAM` forwarded. Without this, undetected terminals show the literal `~~` markers instead of rendering the text as strikethrough. Requires Claude Code v2.1.186 or later `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux. Unlike `CLAUDE_CODE_NO_FLICKER`, which switches to [fullscreen rendering](</docs/en/fullscreen>), this doesn’t change the renderer -`CLAUDE_CODE_FORCE_TERMINAL_IMAGES`| Set to `1` to draw [mod `Image` elements](</docs/en/plugins/mods/reference#elements>) as pictures when your terminal draws kitty graphics protocol images with Unicode placeholders but is not auto-detected. See [which terminals Claude Code detects](</docs/en/plugins/mods/gallery#image-and-client>) and why it doesn’t help inside tmux or screen +`CLAUDE_CODE_FORCE_TERMINAL_IMAGES`| Set to `1` to draw [mod `Image` elements](</docs/en/plugins/mods/reference#elements>) as pictures when your terminal draws kitty graphics protocol images with Unicode placeholders and you still see an `Image`’s dimmed `alt` text. See [which terminals draw an `Image`](</docs/en/plugins/mods/gallery#image-and-client>) and why this variable doesn’t help inside tmux or screen `CLAUDE_CODE_FORK_SUBAGENT`| Controls fork mode, which is on by default and lets Claude start [forks](</docs/en/sub-agents#fork-the-current-conversation>) on its own. While fork mode is on, Claude also can’t [wait for a subagent](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) in interactive terminal, VS Code, or desktop sessions on your machine. Set to `0` to turn fork mode off. For versions, see [Turn fork mode off](</docs/en/sub-agents#turn-fork-mode-on-or-off>) `CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`| Set to `1` to emit [subagent](</docs/en/sub-agents>) text and thinking blocks in `claude -p --output-format stream-json` output, the same behavior as the [`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) flag. Use the variable when a harness invokes `claude` and can’t pass the flag itself. Unlike the flag, which exits with an error outside non-interactive mode with stream-json output, the variable is ignored there so that nested invocations keep working when it’s set process-wide. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_GATEWAY_HINT_HEADERS`| Set to `1` to send the [gateway hint headers](</docs/en/llm-gateway-protocol#gateway-hint-headers>), such as `x-claude-code-request-class` and `x-claude-code-compaction`, on a custom proxy or a third-party provider such as Amazon Bedrock or Claude Platform on AWS. Set to `0` to stop sending them on every connection, including a direct connection to the Anthropic API, where Claude Code sends them by default. Requires Claude Code v2.1.273 or later @@ -301,15 +297,14 @@ `CLAUDE_CODE_MAX_CONTEXT_TOKENS`| Override the context window size Claude Code assumes for the active model. As of v2.1.193, how it applies depends on how Claude Code resolves the model ID; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>). Use this when routing to a model through `ANTHROPIC_BASE_URL` whose context window does not match the built-in size for its name `CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH`| Maximum length in characters of MCP tool descriptions and MCP server instructions that Claude Code sends to the model. The value you set replaces both [default limits](</docs/en/mcp#for-mcp-server-authors>): 4096, and 16384 for the description of a tool that Claude loads through tool search. Accepts a positive whole number in plain digits. Anything else is ignored and the defaults apply. Requires Claude Code v2.1.280 or later `CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Claude Code lowers a value above a model’s cap to the cap. For a model ID Claude Code can’t resolve to a model it knows, the default is 32000 and the cap is 128000. Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers -`CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10). Capped at 15 as of v2.1.186; as of v2.1.199, `CLAUDE_CODE_RETRY_WATCHDOG` raises the default and removes the cap. For unattended sessions that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG` instead +`CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10). Retrying can stop earlier on `529` overloaded errors. For example, with an API key on an Opus model, it stops at the third `529` and shows [Repeated 529 Overloaded errors](</docs/en/errors#api-error-repeated-529-overloaded-errors>). If you set a [fallback model](</docs/en/settings-reference#fallbackmodel>), Claude Code switches to that model rather than showing the error. Capped at 15 as of v2.1.186; as of v2.1.199, `CLAUDE_CODE_RETRY_WATCHDOG` raises the default and removes the cap. For unattended sessions that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG` instead `CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION`| Removed in v2.1.224 and now a no-op. Previously capped the total number of [subagents](</docs/en/sub-agents>) Claude could spawn with the Agent tool in one session (default: 200); spawning past the cap failed with `Subagent spawn limit reached`. The [concurrent subagent limit](</docs/en/sub-agents#concurrent-subagent-limit>) and the [depth limit](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) still apply `CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH`| Number of [subagent layers](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) allowed below the main conversation (default: 3). At the default, subagents can spawn their own subagents, and a subagent at the third layer can’t spawn further; set `1` to turn nesting off. In v2.1.217 through v2.1.218, the default was 1, so a subagent couldn’t spawn its own unless you raised the limit; v2.1.219 raised the default to 3. Accepts a positive whole number in plain digits; anything else is ignored, so the limit can be adjusted but not removed. Requires Claude Code v2.1.217 or later -`CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`| Maximum number of read-only tools and subagents that can execute in parallel (default: 10). Higher values increase parallelism but consume more resources `CLAUDE_CODE_MAX_TURNS`| Cap the number of agentic turns when no explicit limit is passed. Equivalent to passing [`--max-turns`](</docs/en/cli-reference#cli-flags>), which takes precedence when both are set. A value that is not a positive integer is rejected at startup with an error rather than treated as no cap `CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION`| Cap on [WebSearch](</docs/en/tools-reference#session-search-limit>) calls (default: 200). When Claude reaches the cap, further WebSearch calls return a notice telling it to continue with the information it already gathered and say so in its answer. Accepts a positive whole number with no upper bound. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later `CLAUDE_CODE_MCP_ALLOWLIST_ENV`| Set to `1` to spawn stdio MCP servers with only a safe baseline environment plus the server’s configured `env`, instead of inheriting your shell environment `CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS`| Elapsed time in milliseconds before a still-running MCP tool call [moves to a background task](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) (default: 120000, or 2 minutes). Set to `0` to turn automatic backgrounding off. Requires Claude Code v2.1.212 or later -`CLAUDE_CODE_MCP_STARTUP_WAIT_MS`| How long in milliseconds the first turn of a [non-interactive](</docs/en/headless>) session waits for MCP servers that are still connecting, in place of the default [first-turn wait](</docs/en/agent-sdk/mcp#connection-timing>). When set, the wait covers every pending server; in a [self-hosted environment](</docs/en/self-hosted-environments-configuration#connection-timing>), it changes only how long the wait lasts. Set to `0` to skip the wait. A [`--permission-prompt-tool`](</docs/en/cli-reference#cli-flags>) server keeps its own `MCP_TIMEOUT` wait regardless of the value. Requires Claude Code v2.1.274 or later +`CLAUDE_CODE_MCP_STARTUP_WAIT_MS`| How long in milliseconds the first turn of a [non-interactive](</docs/en/headless>) session waits for MCP servers that are still connecting, in place of the default [first-turn wait](</docs/en/agent-sdk/mcp#connection-timing>). In a [self-hosted environment](</docs/en/self-hosted-environments-configuration#connection-timing>), it changes only how long the wait lasts. Some servers keep a wait of their own regardless of the value; [Connection timing](</docs/en/agent-sdk/mcp#connection-timing>) lists them. Set to `0` to skip the wait for every other server. Requires Claude Code v2.1.274 or later `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT`| Idle timeout in milliseconds for MCP tool calls. When a stdio, HTTP, SSE, WebSocket, or [claude.ai connector](</docs/en/mcp#use-mcp-servers-from-claude-ai>) MCP server sends no response and no progress notification for this long, the tool call aborts with an error instead of waiting for the overall `MCP_TOOL_TIMEOUT`. Overrides the per-transport defaults of 300000 (5 minutes) for network servers and 1800000 (30 minutes) for stdio servers. Set to `0` to disable the idle check. Values below 1000 are raised to one second, and the value is capped at the effective `MCP_TOOL_TIMEOUT`. A per-server `timeout` in `.mcp.json` of at least 1000 raises that server’s idle window to at least the `timeout` value. Doesn’t apply to IDE servers or SDK in-process servers. Requires Claude Code v2.1.187 or later. Before v2.1.203, stdio servers were exempt from the idle timeout `CLAUDE_CODE_MESSAGING_SOCKET`| Set by Claude Code, not by you: in sessions that bind an [inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>), Claude Code exports that socket’s path to hooks and Bash commands when it binds the socket. In a session that starts with messaging on, Claude Code binds the socket before any hook runs. Other sessions on the machine deliver messages to this path. Each session exports its own socket rather than one inherited from a parent, and messages arriving on it go through the session’s [inbound controls](</docs/en/cross-session-messaging#control-inbound-messages>). Settings `env` blocks can’t set it. Requires Claude Code v2.1.224 or later `CLAUDE_CODE_MESSAGING_TOKEN`| Set by Claude Code, not by you: in sessions that bind an [inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>), Claude Code exports this per-session token to hooks and Bash commands alongside `CLAUDE_CODE_MESSAGING_SOCKET`. A script posting to the socket can send `{"type":"auth","token":"<token>"}` as its first line to prove it belongs to the session. On native Windows, Claude Code requires this line and closes any connection that doesn’t open with a valid one. The [own-child rules](</docs/en/cross-session-messaging#the-sessions-inbox-socket>) say when Claude Code consults the token. Each session exports its own token, never one inherited from a parent session. Settings `env` blocks can’t set it. Requires Claude Code v2.1.228 or later @@ -354,6 +349,7 @@ `CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message Claude Code sends to Claude when `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` continues an interrupted turn instead of resending its prompt, or when you resume a [deferred tool call](</docs/en/hooks#defer-a-tool-call-for-later>) with `-p`. Defaults to `Continue from where you left off.`. An empty string uses the default `CLAUDE_CODE_RETRY_WATCHDOG`| Set to `1` for unattended sessions such as eval harnesses, CI jobs, or remote workers. Retries `429` and `529` capacity errors indefinitely instead of failing after `CLAUDE_CODE_MAX_RETRIES` attempts. Claude Code fails at once when a standard-speed request gets a `429` that reports a spend limit or exhausted usage credits, even one from a [gateway spend cap](</docs/en/errors#spend-limit-reached>) that resets on a schedule. Before v2.1.239, the watchdog retried these indefinitely. For fast mode requests, see [Handle rate limits](</docs/en/fast-mode#handle-rate-limits>). The watchdog backs off up to 5 minutes between attempts, or until the limit resets when the response carries a rate-limit reset time, so a session that hits a usage limit waits out the remaining window. On v2.1.199 or later it also raises the default retry count for other transient errors, such as server errors, timeouts, and dropped connections, to 300, roughly three hours of backoff, and removes the cap of 15 on `CLAUDE_CODE_MAX_RETRIES` if you set that variable explicitly. Requires Claude Code v2.1.186 or later `CLAUDE_CODE_RETRY_WATCHDOG_MAX_WAIT_MS`| Maximum time in milliseconds that each API request spends waiting out `429` and `529` errors when `CLAUDE_CODE_RETRY_WATCHDOG` is set. Once that time is spent, the next such error ends the request. Give a positive whole number in plain digits, such as `1800000` for 30 minutes. When unset, the wait has no limit. Requires Claude Code v2.1.295 or later +`CLAUDE_CODE_RETRY_WATCHDOG_USAGE_LIMIT_RECHECK_MS`| Minimum interval in milliseconds between checks of whether a [usage limit](</docs/en/errors#youve-hit-your-session-limit>) was already lifted, while a request waits for that limit to reset with `CLAUDE_CODE_RETRY_WATCHDOG` set. When a check finds the limit lifted, the request goes out at once. Give a whole number in plain digits from `60000`, one minute, to `10800000`, three hours. Checks are made only for a claude.ai subscription’s session or weekly limit while usage credits aren’t in use, and not while `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set. When this variable is unset or its value is outside that range, no checks are made. Requires Claude Code v2.1.305 or later `CLAUDE_CODE_SAFE_MODE`| Set to `1` to start in safe mode: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto memory do not load, for troubleshooting a broken configuration. Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Equivalent to passing [`--safe-mode`](</docs/en/cli-reference#cli-flags>). Directly spawned child processes inherit the variable `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 any positive value up to 20, including fractional values below 1 such as `0.5` to slow accelerated trackpad and wheel scrolling in terminals that already amplify wheel events. 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 @@ -387,7 +383,6 @@ `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`| Timeout in milliseconds for the first query to wait for the initial skill list when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 5000). When exceeded, the first query runs with whichever skills have arrived. The downloads finish in the background either way, and Claude waits for a skill’s download when it invokes that skill `CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings-reference#syntaxhighlightingdisabled>) setting `CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list, in [sessions that have the Task tools](</docs/en/tools-reference#task-tool-availability>). See [Task list](</docs/en/interactive-mode#task-list>) -`CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS`| Override, in milliseconds, how long a non-interactive session waits at exit for its [agent team](</docs/en/agent-teams>) to finish tearing down. Accepts 1000 to 60000; an out-of-range value is ignored and the default of 10000 applies. Requires Claude Code v2.1.206 or later `CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` to this path on Unix, or `/claude/` on Windows. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. On macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` when it is set. On native Windows, when your shell doesn’t set `$TMPDIR`, a Bash command that references `$TMPDIR` receives your override, or `%TEMP%` when you haven’t set one. Claude Code’s own temp files always use your override. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to any non-empty value, such as `1`, to allow 24-bit truecolor output inside tmux. **Setting it to`0` or `false` still allows truecolor**, unlike most on/off variables; unset the variable to restore the 256-color clamp. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings `CLAUDE_CODE_TOOL_MEMORY_CGROUP_EXCLUDE`| On Linux and WSL, set to a comma-separated list of the kinds of processes Claude Code [excludes from the tool memory cap](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), such as `mcp` or `lsp`. Set `none` to cap every kind, or `all-new` to cap only Bash, PowerShell, and Monitor tool commands. Claude Code keeps Bash, PowerShell, and Monitor tool commands under the cap whatever you list. Requires Claude Code v2.1.246 or later @@ -398,7 +393,6 @@ `CLAUDE_CODE_USE_BEDROCK`| Use [Amazon Bedrock](</docs/en/amazon-bedrock>) `CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>) `CLAUDE_CODE_USE_MANTLE`| Use the Amazon Bedrock [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) -`CLAUDE_CODE_USE_NATIVE_FILE_SEARCH`| Set to `1` to discover custom commands, subagents, and output styles using Node.js file APIs instead of ripgrep. Set this if the bundled ripgrep binary is unavailable or blocked in your environment. Does not affect the Grep or file search tools `CLAUDE_CODE_USE_POWERSHELL_TOOL`| Controls the PowerShell tool. On Windows without Git Bash, the tool is enabled automatically; set to `0` to disable it. On Windows with Git Bash installed, the tool is on by default for claude.ai and Console accounts; set to `1` to enable it in Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry sessions, or `0` to turn it off. On Linux, macOS, and WSL, set to `1` to enable it, which requires `pwsh` on your `PATH`. When enabled on Windows, Claude can run PowerShell commands natively instead of routing through Git Bash. See [PowerShell tool](</docs/en/tools-reference#powershell-tool>) `CLAUDE_CODE_USE_VERTEX`| Use [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) `CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS`| Set to the number of milliseconds [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) keeps each fetched URL’s response cached. The default is `900000`, which is 15 minutes. Takes plain digits only; `0`, a decimal, or any other spelling keeps the default. Claude Code reads the value once per launch, so a change in a settings `env` block applies when you next launch `claude`. Requires Claude Code v2.1.233 or later @@ -409,7 +403,6 @@ `CLAUDE_CODE_WORKFLOW_PREFIX_STAGGER_MS`| Upper bound in milliseconds on how long a [workflow](</docs/en/workflows>) agent waits for a same-prefix sibling’s first response to begin before sending its own first request. When a fan-out starts several agents that share a [prompt-cache prefix](</docs/en/workflows#prompt-caching-in-a-fan-out>), Claude Code holds all but the first agent for up to this long so the rest read the cached prefix instead of each processing it uncached. Default `5000`. Set to `0` to disable the wait. When `DISABLE_PROMPT_CACHING` is set, agents never wait. Requires Claude Code v2.1.229 or later `CLAUDE_CODE_YOU_SHOULD_KNOW_DEBUG`| Set to `1` to show, above the prompt, a line for each of the last three checks the [You should know mod](</docs/en/interactive-mode#you-should-know-suggestions>) made in this session. Use it to confirm the mod is checking when no notes appear. Requires Claude Code v2.1.287 or later `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, session history, and plugins are stored under this path. For credentials, see [where Claude Code stores credentials](</docs/en/authentication#credential-management>). Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'`. Set it in your shell, user settings, or managed settings. In a settings file, write the absolute path. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) -`CLAUDE_DISABLE_ADOPT`| Set to `1` to stop in-flight background work instead of carrying it over when you background a session by pressing `←` or with [`/background`](</docs/en/agent-view#from-inside-a-session>). Claude Code asks you to confirm before backgrounding, then stops the tasks that would otherwise carry over. Requires Claude Code v2.1.195 or later `CLAUDE_EFFORT`| Set automatically in Bash tool subprocesses and hook commands to the [effort level](</docs/en/model-config#adjust-effort-level>) in effect when the subprocess starts: `low`, `medium`, `high`, `xhigh`, or `max`. Matches the `effort.level` field passed to [hooks](</docs/en/hooks>). Only set when the current model supports the effort parameter `CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. `0` also turns off the [first-byte deadline](</docs/en/network-config#streaming-idle-watchdogs>) on the connections where that deadline runs. When unset, the watchdog is enabled by default for direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) connections, and for streaming responses on [gateway](</docs/en/gateways>) connections reached through `ANTHROPIC_BASE_URL` or `ANTHROPIC_AWS_BASE_URL`; before v2.1.222 it didn’t run on those gateway connections, so the event-level watchdog could report a stall there even while keep-alive pings were arriving. For timeouts and how the timers interact, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`| Set to `1` to enable the byte-level streaming idle watchdog on Amazon Bedrock `vnd.amazon.eventstream` responses, which also enables the [first-byte deadline](</docs/en/network-config#streaming-idle-watchdogs>) on Bedrock streaming requests. Off by default. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` @@ -447,10 +440,9 @@ `DO_NOT_TRACK`| Set to `1` to opt out of telemetry, with the same effect as `DISABLE_TELEMETRY`, including on feature-flag fetching. Claude Code reads this variable as a standard boolean, so `0` leaves telemetry on, and honors it as the cross-tool convention recognized by many developer CLIs `ENABLE_BETA_TRACING_DETAILED`| Set to `1`, and set `BETA_TRACING_ENDPOINT` to your OTLP/HTTP collector endpoint, to turn on [detailed beta tracing](</docs/en/monitoring-usage#traces-beta>), which adds content-bearing span attributes and the `claude_code.hook` span. Interactive CLI sessions also require your organization to be allowlisted for the beta. Both variables are ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to stop Claude Code from fetching [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>). Enabled by default for logged-in users. To disable per-project or per-org, set [`disableClaudeAiConnectors`](</docs/en/settings-reference#disableclaudeaiconnectors>) in settings instead -`ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive the 1-hour TTL automatically on the [main conversation](</docs/en/prompt-caching#which-ttl-each-request-gets>). Subscription users drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) can set it to keep the 1-hour TTL. 1-hour cache writes are billed at a higher rate. To choose the TTL per request bucket instead, use `CLAUDE_CODE_PROMPT_CACHE_TTL` and `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, which take precedence over this variable +`ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. For subscription users within included usage, Claude Code requests the 1-hour TTL automatically on the [main conversation](</docs/en/prompt-caching#which-ttl-each-request-gets>). Subscription users drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) can set it to keep the 1-hour TTL. 1-hour cache writes are billed at a higher rate. To choose the TTL separately for the main conversation and for requests outside it, use `CLAUDE_CODE_PROMPT_CACHE_TTL` and `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, which take precedence over this variable `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead -`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset, Claude Code defers all MCP tools by default, and loads them upfront instead when `ANTHROPIC_BASE_URL` points to a non-first-party host. `true` keeps them deferred on such a host too. `auto` loads upfront when tool definitions fit within 10% of context. `auto:N` sets a custom threshold, such as `auto:5` for 5%. `false` loads all tools upfront. For the models and deployments that load every tool upfront whatever this value is, see [Configure tool search](</docs/en/mcp#configure-tool-search>) -`FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value, such as `1`, to make Claude Code stop retrying on repeated overload errors for every model when no fallback model is configured. **Setting it to`0` or `false` still enables this**, unlike most on/off variables; unset the variable to restore the default retry behavior. Without it, Claude Code stops retrying this way on models it recognizes as Opus, Fable, or Mythos models when you authenticate with an API key or a [third-party provider](</docs/en/third-party-integrations>) rather than a Claude subscription. On Claude Code v2.1.160 or later, Claude Code switches to your configured [fallback model chain](</docs/en/model-config#fallback-model-chains>) on repeated overload errors for any primary model, so this variable doesn’t affect switching to a fallback model +`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset or `true` defers MCP tools, except in the [cases that keep tool search off](</docs/en/mcp#configure-tool-search>). `auto` turns tool search on once definitions reach 10% of the context window. `auto:N` sets a custom threshold, such as `auto:5` for 5%. `false` loads all tools upfront. If a gateway rejects tool search, see [Tool search through an LLM gateway](</docs/en/mcp#tool-search-through-a-gateway>) `FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` `FORCE_HYPERLINK`| Set to `1` to enable clickable OSC 8 hyperlinks when your terminal supports them but isn’t auto-detected, or `0` to disable them. When unset, Claude Code enables hyperlinks only when it detects terminal support. Claude Code parses this value as a number, not a Boolean, so a value such as `false`, `no`, or `off` enables hyperlinks rather than disabling them. The footer [PR or merge request badge](</docs/en/interactive-mode#pr-review-status>) renders as a hyperlink even when Claude Code can’t detect terminal support, such as over SSH. Set `0` to render the badge as plain text `FORCE_PROMPT_CACHING_5M`| Set to `1` to force the 5-minute prompt cache TTL even when 1-hour TTL would otherwise apply. Overrides `CLAUDE_CODE_PROMPT_CACHE_TTL`, `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, `ENABLE_PROMPT_CACHING_1H`, and the `promptCacheTtl` and `subagentPromptCacheTtl` settings @@ -550,7 +542,6 @@ With fetching off, you can’t: - * Run [`/auto-mode-setup`](</docs/en/auto-mode-config#generate-environment-entries>) to draft `autoMode.environment` entries * Use [Remote Control](</docs/en/remote-control>) with `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` or `DISABLE_GROWTHBOOK` set. For `DISABLE_TELEMETRY` and `DO_NOT_TRACK`, see the [Remote Control requirements](</docs/en/remote-control#requirements>) * [Message sessions beyond this machine](</docs/en/cross-session-messaging#message-sessions-on-other-machines>) when [Remote Control](</docs/en/remote-control#requirements>) is unavailable. Messaging between sessions on this machine works with fetching off * Run [`claude import` or the `/import` command](</docs/en/cli-reference#cli-commands>)
modified Error reference View current →
Show diff (656 lines)
--- a/errors.md +++ b/errors.md @@ -75,6 +75,8 @@ `Your account does not have access to Claude. Please login again or contact your administrator.`| Authentication `API Error: 401 Invalid authentication credentials`| Authentication `Login expired · Please run /login`| Authentication +`The browser can't return the sign-in to Claude Code automatically`| Authentication +`Couldn't start the local listener that receives the browser sign-in. Try again.`| Authentication `Failed to start OAuth callback server`| Authentication `Claude login not accepted · Run /login, then try again`| Authentication `Artifacts need a claude.ai login`| Authentication @@ -92,6 +94,7 @@ `claude.ai rejected the session token` / `session token rejected`| Authentication `MCP server "<name>" needs you to sign in again (run /mcp to re-authenticate)`| Authentication `rejected the credential from its headersHelper` / `rejected the Authorization header in its config`| Authentication +`(check the helper, then start a new task or chat)` / `(update it, then start a new task or chat)`| Authentication `MCP server "<name>" needs additional permissions (scope: "<scope>") — run /mcp to re-authenticate`| Authentication `MCP server "<name>" requires re-authorization (token expired)`| Authentication `This server's URL is missing or not a valid URL, so sign-in can't start`| Authentication @@ -192,6 +195,8 @@ `Installation was killed before it could finish (exit code 137)`| [Troubleshoot installation and login](</docs/en/troubleshoot-install#installation-was-killed-before-it-could-finish>) `The connection dropped while downloading the update`| [Troubleshoot installation and login](</docs/en/troubleshoot-install#the-connection-dropped-while-downloading-the-update>) `Download timed out: exceeded the total deadline`| [Troubleshoot installation and login](</docs/en/troubleshoot-install#the-connection-dropped-while-downloading-the-update>) +`Release verification failed for Claude Code <version> (<reason>). The update was not installed.`| [Troubleshoot installation and login](</docs/en/troubleshoot-install#release-verification-failed>) +`Auto-update failed · Run claude doctor`| [Troubleshoot installation and login](</docs/en/troubleshoot-install#auto-update-failed>) `--bg and --print conflict`| Command-line errors `Couldn't tell whether --bg is a flag or text here, so nothing was started`| Command-line errors `Error: Cannot use both --append-subagent-system-prompt and --append-subagent-system-prompt-file. Please use only one.`| Command-line errors @@ -262,6 +267,7 @@ `Custom output styles can't be selected over Remote Control or from a relayed message`| Command-line errors `Output styles are saved to local settings (.claude/settings.local.json), which this session doesn't load`| Command-line errors `/recap only runs when you ask for it yourself in this session`| Command-line errors +`/feedback is disabled by your organization's policy`, or the same for `/bug` or `/share`| Command-line errors ``plugin eval` is currently in early access` / ``plugin eval` is currently unavailable`| Plugin errors `cannot be evaluated where sessions load it`| [Test plugins with evals](</docs/en/plugin-evals#cannot-be-evaluated-where-sessions-load-it>) `Marketplace "<name>" is registered from an untrusted source`| Plugin errors @@ -281,6 +287,7 @@ `The packages it lists are not installed` / `The packages it lists were not installed, because`| [Plugin troubleshooting](</docs/en/plugins/troubleshooting#the-packages-it-lists-are-not-installed>) `does not load (...), so Claude Code ignores the whole file`| [Plugin troubleshooting](</docs/en/plugins/troubleshooting#does-not-load-so-claude-code-ignores-the-whole-file>) `path escapes plugin directory`| Plugin errors +`Plugin not loaded: its manifest <path> was not read`| Plugin errors `path could not be checked`| Plugin errors `its marketplace entry path does not stay inside the marketplace directory`| Plugin errors `Plugin source path refused`| Plugin errors @@ -296,12 +303,15 @@ `File is covered by a Read deny rule in your permission settings`| Tool errors `cannot contain null bytes (\0)`| Tool errors `Path contains null bytes`| Tool errors +`File is too large to read as an image (the limit is 128MB)`| Tool errors +`Cannot read this as an image: <path> is a pipe or a device`| Tool errors `subagent_type is required: the general-purpose agent is not available in this session`| Tool errors `Error: this write left the memory index at MEMORY.md at ..., over its ... read limit`| Tool errors `pkill: refusing to run`| Tool errors `Failed to write to <name>'s inbox — nothing was sent`| Tool errors `Failed to write the plan approval request to the lead's inbox — plan not submitted`| Tool errors `Its agent definition was not restored: the folder its definition file came from is not trusted`| Tool errors +`Only a teammate can approve a shutdown request`| Tool errors `Message too large for cross-session delivery`| Tool errors `Too many messages to this session just now`| Tool errors `Cross-session message was dropped at the recipient session's inbox`| Tool errors @@ -317,10 +327,12 @@ `Your disk quota is full on the filesystem with Claude Code's temp directory <dir> (EDQUOT)`| Tool errors `The filesystem with Claude Code's temp directory <dir>, or your disk quota on it, is full (ENOSPC)`| Tool errors `Command output was lost: the temp filesystem at <dir> is full` / `is out of inodes`| Tool errors +`The command was not started: this computer's disk is full (ENOSPC)` / `(EDQUOT)`| Tool errors `File is not valid UTF-8. It may use a legacy encoding such as Windows-1252, Shift-JIS or GBK, or be binary`| Tool errors `the source file is not valid UTF-8 text` / `the source file is not valid UTF-16 text`| Tool errors `the source file has the replacement character U+FFFD`| Tool errors `Not published: that file is on a network share`| Tool errors +`Not published: Claude sent the same content again after a newer version of the artifact turned it away` / `Not published: Claude sent its changes again over the same file after a newer version of the artifact turned them away`| Tool errors `Reading a local file from outside this session's connected folders, or through a link, needs the approval card`| Tool errors `cannot read file_path (...) — the file could not be examined, and no one can answer the approval card`| Tool errors `WebFetch cannot fetch localhost or other hostnames without a dot`| Tool errors @@ -337,7 +349,7 @@ `Can't open — this session is running in another terminal`| Background session errors `This conversation is already open in another running Claude session`| Background session errors `This session's saved conversation is no longer on disk`| Background session errors -`Bypass permissions was requested at launch and ignored`| [Skip all checks with bypassPermissions mode](</docs/en/permission-modes#bypass-permissions-acceptance>) +`Bypass permissions was requested at launch and ignored`| [Bypass permissions ignored in a background session](</docs/en/permission-modes#bypass-permissions-ignored-in-a-background-session>) `kept <id> — its worktree is still at <path>`| Background session errors `kept <id> — <n> unpushed commits on <branch>`| Background session errors `kept <id> — worktree has commits that are not pushed anywhere`| Background session errors @@ -346,6 +358,8 @@ `Session <id> was stopped while the respawn was in flight`| Background session errors `This session was running agent '<name>', which is no longer available`| Background session errors `This session restarted <time> after its next /loop wakeup was due, so that wakeup will not fire`| Background session errors +`No LLM gateway: a gateway set in your shell isn't passed to a session opened from another folder`| Background session errors +`No LLM gateway: opened from another folder · respawn from <folder>`| Background session errors `CLAUDE_CODE_PROCESS_WRAPPER: launcher ...`| Background session errors `EUNKNOWN: unknown error, uv_spawn`| Background session errors `EACCES: permission denied, posix_spawn`| Background session errors @@ -386,10 +400,16 @@ `API Error: ANTHROPIC_FOUNDRY_RESOURCE must be a Foundry resource name`| Configuration warnings `headersHelper not run — this workspace has no persisted trust`| Configuration warnings `Invalid permission rule "..." was skipped: Malformed Tool(content) rule`| Configuration warnings +`matches no tool · check for typos` / `matches no known tool — check for typos`| Configuration warnings `... is not matched by file permission checks`| Configuration warnings +`Write(<path>) never matches · use Edit(<path>)` / `Glob(<path>) never matches · use Read(<path>)`| Configuration warnings `... has a wildcard before the rest of the command`| Configuration warnings +`allows any option at its * · use an exact value`| Configuration warnings `Denying Bash also turns off the PowerShell tool, so Claude has neither`| Configuration warnings `CLAUDE_CODE_DISABLE_1M_CONTEXT is set, but the 200K limit isn't enforced`| Configuration warnings +`CLAUDE_CODE_AUTO_COMPACT_WINDOW="<value>" reads as <N> tokens, so Claude Code treats it as the 100k minimum`| [Values and warnings for `CLAUDE_CODE_AUTO_COMPACT_WINDOW`](</docs/en/model-config#claude_code_auto_compact_window-values>) +`CLAUDE_CODE_AUTO_COMPACT_WINDOW="<value>" is too large, so Claude Code treats it as the 1M maximum`| [Values and warnings for `CLAUDE_CODE_AUTO_COMPACT_WINDOW`](</docs/en/model-config#claude_code_auto_compact_window-values>) +`CLAUDE_CODE_AUTO_COMPACT_WINDOW="<value>" isn't a usable size, so Claude Code ignores it`| [Values and warnings for `CLAUDE_CODE_AUTO_COMPACT_WINDOW`](</docs/en/model-config#claude_code_auto_compact_window-values>) `Model "<model>" isn't recognized · context assumed to be 200k tokens`| [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) `Claude Code doesn't recognize the model "<model>", so it assumes a context window of 200k tokens`| [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) `[claude-code:unrecognized_model]`| Configuration warnings @@ -456,6 +476,7 @@ [`CLAUDE_CODE_MAX_RETRIES`](</docs/en/env-vars>)| 10| Number of retry attempts. Capped at 15 as of v2.1.186; as of v2.1.199 `CLAUDE_CODE_RETRY_WATCHDOG` raises the default and removes the cap. Lower it to surface failures faster in scripts. [`CLAUDE_CODE_RETRY_WATCHDOG`](</docs/en/env-vars>)| unset| Set to `1` in unattended sessions such as CI jobs to retry `429` and `529` capacity errors indefinitely instead of failing after `CLAUDE_CODE_MAX_RETRIES` attempts. Claude Code fails at once when a standard-speed request gets a `429` that reports a spend limit or exhausted usage credits, even one from a gateway spend cap that resets on a schedule. Before v2.1.239, the watchdog retried these indefinitely. For fast mode requests, see [Handle rate limits](</docs/en/fast-mode#handle-rate-limits>). On v2.1.199 or later it also raises the default retry count for other transient errors, such as server errors, timeouts, and dropped connections, to 300, roughly three hours of backoff, and removes the cap of 15 on `CLAUDE_CODE_MAX_RETRIES` if you set that variable explicitly. [`CLAUDE_CODE_RETRY_WATCHDOG_MAX_WAIT_MS`](</docs/en/env-vars>)| unset| Maximum time in milliseconds that each API request spends waiting out `429` and `529` errors when `CLAUDE_CODE_RETRY_WATCHDOG` is set. When unset, the wait has no limit. Requires Claude Code v2.1.295 or later. +[`CLAUDE_CODE_RETRY_WATCHDOG_USAGE_LIMIT_RECHECK_MS`](</docs/en/env-vars>)| unset| Minimum interval in milliseconds between checks of whether a usage limit was already lifted, while a request waits for that limit to reset with `CLAUDE_CODE_RETRY_WATCHDOG` set. When a check finds the limit lifted, the request goes out at once. Give plain digits from `60000` to `10800000`. When unset or outside that range, no checks are made. For when Claude Code skips these checks, see the [environment variables reference](</docs/en/env-vars>). Requires Claude Code v2.1.305 or later. [`CLAUDE_CODE_OVERLOADED_RETRY_BASE_DELAY_MS`](</docs/en/env-vars>)| 500| Starting delay in milliseconds of the backoff between retries of a request that the API rejects with a `529` overloaded error. Raise it, up to 32000, to spread the retries over a longer window when the API is at capacity. Has no effect when `CLAUDE_CODE_RETRY_WATCHDOG` is set to `1`, or when the rejected request was sent in [fast mode](</docs/en/fast-mode#handle-rate-limits>). Requires Claude Code v2.1.292 or later. [`CLAUDE_CODE_OVERLOADED_RETRY_MAX_DELAY_MS`](</docs/en/env-vars>)| 32000| Ceiling in milliseconds on the backoff between retries of a request that the API rejects with a `529` overloaded error. Raise it, up to 64000, so that later retries keep spreading apart when the API is at capacity. Has no effect when `CLAUDE_CODE_RETRY_WATCHDOG` is set to `1`, or when the rejected request was sent in [fast mode](</docs/en/fast-mode#handle-rate-limits>). Requires Claude Code v2.1.296 or later. [`API_TIMEOUT_MS`](</docs/en/env-vars>)| 600000| Time in milliseconds that each request attempt has to receive its response headers. It doesn’t limit how long a streaming response runs after that. Raise it for slow networks or proxies. For how it caps the first-byte deadline, see No response from API. @@ -484,6 +505,7 @@ * Check [status.claude.com](<https://status.claude.com>), or the provider status page named in the message, for active incidents * Wait a minute, then send your message again. Your original message is still in the conversation, so for a long prompt you can type `try again` instead of pasting the whole thing. + * If [`ANTHROPIC_BASE_URL`](</docs/en/env-vars>) points at an [LLM gateway](</docs/en/llm-gateway>) and every request fails this way, check whether your gateway is rejecting the tool search fields Claude Code sends by default. To check, set `ENABLE_TOOL_SEARCH=false` as [Tool search through an LLM gateway](</docs/en/mcp#tool-search-through-a-gateway>) describes, then try again. Before v2.1.304, tool search was off behind a gateway unless you turned it on with `ENABLE_TOOL_SEARCH`. * If the error persists with no posted incident, run `/feedback` so Anthropic can investigate with your request details. See Report an error if `/feedback` is unavailable in your environment. ### @@ -512,8 +534,9 @@ Request timed out -The default request timeout is 10 minutes. **What to do:** - +The default request timeout is 10 minutes. If you set [`API_TIMEOUT_MS`](</docs/en/env-vars>) to `0`, this request timeout is off. The first-byte deadline and the body idle timeout don’t turn off when you set `0`, so a streaming request still runs under [whichever of them apply to your connection](</docs/en/network-config#streaming-idle-watchdogs>). A non-streaming attempt keeps its 300-second limit in a local session and can still end with this message. **What to do:** + + * If every request fails with this message and you set `API_TIMEOUT_MS` to `0`, check `claude --version`. On a version before v2.1.305, update Claude Code or set a positive value. * Retry the request * If a slow network or proxy is the cause, raise `API_TIMEOUT_MS` as described in Automatic retries * If timeouts are frequent and your network is otherwise healthy, see Network and connection errors below @@ -531,7 +554,7 @@ Claude Code sets the first attempt’s wait for response headers and the retry’s wait separately: * **First attempt** : [`CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS`](</docs/en/env-vars>) when you set it to 1 or more, clamped to between 10 seconds and 30 minutes. Otherwise Claude Code uses the byte-level watchdog timeout listed in [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>), so the variables that change that timeout change this wait too. Either way, Claude Code adds one second for every 32KB of request body. - * **Retry** : one second less than `API_TIMEOUT_MS`, just under 10 minutes by default, so that the retry can outlast a proxy or gateway that holds the response until generation completes. On Amazon Bedrock, the retry uses the same deadline as the first attempt, and the message shows one duration instead of two. + * **Retry** : one second less than `API_TIMEOUT_MS`, just under 10 minutes by default, so that the retry can outlast a proxy or gateway that holds the response until generation completes. On Amazon Bedrock, the retry uses the same deadline as the first attempt, and the message shows one duration instead of two. Except on Amazon Bedrock, if you set `API_TIMEOUT_MS` to `0`, the retry waits 10 minutes plus one second per 32KB, or as long as the first attempt if that’s longer. Neither wait exceeds one second less than a positive `API_TIMEOUT_MS`, and a positive `API_TIMEOUT_MS` under 11 seconds turns the deadline off. The byte-level watchdog starts only once the response headers arrive, so a response that stops sending bytes after that follows the stalled-stream rules instead of this deadline. **What to do:** @@ -809,7 +832,7 @@ * Run `/status` and confirm the active credential is the one you expect. A stray `ANTHROPIC_API_KEY` in your environment can route requests through a low-tier key instead of your subscription. * Check your provider console for the active limits and request a higher tier if needed * For Anthropic API keys, see the [rate limits reference](<https://platform.claude.com/docs/en/api/rate-limits>) for how tiers work and how to set per-workspace caps - * Reduce concurrency: lower [`CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`](</docs/en/env-vars>), avoid running many parallel subagents, or switch to a smaller model with `/model` for high-volume scripted runs + * Reduce concurrency: avoid running many parallel subagents, or switch to a smaller model with `/model` for high-volume scripted runs ### @@ -1209,6 +1232,7 @@ * If `/status` shows only your login, run `/login` once. If the credential was revoked, a fresh login replaces it. * If the same message returns for the same login account, the account or organization is no longer active. Check the account and organization that `/status` reports, and ask your organization admin to restore access. * If [`ANTHROPIC_BASE_URL`](</docs/en/env-vars>) points at an [LLM gateway](</docs/en/llm-gateway>), the text after `401` is your gateway’s message rather than Anthropic’s, and `/login` doesn’t change it. Fix the credential your gateway expects instead. + * If every request fails with a `401` once your gateway has the credential it expects, check whether the gateway is rejecting the tool search fields Claude Code sends by default. To check, set `ENABLE_TOOL_SEARCH=false` as [Tool search through an LLM gateway](</docs/en/mcp#tool-search-through-a-gateway>) describes, then try again. Before v2.1.304, tool search was off behind a gateway unless you turned it on with `ENABLE_TOOL_SEARCH`. ### @@ -1272,16 +1296,24 @@ ​ -Failed to start OAuth callback server - -When `/login`, `claude auth login`, or `claude setup-token` signs you in through the browser, Claude Code opens a listening port on `127.0.0.1` so your browser can return the sign-in result to it. This message means Claude Code couldn’t open that port, and the sign-in stops before a browser window or login URL appears: - - Failed to start OAuth callback server: Failed to start server. Is port 0 in use? - -If your message ends with `Is port 0 in use?`, the attempt to listen on the IPv4 loopback address `127.0.0.1` failed outright. Because the failure happens before a login URL exists, the `Paste code here if prompted` flow isn’t available as a workaround. **What to do:** - - * To sign in right away without the local listener: if you use a claude.ai subscription, run [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>) on a machine where sign-in works and set the token it prints as `CLAUDE_CODE_OAUTH_TOKEN` on this machine. Otherwise set `ANTHROPIC_API_KEY` to a key from the [Claude Console](<https://platform.claude.com/settings/keys>). [Authentication precedence](</docs/en/authentication#authentication-precedence>) explains how Claude Code chooses between credentials. - * To use browser sign-in on this machine instead, Claude Code must be able to listen on `127.0.0.1`. If it runs inside a sandbox, check that the sandbox’s policy allows listening on local ports, then run `/login` again. If it should be able to and still fails, run `/feedback` so the report includes your environment details. +Couldn’t start the local listener that receives the browser sign-in + +Each of these messages from `/login`, `claude auth login`, or `claude setup-token` means Claude Code couldn’t open the port on `127.0.0.1` where your browser returns the sign-in result. With the notice that begins `The browser can't return the sign-in to Claude Code automatically`, the sign-in continues without that port. No browser opens, and the notice appears above a URL where you sign in instead: + + The browser can't return the sign-in to Claude Code automatically. After you sign in, paste the code shown. + +With the message that includes `Couldn't start the local listener`, the sign-in stopped. That happens, for example, when you pipe input into `claude auth login`: + + Couldn't start the local listener that receives the browser sign-in. Try again. + +**What to do:** + + * **`The browser can't return the sign-in to Claude Code automatically`** : you don’t need to fix anything first. Open the URL shown under the notice in a browser and sign in. The browser then shows a code: paste it into Claude Code at the `Paste code here >` prompt, and the sign-in continues from there. + * **`Couldn't start the local listener that receives the browser sign-in`** : run the same command again. If it stops the same way, sign in with a token or API key instead of the browser. Or, if you piped input into `claude auth login`, run it in a terminal so it can take a pasted code. + * **To sign in with a token or API key instead of the browser** : if you use a claude.ai subscription, run [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>) on a machine where sign-in works. Then set the token it prints as the [`CLAUDE_CODE_OAUTH_TOKEN`](</docs/en/env-vars>) environment variable on this machine. Otherwise set the `ANTHROPIC_API_KEY` environment variable to a key from the [Claude Console](<https://platform.claude.com/settings/keys>). [Authentication precedence](</docs/en/authentication#authentication-precedence>) explains how Claude Code chooses between credentials. + * **To get the automatic browser return back** : Claude Code must be able to listen on `127.0.0.1`. If it runs inside a sandbox, check that the sandbox’s policy allows listening on local ports, then sign in again. If listening should work there and the notice still appears, run `/feedback` so the report includes your environment details. + +Before v2.1.305, the sign-in stopped as soon as the port couldn’t be opened and showed no URL to sign in at. The message read, for example, `Failed to start OAuth callback server: Failed to start server. Is port 0 in use?`. On those versions, update Claude Code and sign in again, or sign in with a token or API key instead of the browser. ### @@ -1431,7 +1463,15 @@ MCP server "<name>" rejected the Authorization header in its config (update it, then run /mcp to reconnect) -Update the header value where the server is configured, then reconnect from `/mcp`. Before v2.1.273, the expired sign-in, `headersHelper`, and `Authorization` header cases all showed `MCP server "<name>" requires re-authorization (token expired)`. A server can also refuse a tool call with HTTP 403 `insufficient_scope` to ask you to authorize a scope, sometimes one your token already lists. The message names that scope: +Update the header value where the server is configured, then reconnect from `/mcp`. In a [Cowork](<https://claude.com/docs/cowork/overview>) session on your machine in the Claude Desktop app, these messages mean the MCP server rejected a credential it was given. Fix the one the message names, then start a new task or chat in Cowork: + + MCP server "<name>" rejected the credential from its headersHelper (check the helper, then start a new task or chat) + MCP server "<name>" rejected the Authorization header in its config (update it, then start a new task or chat) + + * **`headersHelper` credential rejected**: check that the helper returns a credential the server accepts, then start a new task or chat in Cowork + * **`Authorization` header rejected**: update the `Authorization` value under `headers` in that server’s configuration, then start a new task or chat in Cowork + +Before v2.1.302, a Cowork session showed the `run /mcp to reconnect` endings instead, although `/mcp` isn’t available there. If you see such an ending in Cowork, still check the helper or update the header, then start a new task or chat. Before v2.1.273, the expired sign-in, `headersHelper`, and `Authorization` header cases all showed `MCP server "<name>" requires re-authorization (token expired)`. A server can also refuse a tool call with HTTP 403 `insufficient_scope` to ask you to authorize a scope, sometimes one your token already lists. The message names that scope: MCP server "<name>" needs additional permissions (scope: "<scope>") — run /mcp to re-authenticate @@ -1705,8 +1745,9 @@ * Confirm you can reach the API host from the same shell by running `curl -I https://api.anthropic.com`. On Windows PowerShell use `curl.exe -I https://api.anthropic.com` so the built-in `Invoke-WebRequest` alias is not used. * If you are behind a corporate proxy, set `HTTPS_PROXY` before launching Claude Code and see [Network configuration](</docs/en/network-config>) * If you route through an LLM gateway or relay, set [`ANTHROPIC_BASE_URL`](</docs/en/env-vars>) to its address. See [Connect Claude Code to an LLM gateway](</docs/en/llm-gateway-connect>) for setup. + * If `ANTHROPIC_BASE_URL` already points at your gateway and every request ends in `Connection dropped`, check whether your gateway is rejecting the tool search fields Claude Code sends by default. To check, set `ENABLE_TOOL_SEARCH=false` as [Tool search through an LLM gateway](</docs/en/mcp#tool-search-through-a-gateway>) describes, then try again. Before v2.1.304, tool search was off behind a gateway unless you turned it on with `ENABLE_TOOL_SEARCH`. * Ensure your firewall allows the hosts listed in [Network access requirements](</docs/en/network-config#network-access-requirements>) - * Intermittent failures are retried automatically; persistent failures point to a local network issue + * Intermittent failures are retried automatically If `curl` succeeds but Claude Code still fails, the cause is usually something between the runtime and the network rather than the network itself: @@ -2027,6 +2068,7 @@ * Trim large `CLAUDE.md` memory files, or move instructions into [path-scoped rules](</docs/en/memory#path-specific-rules>) that load only when relevant * Auto-compact is on by default and normally prevents this error. If you turned it off in `/config` or with [`DISABLE_AUTO_COMPACT`](</docs/en/env-vars>), turn it back on. If you keep it off, run `/compact` yourself before the window fills. * If the error appears near 200K tokens on a model that accepts more, one cause is a model ID that Claude Code doesn’t recognize. Claude Code assumes a 200K window for such an ID, so to keep working past that point, [give it the model’s real context window](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>). + * If the error appeared right after you stopped Claude while it was compacting the conversation, your conversation is unchanged and still large enough to need compacting. Run `/compact` and send your message again. To keep the error from recurring, [update Claude Code](</docs/en/setup#update-claude-code>) to v2.1.304 or later. Before v2.1.304, stopping at that moment could end the turn with this error. See [Explore the context window](</docs/en/context-window>) for an interactive view of how context fills up. @@ -2161,14 +2203,20 @@ Extra inputs are not permitted -A proxy or LLM gateway between Claude Code and the API stripped the `anthropic-beta` request header, so the API rejected fields that depend on it. - - API Error: 400 ... Extra inputs are not permitted ... context_management - -Claude Code sends beta-only fields such as `context_management` alongside an `anthropic-beta` header that enables them. When a gateway forwards the body but drops the header, the API sees fields it doesn’t recognize. **What to do:** - - * Configure your gateway to forward the `anthropic-beta` header. See [feature pass-through](</docs/en/llm-gateway-protocol#feature-pass-through>) for what gateways must forward. +The endpoint that received the request rejected one of the request’s fields as an input it doesn’t accept, and the endpoint’s message names that field. + + API Error: 400 ... context_management: Extra inputs are not permitted + +Claude Code sends beta-only fields such as `context_management` and tool search’s `defer_loading` alongside an `anthropic-beta` header that enables them. When a gateway forwards the body but drops the header, the API sees fields it doesn’t recognize. When a gateway forwards an Anthropic-format body to an upstream with a different schema, that upstream rejects such fields. [Beta header and body field pairs](</docs/en/llm-gateway-protocol#beta-header-and-body-field-pairs>) covers both cases. **What to do:** + + * If the message contains `context_management: Extra inputs are not permitted`, [update Claude Code](</docs/en/setup#update-claude-code>) to v2.1.304 or later. After you update, Claude Code answers this rejection by sending the request once more without the field. Before v2.1.304, Claude Code didn’t retry this rejection. + * If the message names `defer_loading` or `tool_reference`, update Claude Code or turn [tool search](</docs/en/mcp#tool-search-through-a-gateway>) off: + * [Update Claude Code](</docs/en/setup#update-claude-code>) to v2.1.305 or later. Claude Code then answers this rejection by sending the request once more without tool search fields. + * If you can’t update, or the message still appears after you do, set `ENABLE_TOOL_SEARCH=false` in your shell or your [settings `env`](</docs/en/settings-reference#env>). If a settings file already sets the variable, change it there, since that value [can override a shell export](</docs/en/settings-reference#how-env-values-interact-with-your-shell>). Claude Code then loads MCP tools upfront. + * If your gateway drops the header, configure it to forward the `anthropic-beta` header. See [feature pass-through](</docs/en/llm-gateway-protocol#feature-pass-through>) for what gateways must forward. * As a fallback, set [`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1`](</docs/en/env-vars>) before launching. [Disable pre-release capabilities](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) covers the exact scope. + +Before v2.1.302, this error could also name the field `diagnostics` with no gateway involved. It appeared when a session that had already used the Anthropic API moved to Amazon Bedrock or Google Cloud’s Agent Platform without a restart. For example, a session you left open moves to Bedrock when you run [`/setup-bedrock`](</docs/en/commands>) in another Claude Code window. On those versions, run `/clear` in that session or restart it. ### @@ -2239,6 +2287,7 @@ * Use an alias such as `sonnet` or `opus` instead of a full versioned ID. Aliases resolve to a maintained default so they don’t go stale. See [Model configuration](</docs/en/model-config>). * If the wrong model keeps coming back in the CLI, a stale ID is set somewhere. Check the places you can set a model in [priority order](</docs/en/model-config#setting-your-model>) and remove the stale value. * Claude Code reports an expired claude.ai login as Login expired, not as this error. Before v2.1.206, an expired login that could no longer be refreshed failed every model with this error; run `/login` if you see that on an older version. + * If [`ANTHROPIC_BASE_URL`](</docs/en/env-vars>) points at an [LLM gateway](</docs/en/llm-gateway>) and every model fails this way, check whether your gateway is rejecting the tool search fields Claude Code sends by default. To check, set `ENABLE_TOOL_SEARCH=false` as [Tool search through an LLM gateway](</docs/en/mcp#tool-search-through-a-gateway>) describes, then try again. Before v2.1.304, tool search was off behind a gateway unless you turned it on with `ENABLE_TOOL_SEARCH`. * For Google Cloud’s Agent Platform deployments, see [Google Cloud’s Agent Platform troubleshooting](</docs/en/google-vertex-ai#troubleshooting>). ### @@ -2439,7 +2488,7 @@ Other messages report the same condition: * In an interactive session, a notification reads `Advisor will not activate on the main model (advisor is less capable); subagents may still use it and may use more tokens · /advisor`. - * At launch with the `--advisor` flag, a warning reads `"<advisor>" cannot advise "<main model>" (the advisor must be at least as capable as the main model). The advisor will not be used for the main model.` and the session starts anyway. + * When you launch with the `--advisor` flag in [non-interactive mode](</docs/en/headless>), and the run isn’t a [background session](</docs/en/agent-view>), a warning goes to stderr and the run starts anyway. It reads `"<advisor>" cannot advise "<main model>" (the advisor must be at least as capable as the main model). The advisor will not be used for the main model.` An interactive session writes that warning only to the debug log. **What to do:** @@ -3303,7 +3352,7 @@ Claude Code suggests the closest command name or alias that the menu lists in this session. When nothing is close, the message ends after the name. The cause is usually one of the following: * A typo, such as `/hepl` for `/help`. [How the command menu matches what you type](</docs/en/commands#how-the-command-menu-matches-what-you-type>) covers picking a close match before you submit - * A command that exists but isn’t available in this session because a requirement isn’t met, such as your platform, plan, or authentication method. The troubleshooting entries for [`/web-setup`](</docs/en/web-quickstart#web-setup-shows-no-commands-match-or-unknown-command>) and [`/schedule`](</docs/en/routines#schedule-returns-unknown-command>) walk through two common cases. Some commands answer with their own message when your organization’s policy disables them, such as `Cloud sessions are disabled by your organization's policy` + * A command that exists but isn’t available in this session because a requirement isn’t met, such as your platform, plan, or authentication method. See the entry for [`/web-setup`](</docs/en/web-quickstart#web-setup-shows-no-commands-match-or-unknown-command>), [`/schedule`](</docs/en/routines#schedule-returns-unknown-command>), or [`/auto-mode-setup`](</docs/en/auto-mode-config#auto-mode-setup-returns-unknown-command>). Some commands answer with their own message when your organization’s policy disables them, such as `Cloud sessions are disabled by your organization's policy` * A command from a [plugin](</docs/en/plugins/overview>) or [MCP server](</docs/en/mcp#use-mcp-prompts-as-commands>) that isn’t installed or connected in this session Claude Code answers an unmatched `/` name this way only in an interactive terminal session. In every other session, it sends the prompt to Claude as a normal message instead, with a note that the command didn’t run and a list of commands Claude can run in the session. Those sessions include: @@ -3694,6 +3743,22 @@ * Open the session yourself and run `/recap` there: in its terminal, in the [Desktop app](</docs/en/desktop>) or the [mobile app](</docs/en/mobile>), at [claude.ai/code](<https://claude.ai/code>), or over [Remote Control](</docs/en/remote-control>) * If a cloud scheduled task or another program sent it, remove `/recap` from that prompt + +### + +​ + +/feedback is disabled by your organization’s policy + +This message means your organization’s policy doesn’t allow product feedback from Claude Code, so `/feedback`, `/bug`, and `/share` don’t open the feedback dialog. The message names the command you typed at the Claude Code prompt: + + /feedback is disabled by your organization's policy. To report a bug, open an issue at https://github.com/anthropics/claude-code/issues. Issues are public, so leave out anything confidential. + +The message can also be its first sentence alone. **What to do:** + + * To report a bug, open an issue at [github.com/anthropics/claude-code/issues](<https://github.com/anthropics/claude-code/issues>). Anyone can read issues there, so leave out code, transcripts, and anything else confidential. + +Before v2.1.302, the full message read `/feedback is disabled by your organization's policy. Contact your organization admin to enable it.` ## @@ -3840,7 +3905,7 @@ Path escapes plugin directory -A plugin component path, declared in the plugin’s `plugin.json` or in its [marketplace entry](</docs/en/plugins/marketplace-reference#plugin-entries>), resolves outside the plugin’s own directory. Claude Code drops that path and loads the rest of the plugin. The component name in the message, such as `commands` or `hooks`, names the field that declared the path. +One of the plugin’s component paths leads outside the plugin directory or couldn’t be confirmed inside it, so Claude Code drops that path and loads the rest of the plugin. For a path the plugin declares in `plugin.json` or its [marketplace entry](</docs/en/plugins/marketplace-reference#plugin-entries>), the component name in the message, such as `commands` or `hooks`, names the field that declared the path. commands path escapes plugin directory: ./../shared.md @@ -3848,16 +3913,45 @@ commands path escapes plugin directory: ./commands/deploy.md — it resolves to /home/user/shared/deploy.md, outside the plugin directory +A message that gives the full path of one of a marketplace plugin’s own files, such as `hooks/hooks.json`, means Claude Code skipped that file. That happens when Claude Code can’t confirm the file is inside the plugin or, for a plugin in a [local marketplace](</docs/en/plugins/loading#in-place-and-copied-plugins>), inside that marketplace. The message reports each of these files under the component name shown: + + * `hooks/hooks.json`: `hooks` + * `monitors/monitors.json`: `monitors` + * `settings.json`: `settings` + * `SKILL.md` at the plugin root: `skills` + +For example, this message is for a `hooks/hooks.json` that resolves outside both the plugin and its local marketplace: + + hooks path escapes plugin directory: /home/user/my-marketplace/my-plugin/hooks/hooks.json — it resolves to /home/user/dotfiles/hooks.json, outside the plugin directory and its marketplace directory + On macOS and Linux, Claude Code also rejects a component path that contains a backslash anywhere in it, even when the path stays inside the plugin. A plugin whose component paths use Windows-style separators loads on Windows and triggers this rejection on the other platforms: commands path escapes plugin directory: ./commands\deploy.md — its path contains a backslash, which is not resolved reliably on this platform -Before v2.1.251, Claude Code loaded a `commands` path declared in a marketplace entry even when it pointed outside the plugin directory. Before v2.1.257, the check looked only at the path’s spelling, not at where a symlink leads. **What to do:** - - * Move the referenced file inside the plugin directory and point the path at it with a `./` relative path - * If the path is a symlink to a file outside the plugin, replace the symlink with a copy of the file - * If the message says the path contains a backslash, write the path with forward slashes, for example `./commands/deploy.md` +Before v2.1.251, Claude Code loaded a `commands` path declared in a marketplace entry even when it pointed outside the plugin directory. Before v2.1.257, the check on paths the plugin declares looked only at the path’s spelling, not at where a symlink leads. **What to do:** + + * If you installed the plugin and don’t maintain it, report the message to its author + * For a path the plugin declares, move the referenced file inside the plugin directory and point the path at it with a `./` relative path + * If the path, or a folder above it inside the plugin, is a symlink leading outside the plugin, replace the symlink with a copy of what it points to + * If the message says a path the plugin declares contains a backslash, write the path with forward slashes, for example `./commands/deploy.md` + * If the message ends with `EACCES`, restore your execute permission on every directory leading to the file or folder the path names. Check the directories above the path, then follow each symlink you reach and check the directories leading to where it points. For any other error code, look it up in the causes and steps for a path that couldn’t be checked. * To share files with other plugins in the same marketplace, link them with a symlink inside the plugin directory, following the [symlink rules](</docs/en/plugins/host-marketplace#share-files-within-a-marketplace-with-symlinks>) + +### + +​ + +Plugin not loaded: its manifest was not read + +Claude Code couldn’t confirm that a marketplace plugin’s [manifest](</docs/en/plugins/manifest-reference>) at `.claude-plugin/plugin.json` is inside the plugin, so it loads nothing from that plugin. For a plugin in a [local marketplace](</docs/en/plugins/loading#in-place-and-copied-plugins>), Claude Code also couldn’t confirm that the manifest is inside that marketplace. The message appears in the `/plugin` **Errors** tab, and the reason at its end says what Claude Code found. For example, this message is for a plugin in a local marketplace whose `.claude-plugin` folder is a symlink leading outside the marketplace: + + Plugin not loaded: its manifest /home/user/my-marketplace/my-plugin/.claude-plugin/plugin.json was not read, because it resolves to /home/user/dotfiles/my-plugin/.claude-plugin/plugin.json, outside the plugin directory and its marketplace directory + +**What to do:** + + * If the reason ends with `EACCES`, restore your execute permission on every directory leading to the manifest. Check the directories above the manifest, then follow each symlink you reach and check the directories leading to where it points. For any other error code, look it up in the causes and steps for a path that couldn’t be checked. + * If you maintain the plugin and the reason says where the manifest resolves, the `.claude-plugin` folder or `plugin.json` itself is a symlink that leads there. Replace that link with a copy of what it points to. + * If you installed the plugin and don’t maintain it, report the message to its author ### @@ -4055,6 +4149,26 @@ ​ +File is too large to read as an image + +Claude tried to read a file as an image with the [Read tool](</docs/en/tools-reference#read-tool-behavior>), and the file is larger than 128 MB, the most Read loads from an image file. Nothing was read, and Claude receives this error as the tool result: + + File is too large to read as an image (the limit is 128MB): <path>. If it is an image, resize it or export a smaller copy, then read that. + +When the path is a pipe or a device rather than a regular file, Read stops once more than 128 MB has arrived and returns this error instead: + + Cannot read this as an image: <path> is a pipe or a device, not a regular file, and it sent more than 128MB without ending. + +**What to do:** + + * If Claude followed the `File is too large` message and went on to resize the image or read a smaller copy, do nothing + * If Claude stopped at the error, export a copy under 128 MB yourself, for example at a lower resolution, and point Claude at that file + * If the path was a pipe or a device, point Claude at a regular image file instead + +### + +​ + subagent_type is required subagent_type is required: the general-purpose agent is not available in this session. Available agents: ... @@ -4136,6 +4250,22 @@ * Run `claude` in the folder the [debug log](</docs/en/debug-your-config>) names and accept the trust dialog. The definition is re-applied the next time Claude Code brings the teammate back; you don’t need to restart the lead session * Or set the `hasTrustDialogAccepted` entry to `true` in `~/.claude.json`, using the exact `projects["<path>"]` key the debug log prints + +### + +​ + +Only a teammate can approve a shutdown request + +Claude Code refused an [agent team](</docs/en/agent-teams>) shutdown approval because the session that sent it isn’t running as a teammate. Nothing was sent and nothing shut down. The refusal appears in the sending session’s tool result: + + Only a teammate can approve a shutdown request, and this session is not running as one. Nothing was sent. To shut down a teammate, send that teammate a shutdown_request message. The teammate is the one that approves it. + +**What to do:** + + * If the refusal appeared in your lead session, first check whether the teammate has since shut down. The refusal goes back to Claude with the instruction to send a `shutdown_request` instead, and the turn continues. In an interactive lead session, `<name> has shut down.` appears when the teammate approves a shutdown request. + * If the teammate is still running, ask the lead at its prompt to shut the teammate down, for example `Ask the researcher teammate to shut down`. See [Shut down teammates](</docs/en/agent-teams#shut-down-teammates>). + * If a former teammate you resumed yourself with `claude --resume` got this refusal, nothing was sent. To end that session, run `/exit` at its prompt. ### @@ -4276,7 +4406,11 @@ Disk quota or temp filesystem is full -Claude Code saves each Bash and PowerShell command’s output to a file under its temp directory. When a command exits with a nonzero code and no output at all, Claude Code checks whether the filesystem holding that file is out of space or inodes, or whether your disk quota on it is used up. If so, a diagnostic appears in the command’s result in place of the empty output: +Claude Code saves each Bash and PowerShell command’s output to a file under its temp directory. These messages in a command’s result mean that the filesystem holding that directory, or your disk quota on it, is full. If Claude Code can’t create that file because the filesystem or your quota on it is full, your command doesn’t start, and the result reads: + + The command was not started: this computer's disk is full (ENOSPC), so the file that captures command output could not be created. Nothing ran. If this is the user's own computer, tell them before deleting anything to make room. + +When a command exits with a nonzero code and no output at all, Claude Code checks the filesystem holding the output file. If that filesystem is out of space or inodes, or your disk quota on it is used up, a diagnostic replaces the empty output in the command’s result: Your disk quota is full on the filesystem with Claude Code's temp directory /private/tmp/claude-501/-Users-you-my-project/1f0e62dc-4b0a-4f5e-9c2d-8a7b6c5d4e3f/tasks (EDQUOT), so any output this command printed was lost, and it may have failed because it could not write. Delete files you no longer need there, or restart Claude Code with CLAUDE_CODE_TMPDIR set to a directory on another filesystem. @@ -4285,12 +4419,15 @@ * `Your disk quota is full ... (EDQUOT)`: your own quota on that filesystem is used up. A quota can be full while the filesystem still shows free space * `The filesystem with Claude Code's temp directory ..., or your disk quota on it, is full (ENOSPC)`: the filesystem, or your quota on it, has no space left * `Command output was lost: the temp filesystem at ... is full` or `... is out of inodes`: the filesystem has almost no free space left, or is running out of inodes - -**What to do:** - - * Delete files you no longer need on the filesystem that holds Claude Code’s temp directory. For `EDQUOT`, delete files that count against your own quota. For `out of inodes`, delete many files rather than a few large ones, since each file takes one inode whatever its size + * `The command was not started: this computer's disk is full (ENOSPC)` or `... (EDQUOT)`: the filesystem has no space left for the output file, or with `EDQUOT` your own quota on it is used up + +**What to do:** + + * Delete files you no longer need on the filesystem that holds Claude Code’s temp directory. If your message doesn’t name that directory, look up its default location in the [`CLAUDE_CODE_TMPDIR`](</docs/en/env-vars>) reference. For `EDQUOT`, delete files that count against your own quota. For `out of inodes`, delete many files rather than a few large ones, since each file takes one inode whatever its size * Or restart Claude Code with [`CLAUDE_CODE_TMPDIR`](</docs/en/env-vars>) set to a directory on a filesystem with room - * Then have Claude run the command again. The output it printed was lost, not truncated + * Then have Claude run the command again + +Before v2.1.305, a command that Claude Code couldn’t start because the disk was full returned only the operating system’s error text. That text read, for example, `ENOSPC: no space left on device, open <path>.output`. ### @@ -4355,6 +4492,24 @@ ​ +Not published: Claude sent the same content again after a newer version of the artifact turned it away + +This red line under an Artifact call means Claude Code stopped a repeated publish: the [artifact](</docs/en/artifacts>) wasn’t updated, and nothing was written to the file Claude publishes from. You don’t need to do anything unless Claude stops without publishing. Earlier in the session, Claude Code turned a publish away because the artifact had a newer version, for example one that an [editor](</docs/en/artifacts#let-someone-edit-with-you>) or another of your sessions published. The line’s ending says what Claude has to do next: + + Not published: Claude sent the same content again after a newer version of the artifact turned it away. Claude needs to work from that newer version first. + Not published: Claude sent the same content again after a newer version of the artifact turned it away. The artifact hasn't changed since, so publishing it once more should go through. + Not published: Claude sent its changes again over the same file after a newer version of the artifact turned them away. Claude needs to work from that newer version first. + Not published: Claude sent its changes again over the same file after a newer version of the artifact turned them away. The artifact hasn't changed since, so publishing once more should go through. + +**What to do:** + + * **Ends with`Claude needs to work from that newer version first`**: if Claude stopped there, ask it to fetch the artifact’s current version, merge its changes in, and publish again + * **Ends with`should go through`**: if Claude stopped there, ask it to publish again + +### + +​ + Reading a local file from outside the connected folders in a Cowork session In a [Cowork](<https://claude.com/docs/cowork/overview>) session running on your machine in the Claude Desktop app, Claude named a local file for an [artifact](</docs/en/artifacts>). Claude Code couldn’t confirm the file is a plain file inside the session’s connected folders: the path sits outside those folders, passes through a symbolic link, or is spelled in a way that can name a different file than it appears to. Reading such a file needs your approval, and in a session that can’t show you the approval card, such as one set to skip all approvals, Claude Code refuses the read. The refusal appears in the Artifact tool result; when the file couldn’t be examined at all, it names that failure instead: @@ -4633,6 +4788,24 @@ * To continue the loop, [reply to the session](</docs/en/agent-view#peek-and-reply>) and say so, such as `keep the loop running`. Claude reads the notice with your reply and can schedule the next wakeup * If you’re done with the loop, do nothing. It has already stopped + +### + +​ + +No LLM gateway: a gateway set in your shell isn’t passed to a session opened from another folder + +The [background session](</docs/en/agent-view>) showing this message isn’t using your [LLM gateway](</docs/en/llm-gateway>): it didn’t get the gateway’s address, so its requests fail. The message appears in the conversation in place of Claude’s reply, with your session’s ID and folder filled in: + + No LLM gateway: a gateway set in your shell isn't passed to a session opened from another folder. To fix, run `claude respawn abc12345` from ~/project in another terminal where your gateway is set, or set ANTHROPIC_BASE_URL and its API key or token in a settings file's env block. + +While you’re attached to the session, the notice under its prompt shows the short form `No LLM gateway: opened from another folder · respawn from ~/project`. You dispatched, woke, or restarted the session from a folder other than the one the message names, while `ANTHROPIC_BASE_URL` was set to your gateway. For the cases where a shell-exported gateway does reach a background session, see [LLM gateway](</docs/en/agent-view#llm-gateway>). **What to do:** + + * **You used agent view in a project whose settings set the gateway** : put `ANTHROPIC_BASE_URL` and its API key or token in [a settings file’s `env` block](</docs/en/llm-gateway-connect#set-in-a-settings-file>). Use `~/.claude/settings.json`, or `.claude/settings.local.json` in the session’s own project, both of which a respawned session reads. Then run `claude respawn <id>` in your shell from any folder. + * **You exported the gateway in your terminal** : in a terminal where you’ve exported the gateway variables, `cd` to the folder the message names and run the message’s `claude respawn <id>` command. The session restarts from its saved conversation. + * The gateway reaches the session only when the [supervisor](</docs/en/agent-view#the-supervisor-process>) was itself started from a shell that exported the same gateway. If the supervisor wasn’t, restart it from that terminal as [Dispatch fails with `Could not resolve authentication method`](</docs/en/agent-view#dispatch-fails-with-could-not-resolve-authentication-method>) describes, then run the respawn command again. + +Before v2.1.302, a background session in this situation showed a sign-in error such as `Not logged in · Please run /login` instead, without naming the folder. ### @@ -4912,7 +5085,12 @@ Configuration warnings -Claude Code writes most of these messages to stderr, not into the conversation, and writes most of them at startup. An entry says so when its message appears somewhere else, such as in the debug log or as a startup notice in the conversation view, or at another time, such as the unrecognized-model diagnostic line at request time. +To find a warning that Claude Code gave at startup in an interactive session, look below the startup banner first, then in the debug log: + + * **Row below the startup banner** : some warnings about [permission rules](</docs/en/permissions>), such as `⚠ Deny rule Bsh matches no tool · check for typos` + * **Debug log** : Claude Code keeps this log only in debug mode. To read the warnings in it, start Claude Code from your shell with `claude --debug-file <path>`, then open the file at that path. + +In [non-interactive mode](</docs/en/headless>) with text output, outside a [background session](</docs/en/agent-view>), look for startup warnings on stderr. Before v2.1.305, look on stderr in an interactive session as well, including for the permission-rule warnings that now show as rows below the banner. ### @@ -5042,11 +5220,11 @@ Working directory is a network path -Claude Code doesn’t add network paths as working directories. Looking up a network path can contact the host it names, and on Windows that contact can send the host your credentials, so Claude Code refuses the path without looking it up. You see this message when you run `/add-dir` with such a path, or as a warning at startup. When it appears at startup, Claude Code starts without that directory. +Claude Code doesn’t add network paths as working directories. Looking up a network path can contact the host it names, and on Windows that contact can send the host your credentials. Claude Code therefore refuses the path without looking it up. You see this message when you run `/add-dir` with a network path: \\server\share is a network path, which cannot be added as a working directory. On Windows, map the share to a drive letter and pass it at launch with --add-dir (a drive letter added mid-session does not yet carry remote-read trust). -Paths that Claude Code refuses this way include: +When you pass one at startup instead, with `--add-dir` or in `permissions.additionalDirectories`, Claude Code starts without that directory. In an interactive session you don’t see the message at startup, because it goes to the debug log with the other startup warnings. Paths that Claude Code refuses this way include: * UNC shares such as `\\server\share` * Automount paths such as `/net/<host>`, unless you launched Claude Code from a directory under that host’s automount. Reads under that automount still go through the [network path check](</docs/en/permissions#network-paths>). @@ -5287,21 +5465,52 @@ ​ +Matches no tool · check for typos + +This row below the startup banner names a deny or ask [permission rule](</docs/en/permissions>) whose tool name Claude Code doesn’t recognize, so the rule doesn’t apply to the tool you meant. A deny rule written as `Bsh` isn’t applied to Bash, and neither is one that uses the label a tool shows in the transcript instead of its canonical name. The row repeats the rule as you wrote it: + + ⚠ Deny rule Bsh matches no tool · check for typos + +In [non-interactive mode](</docs/en/headless>) with text output, Claude Code prints the warning on stderr in its longer form instead: + + Permission deny rule "Bsh" matches no known tool — check for typos. + +**What to do:** + + * Correct the tool name in the rule, for example `Bash` in place of `Bsh`. Look up canonical names in the [tools reference](</docs/en/tools-reference>). + * To find where the rule is defined, run `/permissions` in the session and select the rule. Its details say where it comes from, such as `From project local settings`, or `From CLI argument` for a `--disallowedTools` value. + * If the details read `From enterprise managed settings`, forward the row to whoever maintains your [managed settings](</docs/en/managed-settings>), since you can’t change that rule yourself. + +In a [background session](</docs/en/agent-view>) or with `--output-format json` or `stream-json`, Claude Code writes the warning to the debug log instead of stderr. Run with `--debug` to capture it at `~/.claude/debug/<session-id>.txt`. Before v2.1.305, an interactive session printed the longer form on stderr at startup instead of showing the row. + +### + +​ + Is not matched by file permission checks -Claude Code found a `Write`, `NotebookEdit`, `MultiEdit`, or `Glob` [permission rule](</docs/en/permissions#read-and-edit>) with a path in one of your [settings files](</docs/en/settings#where-settings-live>), in [managed settings](</docs/en/managed-settings>), or in a `--allowedTools`, `--disallowedTools`, or `--settings` flag value. It checks file permissions against `Edit` and `Read` rules only, so it never consults a path rule that names one of the other file tools. It keeps the rule and changes nothing else; the warning names the rule, its source in parentheses, and the replacement to write: - - Permission deny rule (.claude/settings.json): Write(docs/**) is not matched by file permission checks — only Edit(path) rules are. Use Edit(docs/**) instead (Edit rules cover all file-editing tools). +Claude Code found a `Write`, `NotebookEdit`, `MultiEdit`, or `Glob` [permission rule](</docs/en/permissions#read-and-edit>) with a path in one of your [settings files](</docs/en/settings#where-settings-live>), in [managed settings](</docs/en/managed-settings>), or in a `--allowedTools`, `--disallowedTools`, or `--settings` flag value. It checks file permissions against `Edit` and `Read` rules only, so it never consults a path rule that names one of the other file tools. It keeps the rule and changes nothing else. + + * **Interactive session** : the full warning goes to the debug log, and a deny or ask rule of this shape also shows as this row below the startup banner: + + ⚠ Deny rule Write(docs/**) never matches · use Edit(docs/**) + +An allow rule of this shape gets no row. To find where the rule is defined, run `/permissions` in the session and select the rule. + * **[Non-interactive mode](</docs/en/headless>) with text output**: the full warning on stderr names the rule, its source in parentheses, and the replacement to write: + + Permission deny rule (.claude/settings.json): Write(docs/**) is not matched by file permission checks — only Edit(path) rules are. Use Edit(docs/**) instead (Edit rules cover all file-editing tools). + + * **[Background session](</docs/en/agent-view>), or `--output-format json` or `stream-json`**: the full warning goes to the debug log instead of stderr, so machine-read output stays clean. Run with `--debug` to capture it at `~/.claude/debug/<session-id>.txt`. **What to do:** * Replace `Write(path)`, `NotebookEdit(path)`, and legacy `MultiEdit(path)` rules with `Edit(path)`. `Edit` rules cover all file-editing tools. * Except in `--allowedTools`, where Claude Code accepts a `Glob` rule without warning, replace `Glob(path)` rules with `Read(path)`. - * Fix the rule at the source the warning names in parentheses: a settings file path, or the flag itself for `--allowed-tools` and `--disallowed-tools`. A `claude-settings-<hash>.json` path that doesn’t exist on disk stands for an inline `--settings` value. Fix the JSON you pass to that flag. + * Fix the rule at its source, which the full warning names in parentheses: a settings file path, or the flag itself for `--allowed-tools` and `--disallowed-tools`. A `claude-settings-<hash>.json` path that doesn’t exist on disk stands for an inline `--settings` value. Fix the JSON you pass to that flag. * Leave bare tool-name rules such as `Write` or `Glob` alone. Claude Code matches them at the [tool level](</docs/en/permissions#match-all-uses-of-a-tool>) and doesn’t warn about them. - * If the source reads `managed policy settings`, forward the warning to whoever maintains your managed settings, since you can’t clear it yourself. - -In a [background session](</docs/en/agent-view>) or with `--output-format json` or `stream-json`, Claude Code writes the warning to the debug log instead of stderr, so machine-read output stays clean. Run with `--debug` to capture it at `~/.claude/debug/<session-id>.txt`. Before v2.1.210, Claude Code accepted these rules without a warning. + * For a rule from managed settings, the full warning’s parentheses read `managed policy settings` and the rule’s details in `/permissions` read `From enterprise managed settings`. Forward that warning to whoever maintains your managed settings, since you can’t clear it yourself. + +Before v2.1.210, Claude Code accepted these rules without a warning. Before v2.1.305, an interactive session printed the full warning on stderr. ### @@ -5309,18 +5518,22 @@ Has a wildcard before the rest of the command -Claude Code found a `Bash` allow rule whose `*` comes before a later word that determines which command it is, such as `Bash(git * main)` or `Bash(git -C * status *)`, in one of your [settings files](</docs/en/settings#where-settings-live>), in [managed settings](</docs/en/managed-settings>), or in an `--allowedTools` or `--settings` flag value. The `*` matches any text, including options inserted at that position: `Bash(git * main)` also approves `git -c core.fsmonitor=<script> diff main`, where `-c` makes git run a program the command names. [Wildcard patterns](</docs/en/permissions#wildcard-patterns>) shows the matching rules. The warning exists so you can narrow a rule whose wildcard is broader than you intended. Claude Code keeps the rule and changes nothing about how it matches; the warning names the rule and its source in parentheses: +Claude Code found a `Bash` allow rule whose `*` comes before a later word that determines which command it is, such as `Bash(git * main)` or `Bash(git -C * status *)`, in one of your [settings files](</docs/en/settings#where-settings-live>), in [managed settings](</docs/en/managed-settings>), or in an `--allowedTools` or `--settings` flag value. The `*` matches any text, including options inserted at that position: `Bash(git * main)` also approves `git -c core.fsmonitor=<script> diff main`, where `-c` makes git run a program the command names. [Wildcard patterns](</docs/en/permissions#wildcard-patterns>) shows the matching rules. The warning exists so you can narrow a rule whose wildcard is broader than you intended. Claude Code keeps the rule and changes nothing about how it matches. In [non-interactive mode](</docs/en/headless>) with text output, the warning on stderr names the rule and its source in parentheses: Permission allow rule (.claude/settings.json): Bash(git -C * status *) has a wildcard before the rest of the command, so it also matches any options inserted at that position and approves them without a prompt. For git, options such as -c and --exec-path can run arbitrary commands. Replace that * with the exact value you mean, or only use * after the subcommand (for example Bash(git status *)). -**What to do:** +In an interactive session, the full warning goes to the debug log and the rule shows as this row below the startup banner: + + ⚠ Allow rule Bash(git -C * status *) allows any option at its * · use an exact value + +To find where the rule is defined, run `/permissions` in the session and select the rule. **What to do:** * Replace the `*` before the subcommand with the exact value you mean: `Bash(git checkout main)` in place of `Bash(git * main)`. * Move every `*` after the subcommand: `Bash(git status *)` in place of `Bash(git -C * status *)`. Write one rule per subcommand you want to allow. - * Fix the rule at the source the warning names in parentheses: a settings file path, or the `--allowed-tools` flag itself. A `claude-settings-<hash>.json` path that doesn’t exist on disk stands for an inline `--settings` value. Fix the JSON you pass to that flag. - * If the source reads `managed policy settings`, forward the warning to whoever maintains your managed settings, since you can’t clear it yourself. - -In a [background session](</docs/en/agent-view>) or with `--output-format json` or `stream-json`, Claude Code writes the warning to the debug log instead of stderr, so machine-read output stays clean. Run with `--debug` to capture it at `~/.claude/debug/<session-id>.txt`. Before v2.1.246, Claude Code accepted these rules without a warning. + * Fix the rule at its source, which the full warning names in parentheses: a settings file path, or the `--allowed-tools` flag itself. A `claude-settings-<hash>.json` path that doesn’t exist on disk stands for an inline `--settings` value. Fix the JSON you pass to that flag. + * For a rule from managed settings, the full warning’s parentheses read `managed policy settings` and the rule’s details in `/permissions` read `From enterprise managed settings`. Forward that warning to whoever maintains your managed settings, since you can’t clear it yourself. + +In a [background session](</docs/en/agent-view>) or with `--output-format json` or `stream-json`, Claude Code writes the warning to the debug log instead of stderr, so machine-read output stays clean. Run with `--debug` to capture it at `~/.claude/debug/<session-id>.txt`. Before v2.1.246, Claude Code accepted these rules without a warning. Before v2.1.305, an interactive session printed the full warning on stderr instead of showing a row. ### @@ -5328,7 +5541,7 @@ Denying Bash also turns off the PowerShell tool -You removed the whole Bash tool, for example with `--disallowedTools Bash` or with a bare `Bash` or `Bash(*)` [deny rule](</docs/en/permissions#match-all-uses-of-a-tool>) in one of your settings files. On Windows with Git Bash installed, [denying Bash also turns the PowerShell tool off](</docs/en/tools-reference#bash-deny-rules-also-turn-off-the-powershell-tool>), so the session starts with no shell tool. Claude Code prints this warning at startup: +You removed the whole Bash tool, for example with `--disallowedTools Bash` or with a bare `Bash` or `Bash(*)` [deny rule](</docs/en/permissions#match-all-uses-of-a-tool>) in one of your settings files. On Windows with Git Bash installed, [denying Bash also turns the PowerShell tool off](</docs/en/tools-reference#bash-deny-rules-also-turn-off-the-powershell-tool>), so the session starts with no shell tool. In [non-interactive mode](</docs/en/headless>) with text output, Claude Code prints this warning on stderr at startup, and an interactive session writes it only to the debug log: Denying Bash also turns off the PowerShell tool, so Claude has neither. To use PowerShell, set CLAUDE_CODE_USE_POWERSHELL_TOOL=1. @@ -5337,7 +5550,7 @@ * To have Claude use PowerShell, set [`CLAUDE_CODE_USE_POWERSHELL_TOOL`](</docs/en/env-vars>) to `1` in your environment or in the `env` block of a settings file, as [Enable the PowerShell tool](</docs/en/tools-reference#enable-the-powershell-tool>) shows. The PowerShell tool then stays on alongside your Bash deny rule. * To block particular commands instead of the whole tool, replace the bare `Bash` entry with scoped rules such as `Bash(git push *)` in the same settings file or flag. Claude keeps the Bash tool, and the PowerShell tool stays off until you also set the variable or add a scoped [`PowerShell` permission rule](</docs/en/permissions#powershell>). -In a [background session](</docs/en/agent-view>) or with `--output-format json` or `stream-json`, Claude Code writes the warning to the debug log instead of stderr. Run with `--debug` to capture it at `~/.claude/debug/<session-id>.txt`. Before v2.1.287, Claude Code turned the PowerShell tool off the same way without printing a warning. +In a [background session](</docs/en/agent-view>) or with `--output-format json` or `stream-json`, Claude Code writes the warning to the debug log instead of stderr. Run with `--debug` to capture it at `~/.claude/debug/<session-id>.txt`. Before v2.1.287, Claude Code turned the PowerShell tool off the same way without printing a warning. Before v2.1.305, an interactive session printed the warning on stderr at startup too. ### @@ -5392,7 +5605,7 @@ * If the message names a model ID this version doesn’t recognize, run `claude update`. A version that recognizes the ID as a 1M-context model enforces the limit without further configuration. * If you want the session to use the model’s full window instead, unset `CLAUDE_CODE_DISABLE_1M_CONTEXT`; the warning reports only that the 200K limit isn’t enforced -In a [background session](</docs/en/agent-view>) or with `--output-format json` or `stream-json`, Claude Code writes the warning to the debug log instead of stderr. +In [non-interactive mode](</docs/en/headless>) with text output, this warning appears on stderr. In an interactive session, a [background session](</docs/en/agent-view>), or with `--output-format json` or `stream-json`, it goes to the debug log instead. Run with `--debug` to capture it at `~/.claude/debug/<session-id>.txt`. Before v2.1.305, an interactive session printed the warning on stderr at startup. ### @@ -5500,6 +5713,7 @@ If an error is not listed here or the suggested fix does not help: * Run `/feedback` inside Claude Code to send the transcript and a description to Anthropic. The command also offers to open a prefilled GitHub issue. Sending to Anthropic requires [authentication](</docs/en/authentication>). On Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and other third-party providers, or when no Anthropic credentials are configured, `/feedback` saves a local archive you can send to your Anthropic account representative instead. + * If `/feedback` answers that it’s disabled by your organization’s policy, see that message’s entry * Run `claude doctor` from your shell for a read-only diagnostic of your installation, or run the `/doctor` checkup inside Claude Code to find and fix setup problems * Check [status.claude.com](<https://status.claude.com>) for active incidents * Search [existing issues](<https://github.com/anthropics/claude-code/issues>) on GitHub
modified React to events with a mod View current →
--- a/events.md +++ b/events.md @@ -175,10 +175,17 @@ Approve or refuse a tool call before the user is asked -To decide whether a tool call may run, handle [`tool.check`](</docs/en/plugins/mods/reference#tools>), the event where Claude Code makes that decision. It fires after the permission rules and the settings hooks have decided, and `next(e)` resolves to their decision: `allow`, `ask`, or `deny`. Your hook returns that decision or a different one. `e.input` holds the tool’s arguments, such as `command` for Bash. For a fixed command or path, use a [permission rule](</docs/en/permissions#permission-rule-syntax>) such as `Bash(npm test)`, which takes no code. Handle `tool.check` when the decision depends on what’s true at that moment, such as the current Git branch or a value another hook recorded. This hook refuses `git push` while the current branch is `main`: +To decide whether a tool call may run, handle [`tool.check`](</docs/en/plugins/mods/reference#tools>), the event where Claude Code makes that decision. For a fixed command or path, use a [permission rule](</docs/en/permissions#permission-rule-syntax>) such as `Bash(npm test)`, which takes no code. Handle `tool.check` when the decision depends on what’s true at that moment, such as the current Git branch or a value another hook recorded. + + * **What to return** : to decide the call yourself, return an object of your own, such as `{ decision: 'allow' }` or `{ decision: 'deny', reason }`. To leave the decision alone, return what `await next(e)` gives you. + * **What`await next(e)` gives you**: Claude Code’s own decision, as an object whose `decision` is `allow`, `ask`, or `deny`. No permission prompt appears while `next(e)` runs. + * **Arguments** : `e.input` holds the tool’s arguments, such as `command` for Bash + * **When`tool.check` fires**: after the [`PreToolUse` hooks](</docs/en/hooks#pretooluse>) run, and before the permission prompt, [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>)’s classifier, or a [`PermissionRequest`](</docs/en/hooks#permissionrequest>) hook + +This hook refuses `git push` while the current branch is `main`: on('tool.check', { tool: 'Bash' }, async ($, e, next) => { - // What the permission rules and settings hooks decided: 'allow', 'ask', or 'deny' + // Claude Code's own decision const decided = await next(e) if (!e.input.command.includes('git push')) return decided const branch = await $.process.run(['git', 'branch', '--show-current']) @@ -194,6 +201,37 @@ The hook matches the text of the command, so treat it as a reminder for Claude. To block pushes to `main` for everyone, protect the branch on your Git host. A `tool.check` hook can also return `allow` or `ask`. In [plan mode](</docs/en/permissions#hook-approvals-in-plan-mode>), for a call that isn’t read-only, such as a file edit, your hook can tighten the decision `next(e)` returns but can’t loosen it. For the permission rules and `PreToolUse` hook decisions your hook’s `allow` can’t replace, see [Extend permissions with hooks](</docs/en/permissions#precedence-among-rules-hooks-and-mods>). + +#### + +​ + +Check whether a tool call is read-only + +In a `tool.check` hook, `e.isReadOnly` is `true` when the tool reports the call as read-only. Otherwise the field is absent, not `false`. `e.isReadOnly` requires Claude Code v2.1.304 or later. Some tools, such as Read, Grep, Glob, and WebSearch, report every call as read-only. Bash and MCP tools report a call as read-only in these cases: + + * **Bash** : the command passes Claude Code’s built-in [read-only command check](</docs/en/permissions#read-only-commands>) + * **An MCP tool** : the server sets the tool’s `readOnlyHint` annotation to `true` + +The value is the tool’s own report, so don’t approve a call on this field alone. For example, WebFetch and Agent calls report as read-only, though [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) requests a URL and [Agent](</docs/en/tools-reference#agent-tool-behavior>) starts a subagent that runs tools of its own. This hook returns an `ask` for every `mcp__github__` call that isn’t read-only and wasn’t already denied: + + on('tool.check', { tool: /^mcp__github__/ }, async ($, e, next) => { + const decided = await next(e) + // Read-only calls and denied calls pass through unchanged + if (e.isReadOnly || decided.decision === 'deny') return decided + return { decision: 'ask', reason: 'This tool can change the GitHub repository' } + }) + +#### + +​ + +Filter a `tool.check` hook by whether the call is read-only + +To limit which calls your hook handles by `e.isReadOnly`, use the matcher for read-only calls and the hook body for the rest: + + * **Read-only calls only** : add `isReadOnly: true` to the matcher, as in `on('tool.check', { tool: 'Bash', isReadOnly: true }, hook)` + * **Calls that aren’t read-only** : test `e.isReadOnly` in the hook body, as the `mcp__github__` example does. If you put `isReadOnly: false` in a matcher, your hook never runs. ### @@ -304,7 +342,7 @@ * **`PreToolUse` hooks from managed settings**: run before the first mod’s `tool.call` hook. When a managed hook blocks the call, no mod’s `tool.call` hook runs for that call. * **`PreToolUse` hooks from every other settings file and from plugins’ `hooks/hooks.json`**: run after the last mod calls `next`, as part of Claude Code’s own behavior. A mod that answers `tool.call` without calling `next` keeps them from running, and a mod that calls `next` sees their decision in the result it returns. -`tool.check` fires after the permission rules and both groups of `PreToolUse` hooks have decided. To learn which of those decisions a `tool.check` hook’s `allow` can’t replace, see [Extend permissions with hooks](</docs/en/permissions#precedence-among-rules-hooks-and-mods>). +`tool.check` fires after the `PreToolUse` hooks have run. For the permission rules and `PreToolUse` hook decisions a `tool.check` hook’s `allow` can’t replace, see [Extend permissions with hooks](</docs/en/permissions#precedence-among-rules-hooks-and-mods>). ###
modified Examples View current →
--- a/examples.md +++ b/examples.md @@ -23,6 +23,14 @@ ​ +Fork a complete project + +To build a shopping agent or a merchant agent with the Python SDK, start from the [Claude for commerce reference implementation](<https://platform.claude.com/docs/en/about-claude/use-case-guides/commerce-agents>). + +## + +​ + Work through a Python recipe The Claude Cookbook’s Agent SDK series is a sequence of recipes, each a Python notebook, that progresses from a simple research agent to sophisticated multi-agent systems. Each notebook builds on the previous one, introducing new concepts and capabilities. Start with [the one-liner research agent](<https://platform.claude.com/cookbook/claude-agent-sdk-00-the-one-liner-research-agent>) and work forward. For recipes across Claude products, see the full [Claude Cookbook](<https://platform.claude.com/cookbook>).
modified Feature availability View current →
--- a/feature-availability.md +++ b/feature-availability.md @@ -32,7 +32,7 @@ These have provider-specific differences: - * **MCP servers** : [connectors from claude.ai](</docs/en/mcp#use-mcp-servers-from-claude-ai>) load only when your claude.ai subscription is the active authentication method. [Tool search](</docs/en/mcp#configure-tool-search>) is off by default when `ANTHROPIC_BASE_URL` points to a non-first-party host, and isn’t supported on Google Cloud’s Agent Platform models earlier than Claude Opus 4.5, Claude Sonnet 4.5, and Claude Haiku 4.5 or on Microsoft Foundry [deployments hosted on Azure](<https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#hosting-options>) + * **MCP servers** : [connectors from claude.ai](</docs/en/mcp#use-mcp-servers-from-claude-ai>) load only when your claude.ai subscription is the active authentication method. [Tool search](</docs/en/mcp#configure-tool-search>) isn’t supported on Microsoft Foundry [deployments hosted on Azure](<https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#hosting-options>). On Google Cloud’s Agent Platform, tool search isn’t supported on models earlier than Claude Opus 4.5, Claude Sonnet 4.5, and Claude Haiku 4.5 * **Subagents** : when the main conversation runs Fable, the built-in [Explore subagent](</docs/en/sub-agents#built-in-subagents>) runs on Opus with a Claude subscription, an Anthropic Console account, or an [LLM gateway](</docs/en/llm-gateway>) reached through `ANTHROPIC_BASE_URL`. On other providers, including Claude Platform on AWS, it runs on Fable * **[Commands](</docs/en/commands#all-commands>)** : * `/design-sync` and `/import` with its `claude import` subcommand form are unavailable on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and Claude Platform on AWS, and through a [Claude apps gateway](</docs/en/claude-apps-gateway#availability-and-limitations>) @@ -59,7 +59,7 @@ * [Artifacts](</docs/en/artifacts>): Pro, Max, Team, and Enterprise plans * [Voice dictation](</docs/en/voice-dictation>) -Desktop is the partial exception: [gateway routing can be configured in the app or by an administrator](</docs/en/llm-gateway-connect#desktop-app>), Enterprise deployments can route Desktop to Google Cloud’s Agent Platform or a gateway provider via [managed settings](<https://claude.com/docs/third-party/claude-desktop/configuration>), and [Claude Desktop on 3P](<https://claude.com/docs/third-party/claude-desktop/overview>) runs the Code tab on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or a self-hosted LLM gateway. For per-plan availability of these features, see Availability by subscription plan. +Desktop is the partial exception: [gateway routing can be configured in the app or by an administrator](</docs/en/llm-gateway-connect#desktop-app>). [Claude Desktop on 3P](<https://claude.com/docs/third-party/claude-desktop/overview>) also runs the Code tab on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or a self-hosted LLM gateway. It also runs the Code tab on the [Claude API](<https://claude.com/docs/third-party/claude-desktop/claude-api>) with an Anthropic Console API key. For per-plan availability of these features, see Availability by subscription plan. ### @@ -149,7 +149,9 @@ **Alternatives:** for scheduling, use [`/loop`](</docs/en/scheduled-tasks>) instead of `/schedule`. For cloud sessions, use [GitHub Actions](</docs/en/github-actions>). -**Not available:** all features that require a Claude subscription.Everything in CLI capabilities that vary by provider is available, except that [fast mode](</docs/en/fast-mode>) requires [provisioned access](</docs/en/fast-mode#enable-fast-mode-for-your-organization>). [Server-managed settings](</docs/en/server-managed-settings>) that you configure in a claude.ai Team or Enterprise organization don’t reach a session that authenticates with a Console API key. See [Platform availability](</docs/en/server-managed-settings#platform-availability>) for how to cover those sessions. +**Not available:** all features that require a Claude subscription.Everything in CLI capabilities that vary by provider is available, except that [fast mode](</docs/en/fast-mode>) requires [provisioned access](</docs/en/fast-mode#enable-fast-mode-for-your-organization>). [Server-managed settings](</docs/en/server-managed-settings>) that you configure in a claude.ai Team or Enterprise organization don’t reach a session that authenticates with a Console API key. See [Platform availability](</docs/en/server-managed-settings#platform-availability>) for how to cover those sessions.**Partial support:** + + * [Desktop](</docs/en/desktop>): via [Claude Desktop on 3P with the Claude API](<https://claude.com/docs/third-party/claude-desktop/claude-api>) ##
modified Interface gallery for mods View current →
--- a/gallery.md +++ b/gallery.md @@ -347,13 +347,20 @@ `Image` and `Client` -Two more elements have no sample here. `Image` draws a PNG or raw pixels in the terminal. `Client` is a region that a second file of yours draws, for animation and pointer input. The [elements reference](</docs/en/plugins/mods/reference#elements>) lists their props. Unless Claude Code detects that the terminal draws kitty graphics protocol images with Unicode placeholders, the user sees an `Image`’s `alt` text, dimmed, in place of the picture. Write `alt` text that stands on its own. Detection runs at startup: it succeeds in kitty 0.28 or later and in Ghostty, once the terminal answers Claude Code’s graphics query, and fails in these cases: - - * **Other terminals** : any terminal that isn’t one of those two, or that doesn’t answer the query. - * **tmux and screen** : a session running inside tmux or screen, in any terminal, kitty and Ghostty included. +Two more elements have no sample here. `Image` draws a PNG or raw pixels in the terminal. `Client` is a region that a second file of yours draws, for animation and pointer input. The [elements reference](</docs/en/plugins/mods/reference#elements>) lists their props. An `Image` draws as a picture in these terminals: + + * kitty 0.28 or later + * Ghostty + * iTerm2 3.5 or later. Drawing in iTerm2 requires Claude Code v2.1.305 or later. + +In any other terminal, the user sees the `Image`’s `alt` text, dimmed, in place of the picture. Write `alt` text that stands on its own, because it also shows in these cases, among others: + + * **tmux and screen** : a session running inside tmux or screen, in any terminal. * **Background sessions** : every [background session](</docs/en/agent-view>), whatever terminal it’s attached from. - -If your mod’s users see the dimmed text in a terminal that does draw those placeholder images, they can set [`CLAUDE_CODE_FORCE_TERMINAL_IMAGES`](</docs/en/env-vars>) to `1`, which skips detection. Inside tmux or screen that doesn’t help: the `alt` text goes away, and Claude Code sends the picture without wrapping it for tmux or screen passthrough. + * **iTerm2 outside fullscreen rendering** : in iTerm2 the picture draws only under [fullscreen rendering](</docs/en/fullscreen>), and not while [`CLAUDE_CODE_ALT_SCREEN_FULL_REPAINT`](</docs/en/env-vars>) is set to `1`. To see the picture, run `/tui fullscreen` at the Claude Code prompt and leave that variable unset. + * **A file path source in iTerm2** : iTerm2 draws an `Image` whose `source` prop holds `png` or `rgba` bytes, and shows the `alt` text for one whose `source` names a `file`. If your mod has iTerm2 users, pass the picture as base64 in `source.png` or `source.rgba` rather than as a path in `source.file`. + +If your mod’s users see the dimmed text in a terminal that draws kitty graphics protocol images with Unicode placeholders, they can set [`CLAUDE_CODE_FORCE_TERMINAL_IMAGES`](</docs/en/env-vars>) to `1`. Inside tmux or screen that doesn’t help: the `alt` text goes away, and Claude Code sends the picture without wrapping it for tmux or screen passthrough. ##
modified Run Claude Code programmatically View current →
--- a/headless.md +++ b/headless.md @@ -150,7 +150,7 @@ --output-format json \ --json-schema '{"type":"object","properties":{"functions":{"type":"array","items":{"type":"string"}}},"required":["functions"]}' -If the value isn’t a valid JSON Schema, `claude` exits with `Error: --json-schema is not a valid JSON Schema` followed by the validator’s diagnostic. Claude Code accepts schemas that use the `format` keyword, such as `"format": "email"`, but treats `format` as an annotation and doesn’t enforce it. +If the value isn’t a valid JSON Schema, `claude` exits with `Error: --json-schema is not a valid JSON Schema` followed by the validator’s diagnostic. Claude Code accepts schemas that use the `format` keyword, such as `"format": "email"`, but treats `format` as an annotation and doesn’t enforce it. If a run ends without valid structured output, for example because Claude declined the request, the response has no `structured_output` field. Before your script uses `structured_output`, check that the field is present. Use a tool like [jq](<https://jqlang.org/>) to parse the response and extract specific fields:
modified Set up Claude Code (local mode) for a HIPAA-ready organization View current →
--- a/hipaa-setup.md +++ b/hipaa-setup.md @@ -95,6 +95,7 @@ ---|--- `api.anthropic.com`| Claude API requests, telemetry, and the organization policy that tells Claude Code the HIPAA configuration is on `claude.ai`, `claude.com`, `platform.claude.com`| Sign-in and token refresh +`sso.claude.com`| Sign-in, when your organization uses single sign-on `downloads.claude.ai`| The native installer and its updates `mcp-proxy.anthropic.com`| [Connectors from claude.ai](</docs/en/mcp#use-mcp-servers-from-claude-ai>)
modified Intercept and control agent behavior with hooks View current →
--- a/hooks.md +++ b/hooks.md @@ -688,6 +688,7 @@ * [`permission_prompt`](</docs/en/hooks#notification>) once a permission request has waited about six seconds on your [`canUseTool` callback](</docs/en/agent-sdk/user-input>). Requires TypeScript Agent SDK v0.3.233 or later, or Python Agent SDK v0.2.139 or later * `elicitation_complete` and `elicitation_response` for user-prompt elicitation flows + * `plugin_notification` when a [mod](</docs/en/plugins/mods/api#show-something-without-starting-a-turn>) calls `$.ui.notify` Claude Code emits the other types, such as `idle_prompt`, `auth_success`, and `elicitation_dialog`, from interactive UI that SDK sessions don’t run. Each notification includes a `message` field with a human-readable description and optionally a `title`. This example forwards every notification to a Slack channel. It requires a [Slack incoming webhook URL](<https://docs.slack.dev/messaging/sending-messages-using-incoming-webhooks/>), which you create by adding an app to your Slack workspace and enabling incoming webhooks:
modified Automate actions with hooks View current →
--- a/hooks-guide.md +++ b/hooks-guide.md @@ -171,6 +171,7 @@ `quota_auto_resume_fired`| Claude Code continues your task after a claude.ai usage limit paused it: at the reset, or sooner when something you do in Claude Code during the wait, such as adding usage credits, upgrading your plan, or switching models, makes usage available again, with the [model-setting exception](</docs/en/interactive-mode#wait-for-a-usage-limit-to-reset>) `quota_auto_resume_stale`| A claude.ai usage limit reset while your computer slept for more than about 30 minutes. Claude Code waits for you to press `Enter` instead of continuing. After a shorter sleep it continues and fires `quota_auto_resume_fired` instead `quota_auto_resume_disabled`| Claude Code ends its wait for a claude.ai usage limit without continuing your task: [`autoContinueAtUsageLimit`](</docs/en/settings-reference#autocontinueatusagelimit>) turned off or the reset moved more than 24 hours away during a wait Claude Code started on its own, the continued task kept hitting the limit, or the continuation was blocked before it reached the model. Doesn’t fire when you press `Esc` or `Ctrl+C`, or pick **Don’t continue automatically** +`plugin_notification`| A [mod](</docs/en/plugins/mods/api#show-something-without-starting-a-turn>) raises a notification with `$.ui.notify`. The hook’s `title` is the mod’s name unless the mod set one Claude Code times `permission_prompt` differently in a terminal and in Claude Desktop, the VS Code extension, and other hosts that answer permission requests through the Agent SDK. See [when each notification type fires](</docs/en/hooks#notification>) for both timings. The `quota_auto_resume_fired`, `quota_auto_resume_stale`, and `quota_auto_resume_disabled` matchers require Claude Code v2.1.234 or later. In terminal sessions, `permission_prompt` for a sandboxed command’s network request requires Claude Code v2.1.246 or later. `agent_needs_input` for a teammate’s terminal setup question requires Claude Code v2.1.248 or later. Type `/hooks` at the Claude Code prompt and confirm the hook appears under `Notification`. @@ -590,7 +591,7 @@ * MCP tools marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>) * Connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>) in sessions where that setting reaches Claude Code -For what `"allow"` does in plan mode, see [Hook approvals in plan mode](</docs/en/permissions#hook-approvals-in-plan-mode>). A fourth value, `"defer"`, is available in [non-interactive mode](</docs/en/headless>) with the `-p` flag. It exits the process with the tool call preserved so an Agent SDK wrapper can collect input and resume. See [Defer a tool call for later](</docs/en/hooks#defer-a-tool-call-for-later>) in the reference. A `PreModelSwitch` hook returns the same `permissionDecision` field: `"allow"` lets a model switch proceed, and `"deny"` cancels it. `"ask"` has you confirm the switch when you run `/model` in an interactive session; everywhere else, Claude Code treats `"ask"` as a refusal. See [PreModelSwitch decision control](</docs/en/hooks#premodelswitch-decision-control>). Other events use different decision patterns. For example, `PostToolUse` and `Stop` hooks use a top-level `decision: "block"` field, while `PermissionRequest` uses `hookSpecificOutput.decision.behavior`. See the [summary table](</docs/en/hooks#decision-control>) in the reference for a full breakdown by event. For `UserPromptSubmit` hooks, use `hookSpecificOutput.additionalContext` instead to inject text into Claude’s context. Nest `additionalContext` inside `hookSpecificOutput`; if you place it at the top level of the JSON, Claude Code silently ignores it. For example, this output adds the current branch state to every prompt: +For what `"allow"` does in plan mode, see [Hook approvals in plan mode](</docs/en/permissions#hook-approvals-in-plan-mode>). A fourth value, `"defer"`, is available in [non-interactive mode](</docs/en/headless>) with the `-p` flag. Returning it ends the turn with the tool call preserved, so an Agent SDK wrapper can collect input and resume. See [Defer a tool call for later](</docs/en/hooks#defer-a-tool-call-for-later>) in the reference. A `PreModelSwitch` hook returns the same `permissionDecision` field: `"allow"` lets a model switch proceed, and `"deny"` cancels it. `"ask"` has you confirm the switch when you run `/model` in an interactive session; everywhere else, Claude Code treats `"ask"` as a refusal. See [PreModelSwitch decision control](</docs/en/hooks#premodelswitch-decision-control>). Other events use different decision patterns. For example, `PostToolUse` and `Stop` hooks use a top-level `decision: "block"` field, while `PermissionRequest` uses `hookSpecificOutput.decision.behavior`. See the [summary table](</docs/en/hooks#decision-control>) in the reference for a full breakdown by event. For `UserPromptSubmit` hooks, use `hookSpecificOutput.additionalContext` instead to inject text into Claude’s context. Nest `additionalContext` inside `hookSpecificOutput`; if you place it at the top level of the JSON, Claude Code silently ignores it. For example, this output adds the current branch state to every prompt: { "hookSpecificOutput": { @@ -634,7 +635,7 @@ `SessionStart`| how the session started| `startup`, `resume`, `clear`, `compact`, `fork` `Setup`| which CLI flag triggered setup| `init`, `maintenance` `SessionEnd`| why the session ended| `clear`, `resume`, `logout`, `prompt_input_exit`, `other` -`Notification`| notification type| `permission_prompt`, `idle_prompt`, `auth_success`, `elicitation_dialog`, `elicitation_url_dialog`, `elicitation_complete`, `elicitation_response`, `agent_needs_input`, `agent_completed`, `quota_auto_resume_fired`, `quota_auto_resume_stale`, `quota_auto_resume_disabled` +`Notification`| notification type| `permission_prompt`, `idle_prompt`, `auth_success`, `elicitation_dialog`, `elicitation_url_dialog`, `elicitation_complete`, `elicitation_response`, `agent_needs_input`, `agent_completed`, `quota_auto_resume_fired`, `quota_auto_resume_stale`, `quota_auto_resume_disabled`, `plugin_notification` `SubagentStart`| agent type| `general-purpose`, `Explore`, `Plan`, or custom agent names `PreCompact`, `PostCompact`| what triggered compaction| `manual`, `auto` `PreModelSwitch`, `PostModelSwitch`| canonical name of the model the session switches to, as described under [PreModelSwitch](</docs/en/hooks#premodelswitch>)| `claude-opus-5`, `claude-opus-4-6|claude-opus-5`, `.*opus.*`
modified Interactive mode View current →
--- a/interactive-mode.md +++ b/interactive-mode.md @@ -14,7 +14,7 @@ Shortcut| Description| Context ---|---|--- -`Ctrl+C`| Interrupt, or clear input| Interrupts a running operation. If nothing is running, the first press clears the prompt input and a second press exits Claude Code. Press `Up` while the prompt is still empty to bring the cleared draft back, which requires Claude Code v2.1.288 or later +`Ctrl+C`| Interrupt, or clear input| Interrupts a running operation. If nothing is running, the first press clears the prompt input and a second press exits Claude Code. To get a cleared draft back, see Bring back a cleared draft `Ctrl+X Ctrl+K`| Stop all running [background subagents](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) in this session, and turn off [artifact auto-replies](</docs/en/artifacts#let-claude-reply-to-comments-on-its-own>) for the rest of it. Press twice within 3 seconds to confirm. You can press it while a background subagent’s permission prompt is open| Subagent control `Ctrl+D`| Exit Claude Code session| The first press shows a confirmation hint and a second press within 800ms exits. When the prompt has text, `Ctrl+D` deletes the character after the cursor instead `Ctrl+G` or `Ctrl+X Ctrl+E`| Open in default text editor| Edit your prompt or custom response in your default text editor. `Ctrl+X Ctrl+E` is the readline-native binding. Turn on **Show last response in external editor** in `/config` to prepend Claude’s previous reply as `#`-commented context above your prompt; Claude Code strips the comment block when you save @@ -314,6 +314,17 @@ ​ +Bring back a cleared draft + +To get back a draft you cleared with `Ctrl+C`, press `Up`, either right away or after you’ve sent a message or command: + + * **Right after clearing the draft** : press `Up` once while the prompt is still empty. Requires Claude Code v2.1.288 or later. + * **After sending a message or command** : press `Up` to step back to the draft. Claude Code keeps the ten most recent cleared drafts for the current session, with their pasted text and images, and discards them when you exit. Requires Claude Code v2.1.292 or later. + +### + +​ + Reverse search with Ctrl+R Press `Ctrl+R` to interactively search through your command history. In [fullscreen rendering](</docs/en/fullscreen>), `Ctrl+R` opens a search dialog instead: type to filter, press `Up` and `Down` to move through matches, and press `Ctrl+S` to cycle the scope through this session, this project, and all projects. Press `Enter` or `Tab` to place a match in the prompt input, or `Esc` to cancel. The steps below describe the classic renderer’s inline search:
modified Draw in the interface with a mod View current →
--- a/interface.md +++ b/interface.md @@ -268,7 +268,7 @@ `closeOnEscape`| Makes Esc close the pane `holdToasts`| In the terminal, holds toasts while this pane is the one showing. See Hold toasts behind a dialog. `rows`| The height to ask for when the pane sits above the prompt. The default is a third of the space. -`columns`| The width to ask for when the pane sits beside the transcript +`columns`| The width to ask for when the pane sits beside the transcript, at most 45% of the terminal’s width. Once the user has resized a pane beside the transcript, in this session or an earlier one, panes open there at the width they set instead. The same 45% limit applies to that width. The VS Code extension ignores `rows` and `columns` and sizes the pane itself. `focus`, `closeOnEscape`, and `holdToasts` are optional and accept only `true`. To leave one off, omit it. Passing `false` throws an error such as `ui.open: focus is true or left out`. To set one of them conditionally, add the field only when the condition holds. This call asks for keyboard focus only when `items` isn’t empty: @@ -497,7 +497,7 @@ Enter| Presses the focused `Button`, submits the focused `Input`, or picks in a `Select` A button’s hotkey| Presses that button. While an `Input` has the focus, every printable key goes to the field. Page Up, Page Down, Home, and End| Scroll your pane or band when it has more rows than it can show -Ctrl+X then an arrow key| Resizes your pane. Left or Up gives it more room, and Right or Down gives the room back. +Ctrl+X then an arrow key| Resizes your pane. Left or Up gives it more room, and Right or Down gives the room back. A pane beside the transcript stops widening at 45% of the terminal’s width. Ctrl+X then X| Closes your pane, even while one of its fields has the focus Esc| Returns keyboard focus to the prompt. With `closeOnEscape: true`, it also closes the pane.
modified Customize keyboard shortcuts View current →
--- a/keybindings.md +++ b/keybindings.md @@ -508,6 +508,7 @@ ---|---|--- `settings:search`| /| Enter search mode `settings:retry`| R| Retry loading usage data on error +`settings:fixUsage`| F| Send your session the [`/usage` recommendations](</docs/en/costs#apply-recommendations-with-the-fix-shortcut>) Claude Code can apply, when the `/usage` footer offers a fix. Requires v2.1.305 or later `select:accept`| Enter, Space| Change the selected setting or open its submenu `confirm:no`| Escape| Close the panel. Changes are already saved @@ -794,6 +795,7 @@ * Parse errors (invalid JSON or structure) * Misspelled modifiers, such as `ctl+k`. Claude Code drops the part it doesn’t recognize and applies the binding to the keystroke that remains, `k` in this example. + * A space next to `+` in a key string, such as `ctrl+ k`. Claude Code reads the string as a chord of `ctrl+` followed by `k`. No keypress matches `ctrl+` on its own, so the binding never fires. Remove the space. * Invalid context names * Invalid action values, such as an action that isn’t a string or `null` * Unknown action names, such as a typo of a registered action. Claude Code skips the binding and keeps any default binding for that key in effect.
modified Connect Claude Code to an LLM gateway View current →
--- a/llm-gateway-connect.md +++ b/llm-gateway-connect.md @@ -517,7 +517,7 @@ `Your apiKeyHelper script is failing`, or `apiKeyHelper failed:` on stderr in non-interactive mode| The command in the [`apiKeyHelper`](</docs/en/settings-reference#apikeyhelper>) setting didn’t produce a usable key, so requests carry a placeholder key| Run the command directly to see why it fails, and re-authenticate with your credential provider if it reports an expired session; see [the error reference](</docs/en/errors#your-apikeyhelper-script-is-failing>) `Connection refused — a firewall or proxy may be blocking it (ConnectionRefused)` when nothing answers at the address, or `Can't reach the API server — check your internet or DNS (ENOTFOUND)` when the hostname doesn’t resolve, often after a silent pause while Claude Code [retries with backoff](</docs/en/errors#automatic-retries>). The code in parentheses varies; [Unable to connect to API](</docs/en/errors#unable-to-connect-to-api>) covers the code spellings and the earlier wording| Nothing answered at the base URL: the address is wrong, or a VPN or firewall blocks the path to the gateway| Run the curl test above, which fails immediately with the same cause, and confirm the URL and network path with your gateway team `API returned an empty or malformed response (HTTP 200)`| The gateway or an intermediate proxy returned a non-API response, often an HTML error or login page| Test with the curl request above; fix the gateway route that answers with something other than a Claude API response. [The error reference](</docs/en/errors#api-returned-an-empty-or-malformed-response>) explains the detail the message reports -`400` errors naming `context_management`, `Extra inputs are not permitted`, or other unrecognized fields| The gateway forwards requests to an upstream that rejects fields Claude Code sends to Anthropic-format endpoints| Set `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1`, which suppresses most pre-release fields; see [feature pass-through](</docs/en/llm-gateway-protocol#feature-pass-through>). Some betas aren’t gated by this flag; for those, set the matching `CLAUDE_CODE_USE_*` provider variable so Claude Code sends only what that provider accepts +`400` errors naming `context_management`, `Extra inputs are not permitted`, or other unrecognized fields| The gateway forwards requests to an upstream that rejects fields Claude Code sends to Anthropic-format endpoints| Set `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1`, which suppresses most pre-release fields; see [feature pass-through](</docs/en/llm-gateway-protocol#feature-pass-through>). Some betas aren’t gated by this flag; for those, set the matching `CLAUDE_CODE_USE_*` provider variable so Claude Code sends only what that provider accepts. For steps that depend on which field the message names, see [Extra inputs are not permitted](</docs/en/errors#extra-inputs-are-not-permitted>) `400` errors naming `thinking` or `adaptive`, such as `Input tag 'adaptive' found`| The upstream model build doesn’t accept adaptive reasoning, which Claude Code requests for Claude Opus 4.6, Claude Sonnet 4.6, Claude Haiku 5.5, Claude Fable 5, and later models| Upgrade the gateway’s upstream. On Opus 4.6 and Sonnet 4.6, `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING=1` works instead. The [model configuration](</docs/en/model-config>) capability variables apply only to the provider configurations, such as `CLAUDE_CODE_USE_BEDROCK` and `CLAUDE_CODE_USE_VERTEX`, not behind an `ANTHROPIC_BASE_URL` gateway `400` errors stating a context or token limit in the gateway’s own words, such as `ContextWindowExceededError` or `prompt token count of N exceeds the limit of M`| The gateway enforces a smaller context than the model’s native window and rewrites the upstream error, so Claude Code doesn’t recognize it as a [too-long error](</docs/en/errors#prompt-is-too-long>) and doesn’t compact and retry automatically| Run `/compact` to recover the session. To prevent it, set `CLAUDE_CODE_AUTO_COMPACT_WINDOW` to the gateway’s limit; Claude Code clamps the value to at least 100,000 tokens and at most the model’s context window, so you can’t match a gateway limit below 100,000, and `/compact` remains the recovery there. Also set `CLAUDE_CODE_MAX_OUTPUT_TOKENS` below the gateway model’s output limit `400` errors on every request, in the gateway’s own words rejecting a tool’s input schema or its `pattern`, on Claude Code v2.1.265 through v2.1.267| In a gradual rollout on those versions, the [Artifact tool](</docs/en/artifacts#availability>) schema carries a regular expression with `\p{...}` Unicode character classes. The Anthropic API accepts it, but a gateway or upstream that checks each tool schema’s `pattern` with its own regex engine rejects the whole request| Update to v2.1.268 or later, which doesn’t send the regular expression. On an affected version, [turn artifacts off](</docs/en/artifacts#disable-artifacts>), which removes the tool and its schema from requests
modified Claude Code gateway compatibility guide View current →
--- a/llm-gateway-protocol.md +++ b/llm-gateway-protocol.md @@ -106,7 +106,7 @@ ---|---|---|--- Model IDs in requests by default| The provider’s form, such as `us.anthropic.claude-opus-4-8` on Amazon Bedrock| Anthropic IDs, such as `claude-opus-4-8`| Anthropic IDs `anthropic-beta` values sent| The subset Amazon Bedrock and Agent Platform accept| The full set described under feature pass-through, unless the developer sets `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| The subset Amazon Bedrock and Agent Platform accept -Request fields for a model ID Claude Code doesn’t recognize, such as a gateway alias| Thinking with a fixed budget rather than adaptive reasoning, and no effort or context management fields| Everything current Claude models accept on the Claude API, including adaptive reasoning, effort, and context management, which an Amazon Bedrock or Agent Platform upstream can reject| Same as the Amazon Bedrock or Agent Platform format +Request fields for a model ID Claude Code doesn’t recognize, such as a gateway alias| Thinking with a fixed budget rather than adaptive reasoning, and no effort or context management fields. Claude Code still sends mid-conversation system messages| Everything current Claude models accept on the Claude API, including adaptive reasoning, effort, and context management, which an Amazon Bedrock or Agent Platform upstream can reject| Same as the Amazon Bedrock or Agent Platform format One-hour [prompt cache TTL](</docs/en/prompt-caching#choose-the-ttl-yourself>) when a developer opts in| Requested through the `ttl` field in `cache_control`, with no beta value| Requested through the `ttl` field plus an `extended-cache-ttl` value in `anthropic-beta`, which you must forward| See the Claude apps gateway [availability and limitations](</docs/en/claude-apps-gateway#availability-and-limitations>) table Model for [background tasks](</docs/en/costs#background-token-usage>) unless `ANTHROPIC_DEFAULT_HAIKU_MODEL` pins one| The default Sonnet model, or the main model once one is selected, as the [Amazon Bedrock](</docs/en/amazon-bedrock#4-pin-model-versions>) and [Agent Platform](</docs/en/google-vertex-ai#5-pin-model-versions>) pages describe| The main model, or the default Haiku model when `ANTHROPIC_API_KEY` or `apiKeyHelper` supplies an Anthropic Console key and `ANTHROPIC_AUTH_TOKEN` is unset| The main model @@ -225,15 +225,25 @@ Feature pass-through -Claude Code treats an `ANTHROPIC_BASE_URL` gateway as an Anthropic-format endpoint and sends it the beta headers and request body fields it sends to `api.anthropic.com`, except a small set of diagnostics and defaults reserved for direct connections, such as the fine-grained tool streaming default covered below. That set varies by release, so don’t depend on its contents. Capabilities that add body fields pair them with a beta header, and the pair travels together. A gateway that strips the header while passing the body, or forwards an Anthropic-format body to an upstream with a different schema, produces hard `400` errors; only when both halves are absent together does the feature turn off quietly. A gateway that rewrites or redacts request bodies for content inspection breaks the pairing the same way stripping does, so inspect without modifying. The table notes where a feature deviates from the pairing. Fine-grained tool streaming is one of the direct-connection defaults: it is off by default whenever requests route through a custom base URL, and a gateway receives it when developers set [`CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING=1`](</docs/en/env-vars>). +Claude Code treats an `ANTHROPIC_BASE_URL` gateway as an Anthropic-format endpoint and sends it the beta headers and request body fields it sends to `api.anthropic.com`, except a small set of diagnostics and defaults reserved for direct connections, such as the fine-grained tool streaming default covered below. That set varies by release, so don’t depend on its contents. Fine-grained tool streaming is one of the direct-connection defaults: it is off by default whenever requests route through a custom base URL, and a gateway receives it when developers set [`CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING=1`](</docs/en/env-vars>). + +### + +​ + +Beta header and body field pairs + +Capabilities that add body fields pair them with a beta header, and the pair travels together. A gateway that strips the header while passing the body, or forwards an Anthropic-format body to an upstream with a different schema, produces `400` errors. When both halves are absent together, the feature turns off quietly. A gateway that rewrites or redacts request bodies for content inspection breaks the pairing the same way stripping does, so inspect without modifying. The table notes where a feature deviates from the pairing. Feature| Header and body pair| Symptom when broken| Remediation ---|---|---|--- [Adaptive reasoning](</docs/en/model-config#adjust-effort-level>)| No beta header. Claude Code sends `thinking: {"type": "adaptive"}` for Claude Opus 4.6, Claude Sonnet 4.6, Claude Haiku 5.5, Claude Fable 5, and later models, and treats model names it doesn’t recognize, such as gateway aliases, as current models that receive the field| `400` naming the `thinking` field or the `adaptive` tag when the upstream model build doesn’t accept it| Upgrade the upstream. On Opus 4.6 and Sonnet 4.6, developers can set `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING=1` instead -[Context management](<https://platform.claude.com/docs/en/build-with-claude/context-editing>)| Context management beta header pairs with the `context_management` body field| `400` with `Extra inputs are not permitted`. Common when a gateway accepts Anthropic-format requests but forwards them to Amazon Bedrock| Forward both, or `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1` +[Context management](<https://platform.claude.com/docs/en/build-with-claude/context-editing>)| Context management beta header pairs with the `context_management` body field| `400` with `Extra inputs are not permitted`. Common when a gateway accepts Anthropic-format requests but forwards them to Amazon Bedrock. On v2.1.304 or later, Claude Code retries on its own without the pair| Forward both, or `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1` [Extended context](<https://platform.claude.com/docs/en/build-with-claude/context-windows#context-window-sizes-by-model>) and [interleaved thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking#interleaved-thinking>)| Beta headers only, no body field| Silently unavailable when the header is stripped; the upstream never sees the capability request| Forward `anthropic-beta` verbatim -Beta [tool fields](<https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview>)| Tool-related beta headers pair with tool schema fields such as `strict` and `defer_loading`| `400` naming the unrecognized tool schema field when the body passes through without its header| Forward both, or `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1` +Beta [tool fields](<https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview>)| Tool-related beta headers pair with tool schema fields such as `strict` and `defer_loading`| `400` naming the unrecognized tool schema field when the body passes through without its header. For `defer_loading`, see Retry without tool search| Forward both, or `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1` [Effort](<https://platform.claude.com/docs/en/build-with-claude/effort>) and [structured outputs](<https://platform.claude.com/docs/en/build-with-claude/structured-outputs>)| The `output_config` body field carries effort, structured-output format, and task budget settings; each pairs with its own beta header| `400` naming `output_config`, often `Extra inputs are not permitted`, on Amazon Bedrock and Google Cloud’s Agent Platform upstreams| Forward the field and its headers together, or have developers set `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1`, which removes the format and task budget settings but not effort. To remove only the format, they can set [`CLAUDE_CODE_DISABLE_STRUCTURED_OUTPUTS=1`](</docs/en/env-vars>) instead, which requires v2.1.288 or later +Mid-conversation system messages| No beta header. Claude Code sends some reminder and attachment text as `role: "system"` entries in `messages` for Claude Opus 4.8, models released after it, and unrecognized model IDs| `400` such as `Unexpected role "system"`| Claude Code retries without system messages. To stop system messages on an alias of a model released before Claude Opus 4.8, add a `modelOverrides` entry to the settings you distribute +[Effort set per turn](</docs/en/prompt-caching#changing-effort-level>)| On Opus 5.5, Sonnet 5.5, Haiku 5.5, and Fable 5.1, a beta header pairs with `output_config.effort` on `role: "system"` entries, either a system message or an entry with empty content| `400` with `messages.N: system content must contain at least one block` when your gateway strips the field from an empty entry| Forward both, or have developers set `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1` to stop the field and the empty entries [Prompt caching](</docs/en/prompt-caching>)| No beta pairing. Claude Code attaches `cache_control` markers to `system` blocks and to `messages` entries, including `role: "system"` entries appended mid-conversation| No error: the conversation bills as uncached input on every turn, visible as high `input_tokens` with little or no cache activity in `usage`| Forward `cache_control` unchanged wherever it appears, and don’t convert block-form `system` or message content to plain strings [Token counting](<https://platform.claude.com/docs/en/build-with-claude/token-counting>)| No beta pairing; uses the `count_tokens` endpoint| No error: Claude Code falls back to a character-based estimate, so `/context` shows approximate counts| Expose the endpoint for exact token counts @@ -245,15 +255,26 @@ Automatic retry and error forwarding -What Claude Code does after an upstream rejection depends on what was rejected: - - * When the upstream rejects the `thinking` field, a mid-conversation system message, or the `cache_control` marker on such a message, Claude Code retries the request and disables the rejected capability for the rest of the conversation +When the upstream rejects one of these capabilities, Claude Code can retry the request on its own with the rejected part removed or changed: + + * When a `400` says the `thinking.type` value `enabled` or `adaptive` isn’t supported, Claude Code retries once with the other type and keeps the `thinking` field. Later requests to that model keep the switched type until Claude Code exits. Before v2.1.121, Claude Code didn’t retry, so [`thinking.type.enabled is not supported`](</docs/en/errors#thinking-type-enabled-is-not-supported-for-this-model>) reached the developer + * When the upstream rejects a `role: "system"` entry inside `messages`, Claude Code retries once without those mid-conversation system messages and carries their text in user messages instead. Later requests in the conversation keep that shape until the developer runs `/clear` or the conversation compacts + * When the upstream rejects only the `cache_control` marker on a mid-conversation system message, Claude Code keeps the system messages and retries once with the marker moved. The marker goes on the last entry in `messages` that isn’t a system message, in that retry and in later requests until Claude Code exits * When the upstream rejects a [thinking signature](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>), including with a `400` whose message says the block is `bound to a different conversation`, Claude Code removes earlier thinking blocks from the request, retries, and keeps them out of every later request. New responses still include thinking * When the gateway or its upstream rejects the [advisor tool](</docs/en/advisor>) entry in `tools` as an unrecognized tool type, Claude Code retries the request once without that entry and its `anthropic-beta` value. Later requests to that base URL leave the advisor out until Claude Code exits, and `/advisor` is unavailable to the developer for that time. Claude Code recognizes this rejection by a `400` or `422` response whose message names the tool type after `Input tag`, such as `Input tag 'advisor_20260301'`. Before v2.1.280, Claude Code didn’t retry this rejection * When the upstream rejects `output_config.effort`, Claude Code retries the request without effort and leaves it out of later requests to that model until Claude Code exits. Claude Code recognizes this rejection by a `400` whose message names `output_config.effort` together with `Extra inputs are not permitted`, or says the model doesn’t support the effort parameter - * Claude Code doesn’t retry rejections of context management or tool schema fields, so those `400` errors reach the developer - -The `bound to a different conversation` rejection comes from the API’s [preserved thinking](<https://platform.claude.com/docs/en/build-with-claude/preserved-thinking>) check, which fails when `system`, `tools`, or earlier `messages` content differs from the request that produced the thinking. A gateway that rewrites any of that content can cause the rejection itself; [Libraries, proxies, and gateways](<https://platform.claude.com/docs/en/build-with-claude/preserved-thinking#libraries-proxies-gateways>) covers what to pass through unchanged. The retry logic matches on the upstream’s error wording, so forward error response bodies unmodified. A gateway that wraps upstream errors in its own envelope breaks the recovery path, even when it preserves the status code, unless the envelope’s message carries a stable `capability_rejected:` token. [Claude apps gateway substitutes those tokens for cloud providers’ error wording](</docs/en/claude-apps-gateway-config#upstream-error-messages>), for example `capability_rejected: prompt_too_long`. + * When the upstream rejects the `context_management` field or its `anthropic-beta` value, the gateway sees the request once more without them. If the gateway sees them again in a later request and the upstream rejects them again, the same retry follows. Claude Code recognizes this rejection by its message, for example one containing `context_management: Extra inputs are not permitted`. Before v2.1.304, Claude Code didn’t retry this rejection + * When the upstream rejects a beta tool field other than `defer_loading`, such as `strict`, the `400` reaches the developer. Before it does, the gateway can see the request again without the tool search fields. To stop sending such fields, have developers set `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1` + +The `bound to a different conversation` rejection comes from the API’s [preserved thinking](<https://platform.claude.com/docs/en/build-with-claude/preserved-thinking>) check, which fails when `system`, `tools`, or earlier `messages` content differs from the request that produced the thinking. A gateway that rewrites any of that content can cause the rejection itself; [Libraries, proxies, and gateways](<https://platform.claude.com/docs/en/build-with-claude/preserved-thinking#libraries-proxies-gateways>) covers what to pass through unchanged. Most of this retry logic matches on the upstream’s error wording, so forward error response bodies unmodified. A gateway that wraps upstream errors in its own envelope breaks the recovery path, even when it preserves the status code, unless the envelope’s message carries a stable `capability_rejected:` token. [Claude apps gateway substitutes those tokens for cloud providers’ error wording](</docs/en/claude-apps-gateway-config#upstream-error-messages>), for example `capability_rejected: prompt_too_long`. + +#### + +​ + +Retry without tool search + +On v2.1.305 or later, a request carrying [`defer_loading` fields and `tool_reference` blocks](</docs/en/mcp#tool-search-through-a-gateway>) can arrive again without them after a `400` or `422` whose cause Claude Code doesn’t recognize. After a successful retry, later requests omit them too. The developer’s requests keep working without any change on the gateway, with their MCP tools loaded upfront. Claude Code tries tool search again later, so the gateway can see another rejected request followed by its retry. To keep the fields out of every request, have developers set `ENABLE_TOOL_SEARCH=false`. For tool search itself, Claude Code expects the gateway to forward the `defer_loading` fields and `tool_reference` blocks with their `anthropic-beta` value. ### @@ -272,8 +293,9 @@ The variable doesn’t strip every `anthropic-beta` value. What it leaves in place includes: * The `anthropic-beta` values for extended context, interleaved thinking, and effort, which cloud providers also accept - * The `output_config.effort` field. Automatic retry and error forwarding covers an upstream that rejects it + * The top-level `output_config.effort` field. Automatic retry and error forwarding covers an upstream that rejects it * The adaptive reasoning `thinking` field, which has no beta header + * The `role: "system"` entries that carry mid-conversation system messages * The OAuth `anthropic-beta` value that subscription authentication requires * Header values and body fields developers add themselves through [`ANTHROPIC_BETAS`](</docs/en/env-vars>) or [`CLAUDE_CODE_EXTRA_BODY`](</docs/en/env-vars>)
modified Connect to external tools with MCP View current →
--- a/mcp.md +++ b/mcp.md @@ -144,7 +144,7 @@ Connection timing -Claude Code registers the servers you pass in `options.mcpServers` at startup and emits the init message once the first-turn wait, if any, resolves. Whether each `options.mcpServers` server delays the first turn, and when it connects, depends on its type: +Claude Code starts connecting your MCP servers when the session starts, and sends the init message once the first-turn wait, if any, ends. How long the first turn waits for a server depends on where you configured it. If you set `permissionPromptToolName`, the first turn always waits for that tool’s server, up to `MCP_TIMEOUT`, wherever you configured it. For a server in `options.mcpServers`, find its type in the first column to see how long the first turn waits for it. Server type| Delays the first turn?| First-turn wait timeout ---|---|--- @@ -152,17 +152,47 @@ Remote server with a cached tool list, saved by Claude Code from a previous connection| No; the cached tools are available from the first turn| None; connects on its first tool call, and that deferred connect has its own timeout In-process SDK server| Yes, until it connects and lists its tools| [`MCP_TIMEOUT`](</docs/en/env-vars>), 30 seconds by default, per connect attempt; the connection fails at that deadline -Servers loaded from settings files such as `.mcp.json` or from plugins commonly show `pending` in the init message. When `options.mcpServers` holds a stdio, HTTP, or SSE server, the first turn waits for these pending servers too, up to `MCP_TIMEOUT`. When `options.mcpServers` is empty or holds only SDK servers, the first turn waits up to 2 seconds instead: - - * **With[tool search](</docs/en/agent-sdk/tool-search>), the default**: the wait covers still-pending servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) and not the rest. The rest keep connecting in the background. [Tool availability](</docs/en/mcp#tool-availability>) describes how Claude reaches their tools once they connect. - * **Without tool search** : the wait covers every pending server. [Configure tool search](</docs/en/agent-sdk/tool-search#configure-tool-search>) covers what turns tool search off. If you exclude the `ToolSearch` tool from the session, for example through `disallowedTools`, the session also runs without tool search. - -If you set `permissionPromptToolName`, the first turn also waits for that tool’s server in every case, up to `MCP_TIMEOUT`. To set the first-turn wait yourself, add `CLAUDE_CODE_MCP_STARTUP_WAIT_MS` to the [`env` option](</docs/en/agent-sdk/configuration#set-environment-variables>), for example `CLAUDE_CODE_MCP_STARTUP_WAIT_MS: "5000"`. The first turn then waits up to that many milliseconds for every pending server, whether or not tool search is available. This deadline also replaces the `MCP_TIMEOUT` first-turn wait for stdio, HTTP, and SSE servers in `options.mcpServers`. `CLAUDE_CODE_MCP_STARTUP_WAIT_MS` requires Claude Code v2.1.274 or later. Servers still pending when the wait ends keep connecting in the background. Set the variable to `0` to skip the wait. A `permissionPromptToolName` server keeps its own `MCP_TIMEOUT` wait regardless of the value. To block startup itself at a separate, earlier phase than the first-turn wait, before the init message is sent: - - * Set [`MCP_CONNECTION_NONBLOCKING`](</docs/en/env-vars>) to `0` to block on the whole connection batch. Claude Code caps that wait at 5 seconds by default. Adjust the cap with the [`MCP_CONNECT_TIMEOUT_MS`](</docs/en/env-vars>) environment variable, in milliseconds. Servers still pending at that deadline keep connecting in the background. - * Set `alwaysLoad: true` on a server’s config to make its tools available at their full schemas on the first turn, [exempt from tool search deferral](</docs/en/mcp#exempt-a-server-from-deferral>). Claude Code waits at startup for that server’s tools, capped at the same deadline, while other servers keep connecting in the background; a remote server with a cached tool list supplies them without connecting, per the table above. - -The `system` message with subtype `init` reports each server’s status at the moment it’s emitted; see Error handling for reading those statuses. +A server has a cached tool list only when the [MCP discovery cache](</docs/en/mcp#server-status-detail>) is on. Servers from settings files such as `.mcp.json`, or from plugins, often still show `pending` in the init message. How long the first turn waits for them depends on `options.mcpServers` and tool search: + + * **`options.mcpServers` includes a stdio, HTTP, or SSE server**: the first turn waits for the pending settings-file and plugin servers too, up to `MCP_TIMEOUT`. + * **Otherwise, when`ANTHROPIC_BASE_URL` points to a [gateway](</docs/en/mcp#tool-search-through-a-gateway>) and [`ENABLE_TOOL_SEARCH`](</docs/en/mcp#configure-tool-search>) is unset**: the first turn waits up to 2 seconds for every pending settings-file and plugin server. + * **Otherwise, with[tool search](</docs/en/agent-sdk/tool-search>) on, which is the default**: the first turn waits up to 2 seconds, and only for pending servers that set [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) or that you named. The rest keep connecting in the background, and Claude [reaches their tools](</docs/en/mcp#tool-availability>) once they connect. + * **Otherwise, with tool search off** : the first turn waits up to 2 seconds for every pending settings-file and plugin server. Tool search is off when your [`ENABLE_TOOL_SEARCH` value or model](</docs/en/agent-sdk/tool-search#configure-tool-search>) turns it off, or when you exclude the `ToolSearch` tool, for example through `disallowedTools`. + +### + +​ + +Named servers + +You name a server by listing any of its tools, such as `mcp__github__list_issues` or `mcp__github__*`, in `allowedTools` or in a `permissions.allow` rule in the `settings` option. An [`mcp_tool` hook](</docs/en/hooks#mcp-tool-hook-fields>) also names the server it calls when you configure it on a prompt-submission, tool-use, permission, subagent, task, elicitation, or worktree event. Before v2.1.284, naming a server had no effect on the first-turn wait. + +### + +​ + +Set the first-turn wait yourself + +To choose the first-turn wait yourself, set `CLAUDE_CODE_MCP_STARTUP_WAIT_MS` in the [`env` option](</docs/en/agent-sdk/configuration#set-environment-variables>), for example `CLAUDE_CODE_MCP_STARTUP_WAIT_MS: "5000"`. The first turn then waits up to that many milliseconds for pending settings-file and plugin servers, whether or not tool search is on. The same limit replaces the `MCP_TIMEOUT` wait for the stdio, HTTP, and SSE servers in `options.mcpServers`. Three waits apply whatever value you set, including `0`: + + * **A`permissionPromptToolName` server**: up to `MCP_TIMEOUT`. + * **An in-processSDK server**: up to `MCP_TIMEOUT` per connect attempt. + * **A still-connectingnamed server**: at least up to 2 seconds, so a value below `2000` doesn’t shorten its wait. + +Set the variable to `0` to skip the wait for every other server. Servers still pending when the wait ends keep connecting in the background. `CLAUDE_CODE_MCP_STARTUP_WAIT_MS` requires Claude Code v2.1.274 or later. + +### + +​ + +Make startup wait for servers + +Two settings make startup itself wait, before Claude Code sends the init message: + + * **[`MCP_CONNECTION_NONBLOCKING`](</docs/en/env-vars>) set to `0`**: startup waits for the whole connection batch, up to 5 seconds by default. Set [`MCP_CONNECT_TIMEOUT_MS`](</docs/en/env-vars>), in milliseconds, to change that cap. Servers still pending at the cap keep connecting in the background. + * **`alwaysLoad: true` on a server’s config**: startup waits up to the same cap for that server’s tools, so the first turn has them at full schema, [exempt from tool search deferral](</docs/en/mcp#exempt-a-server-from-deferral>). A remote server with a cached tool list supplies them without connecting or holding startup. + +The init message reports each server’s status as of the moment Claude Code sends it. ##
modified Connect to MCP servers View current →
--- a/mcp-quickstart.md +++ b/mcp-quickstart.md @@ -280,7 +280,7 @@ * **Claude Code desktop app** : add servers through the [Connectors UI](</docs/en/desktop#connect-external-tools>). * **Claude Desktop chat app** : a separate app from Claude Code. To copy servers from its `claude_desktop_config.json` into the CLI, run `claude mcp add-from-claude-desktop` on macOS or WSL. * **VS Code** : see [Connect to external tools with MCP](</docs/en/vs-code#connect-to-external-tools-with-mcp>). - * **Cloud sessions** : commit a `.mcp.json` to your repository; a session with one repository loads it. See Edit .mcp.json directly and [What carries over from your setup](</docs/en/cloud-environments#what-carries-over-from-your-setup>). + * **Cloud sessions** : outside a [project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>), commit a `.mcp.json` to your repository; a session with one repository loads it. Cloud threads in a project use your claude.ai connectors instead. See Edit .mcp.json directly and [What carries over from your setup](</docs/en/cloud-environments#what-carries-over-from-your-setup>). * **Claude.ai** : connectors you add at [claude.ai/customize/connectors](<https://claude.ai/customize/connectors>) load automatically in the CLI when you sign in with that account. See [Use MCP servers from Claude.ai](</docs/en/mcp#use-mcp-servers-from-claude-ai>). ## @@ -347,7 +347,7 @@ Server connects but no tools appear -Run `/mcp` inside a session and select the server to see its tool list. If the list is empty, the server started but didn’t register any tools, which usually means it’s missing a required environment variable such as an API key.Pass the variable with `--env KEY=value` on `claude mcp add`, or in the `env` field of the server’s `.mcp.json` entry. The server’s documentation lists the variables it needs. +Run `/mcp` inside a session and select the server to see its tool list. If the list is empty, the server started but didn’t register any tools, which usually means it’s missing a required environment variable such as an API key.Pass the variable with `--env KEY=value` on `claude mcp add`, or in the `env` field of the server’s `.mcp.json` entry. The server’s documentation lists the variables it needs.Before v2.1.302, `/mcp` showed the status `tools fetch failed` for a server using [protocol revision 2026-07-28](</docs/en/mcp#mcp-client-runtimes>) that left `resultType`, `ttlMs`, or `cacheScope` out of its replies. If you use one of those versions and a server shows that status, [update Claude Code](</docs/en/setup#update-claude-code>). Changes to .mcp.json don't take effect
modified Model configuration View current →
--- a/model-config.md +++ b/model-config.md @@ -373,7 +373,13 @@ Organization effort limits -Your organization can cap the effort level in two ways. On a Claude Enterprise plan, organization admins set per-role effort limits, described below. On any plan and any provider, including Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, the [`maxEffortLevel`](</docs/en/settings-reference#maxeffortlevel>) managed setting caps effort on the client instead. When both apply to a model, the lower cap applies. Organization admins on Claude Enterprise plans can set a maximum effort level per model for each custom role, alongside role-level organization model restrictions. Levels above the cap aren’t offered in the `/effort` picker, and naming a higher level with `--effort` or `/effort` runs at the cap instead. In interactive sessions and plain-text `--print` runs, a warning names the requested and applied levels; with `json` or `stream-json` output or in background agents, the clamp applies silently. Caps are per model, so switching models can change which levels are available. When several of your roles grant the same model, the least restrictive cap applies. Requires Claude Code v2.1.195 or later. Effort limits are delivered together with organization model restrictions and reach the same sessions. +Your organization can cap the effort level in two ways. On a Claude Enterprise plan, organization admins set per-role effort limits, described below. On any plan and any provider, including Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, the [`maxEffortLevel`](</docs/en/settings-reference#maxeffortlevel>) managed setting caps effort on the client instead. When both apply to a model, the lower cap applies. Organization admins on Claude Enterprise plans can set a maximum effort level per model for each custom role, alongside role-level organization model restrictions. Requires Claude Code v2.1.195 or later. + + * Levels above the cap aren’t offered in the `/effort` picker, and naming a higher level with `--effort` or `/effort` runs at the cap instead. If you start a plain-text `--print` run with `--effort` above the cap, a warning on stderr names the requested and applied levels. In interactive sessions, with `json` or `stream-json` output, or in background agents, that warning goes to the [debug log](</docs/en/errors#configuration-warnings>) instead. + * Caps are per model, so switching models can change which levels are available. + * When several of your roles grant the same model, the least restrictive cap applies. + +Effort limits are delivered together with organization model restrictions and reach the same sessions. ## @@ -771,7 +777,7 @@ On an [LLM gateway](</docs/en/llm-gateway>) or other custom deployment, Claude Code can assume a context window for the model ID that differs from the model’s real window, whether or not it resolves the ID to a Claude model. Set [`CLAUDE_CODE_MAX_CONTEXT_TOKENS`](</docs/en/env-vars>) to the window Claude Code should assume instead. How the variable applies depends on the ID. Claude Code treats an ID as a provider or custom spelling when it doesn’t start with `claude-`, in any casing, or when it carries a suffix that Claude Code strips when reading the ID, such as the `@YYYYMMDD` date used on Google Cloud’s Agent Platform. Before v2.1.259, Claude Code didn’t count a stripped suffix, so an unrecognized `claude-` ID with a date suffix was treated as a bare `claude-` name. An unrecognized provider or custom spelling, the same spelling with `[1m]`, and every other ID are three separate cases: * If Claude Code can’t resolve a provider or custom spelling to a model it recognizes and the ID doesn’t contain `[1m]`, the variable applies directly and proactive compaction continues at the declared window. - * If Claude Code can’t resolve a provider or custom spelling to a model it recognizes and the ID contains `[1m]`, in any casing, Claude Code assumes a 1M window for it and the variable doesn’t apply on its own. To correct the window while keeping proactive compaction, also set [`CLAUDE_CODE_DISABLE_1M_CONTEXT=1`](</docs/en/env-vars>). With that variable set, Claude Code sizes the ID like the same spelling without `[1m]`, so `CLAUDE_CODE_MAX_CONTEXT_TOKENS` applies when it would apply to that untagged spelling. With a declared window above 200K, Claude Code then shows a [startup warning](</docs/en/errors#the-200k-limit-isnt-enforced>) that the 200K limit isn’t enforced. The warning is expected in this configuration. + * If Claude Code can’t resolve a provider or custom spelling to a model it recognizes and the ID contains `[1m]`, in any casing, Claude Code assumes a 1M window for it and the variable doesn’t apply on its own. To correct the window while keeping proactive compaction, also set [`CLAUDE_CODE_DISABLE_1M_CONTEXT=1`](</docs/en/env-vars>). With that variable set, Claude Code sizes the ID like the same spelling without `[1m]`, so `CLAUDE_CODE_MAX_CONTEXT_TOKENS` applies when it would apply to that untagged spelling. With a declared window above 200K, the warning that [the 200K limit isn’t enforced](</docs/en/errors#the-200k-limit-isnt-enforced>) is expected in this configuration. * If the ID resolves to a model Claude Code recognizes, or the ID is a bare `claude-` name with no suffix for Claude Code to strip, in any casing, the variable takes effect only when you also set [`DISABLE_COMPACT`](</docs/en/env-vars>), which disables all compaction. For example, an ID that contains a Claude model name that Claude Code knows, such as `anthropic/claude-opus-4-8`, `us.anthropic.claude-…-v1:0`, or the dated `claude-sonnet-4-5@20250929`, resolves to that model. This includes IDs that also contain `[1m]`: Claude Code resolves `claude-opus-4-8[1m]` to Opus 4.8 even with `CLAUDE_CODE_DISABLE_1M_CONTEXT` set. For a model ID Claude Code doesn’t recognize, set [`CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT=1`](</docs/en/env-vars>) to have Claude Code compact only after the API rejects the conversation with a [too-long error Claude Code recognizes](</docs/en/errors#prompt-is-too-long>). Claude Code doesn’t run that recovery when a gateway [rewrites the error](</docs/en/llm-gateway-connect#troubleshoot-gateway-errors>) to wording Claude Code doesn’t recognize.
modified Monitoring View current →
--- a/monitoring-usage.md +++ b/monitoring-usage.md @@ -991,6 +991,8 @@ * For Skill tool: includes `skill_name` * For Agent tool or legacy Task tool: includes `subagent_type` +If you lower the OpenTelemetry SDK’s `OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT` below the number of attributes on a `tool_decision` event, the SDK drops the attributes that Claude Code set last. The SDK drops `permission_mode` first, `classifier_category` second, and `classifier_verdict` third, and drops the event’s other attributes only after those three. This ordering requires Claude Code v2.1.302 or later. + #### ​
modified Enterprise network configuration View current →
--- a/network-config.md +++ b/network-config.md @@ -200,6 +200,7 @@ `claude.ai`| claude.ai account authentication `claude.com`| claude.ai account sign-in opens a `claude.com` page in the browser, which redirects to `claude.ai`; pre-approved WebFetch documentation lookups also reach this host from the CLI `platform.claude.com`| Anthropic Console account authentication. OAuth token exchange, refresh, and revocation also go to this host for claude.ai accounts, so both Console and claude.ai sign-ins require it +`sso.claude.com`| Part of the browser sign-in flow for organizations that use single sign-on (SSO). If a proxy blocks this host, those sign-ins can fail `mcp-proxy.anthropic.com`| [MCP connectors from claude.ai](</docs/en/mcp#use-mcp-servers-from-claude-ai>), including connectors an organization administrator configures. Connector traffic routes through this proxy; connectors are enabled by default for claude.ai-authenticated users. To stop Claude Code from fetching them, set [`ENABLE_CLAUDEAI_MCP_SERVERS=false`](</docs/en/env-vars>) or the [`disableClaudeAiConnectors`](</docs/en/settings-reference#disableclaudeaiconnectors>) setting `downloads.claude.ai`| Plugin executable downloads; native installer, native auto-updater, and update version checks `storage.googleapis.com`| Plugin install counts and metadata shown in `/plugin`
modified Choose a permission mode View current →
--- a/permission-modes.md +++ b/permission-modes.md @@ -545,7 +545,7 @@ 3. Everything else goes to the classifier, apart from critical-path removals under their default handling. The connector tools and `requiresUserInteraction` MCP tools that prompt you directly in step 1 never reach the classifier either, so neither an org-required approval nor a consent step is auto-approved 4. If the classifier blocks, Claude receives the reason. In most sessions the reason names the rule the classifier matched, such as `[Data Exfiltration]`, rather than giving a written explanation; see [Review denials](</docs/en/auto-mode-config#review-denials>) -A [mod](</docs/en/plugins/mods/overview>) you install that handles `tool.check` can also approve an action. For the cases where its approval doesn’t get past your rules and hooks, see [Extend permissions with hooks](</docs/en/permissions#precedence-among-rules-hooks-and-mods>).In the VS Code extension, how [Claude in Chrome](</docs/en/chrome>) browser actions get approved depends on how the session connected to the browser: see [Permission prompts in VS Code sessions](</docs/en/chrome#permission-prompts-in-vs-code-sessions>).On entering auto mode, broad allow rules that grant arbitrary code execution are dropped: +A [mod](</docs/en/plugins/mods/overview>) you install that handles `tool.check` can also approve an action. For the cases where its approval doesn’t get past your rules and hooks, see [Extend permissions with hooks](</docs/en/permissions#precedence-among-rules-hooks-and-mods>).For how [Claude in Chrome](</docs/en/chrome>) browser actions get approved in the VS Code extension, see [Permission prompts in VS Code sessions](</docs/en/chrome#permission-prompts-in-vs-code-sessions>).On entering auto mode, broad allow rules that grant arbitrary code execution are dropped: * Blanket `Bash(*)` or `PowerShell(*)` * Wildcarded interpreters like `Bash(python*)` @@ -603,10 +603,11 @@ In [non-interactive mode](</docs/en/headless>) no dialog is shown. A [background session](</docs/en/agent-view>) honors your acceptance when it’s recorded in user or managed settings: - * With no acceptance recorded, `claude --bg --permission-mode bypassPermissions` is refused until you accept the dialog in an interactive session. - * With `skipDangerousModePermissionPrompt` set only in `.claude/settings.local.json`, the background session starts with the bypass request ignored and pins the notice `Bypass permissions was requested at launch and ignored · if that was you, ~/.claude/settings.json needs "skipDangerousModePermissionPrompt": true`. Add that key to `~/.claude/settings.json`, then start a new background session. The session showing the notice still runs: + * With no acceptance recorded, `claude --bg --permission-mode bypassPermissions` is refused. Accept the dialog in an interactive session first. + * With `skipDangerousModePermissionPrompt` set only in `.claude/settings.local.json`, the background session starts with the bypass request ignored: * With `--allow-dangerously-skip-permissions` ignored, `bypassPermissions` is left out of its `Shift+Tab` cycle. * With `--permission-mode bypassPermissions` or `--dangerously-skip-permissions` ignored, the session starts in Manual mode instead. +Add `"skipDangerousModePermissionPrompt": true` to `~/.claude/settings.json`, then start a new background session. On Linux and macOS, Claude Code refuses to start in `bypassPermissions` mode when running as root or under `sudo`: @@ -615,6 +616,18 @@ The check is skipped automatically inside a recognized sandbox. To run autonomously in a container, use the [dev container](</docs/en/devcontainer>) configuration, which runs Claude Code as a non-root user. [Cloud sessions](</docs/en/claude-code-on-the-web>) don’t honor `defaultMode: "bypassPermissions"` or `"dontAsk"` from your settings files, so a repository’s checked-in settings can’t start a cloud session in bypass-permissions mode. The setting is ignored silently and the session starts in the permission mode shown in the mode dropdown instead. See Switch permission modes for which modes cloud sessions offer. `bypassPermissions` offers no protection against prompt injection or unintended actions. For background safety checks with far fewer permission prompts, use auto mode instead. Administrators can block this mode by setting `permissions.disableBypassPermissionsMode` to `"disable"` in [managed settings](</docs/en/managed-settings>). + +### + +​ + +Bypass permissions ignored in a background session + +This notice means the [background session](</docs/en/agent-view>) didn’t find your acceptance of the bypass permissions warning in user or managed settings, so it ignored the bypass request made at launch: + + Bypass permissions was requested at launch and ignored · if that was you, ~/.claude/settings.json needs "skipDangerousModePermissionPrompt": true + +Add `"skipDangerousModePermissionPrompt": true` to `~/.claude/settings.json`, then start a new background session. ##
modified Configure permissions View current →
--- a/permissions.md +++ b/permissions.md @@ -74,7 +74,7 @@ `disallowed_tools=["Bash(rm *)"]`| `Bash` stays available. Calls matching `rm *` [as written](</docs/en/permissions#bash-rule-limits>) are denied in every permission mode, including `bypassPermissions`. Other `Bash` calls, including `/bin/rm`, fall through to the permission mode. `disallowed_tools=["*"]`| Every tool definition is removed from the request. Tool-name globs are supported in deny rules: `"*"` matches every tool and `"mcp__*"` matches every MCP tool across all servers. -Allow rules accept tool-name globs only after a literal `mcp__<server>__` prefix. The server segment must be glob-free so the rule names a specific server you configured: `mcp__puppeteer__*` matches every tool from the `puppeteer` server, and `mcp__github__get_*` matches its `get_` tools. An unanchored entry like `allowed_tools=["*"]` or `allowed_tools=["mcp__*"]` is ignored with a startup warning and does not auto-approve anything. Scoped rules for `Read` and `Edit` take a path pattern. `Edit(path)` rules govern all built-in tools that write files, including `Write` and `NotebookEdit`; a `Write(path)` rule is never matched by the file permission checks. Use `//path` for an absolute filesystem path: a deny rule of `Edit(//secrets/**)` blocks writes anywhere under `/secrets` on disk. With a single leading slash, `Edit(/secrets/**)` anchors at the rule’s source instead. For rules passed through `allowed_tools` or `disallowed_tools`, that means the session’s working directory, so the rule doesn’t block `/secrets` on disk. See [Read and Edit rules](</docs/en/permissions#read-and-edit>) for the four anchor forms and how rules from settings files resolve. +Allow rules accept tool-name globs only after a literal `mcp__<server>__` prefix. The server segment must be glob-free so the rule names a specific server you configured: `mcp__puppeteer__*` matches every tool from the `puppeteer` server, and `mcp__github__get_*` matches its `get_` tools. An unanchored entry like `allowed_tools=["*"]` or `allowed_tools=["mcp__*"]` is ignored and doesn’t auto-approve anything. Scoped rules for `Read` and `Edit` take a path pattern. `Edit(path)` rules govern all built-in tools that write files, including `Write` and `NotebookEdit`; a `Write(path)` rule is never matched by the file permission checks. Use `//path` for an absolute filesystem path: a deny rule of `Edit(//secrets/**)` blocks writes anywhere under `/secrets` on disk. With a single leading slash, `Edit(/secrets/**)` anchors at the rule’s source instead. For rules passed through `allowed_tools` or `disallowed_tools`, that means the session’s working directory, so the rule doesn’t block `/secrets` on disk. See [Read and Edit rules](</docs/en/permissions#read-and-edit>) for the four anchor forms and how rules from settings files resolve. **Auto-approved tools never reach`canUseTool`.** A tool call approved at any earlier step, by `acceptEdits` or `bypassPermissions`, or by an allow rule, skips your `canUseTool` callback, so permission checks you put there are silently bypassed for that tool.An allow rule never auto-approves `AskUserQuestion`, MCP tools marked [`_meta["anthropic/requiresUserInteraction"]`](</docs/en/mcp#require-approval-for-a-specific-tool>), connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>), or `rm` and `rmdir` removals targeting a [critical path](</docs/en/permission-modes#critical-paths>). In `dontAsk` mode Claude Code denies these calls without invoking the callback. In other modes the first three reach the callback. Depending on the [permission mode](</docs/en/permission-modes#critical-paths>), a critical-path removal reaches the callback too or Claude Code denies it without calling it, as it does by default for an Agent SDK session in `auto` mode.Coverage depends on the entry’s form: a bare name like `Read` or `mcp__github__get_issue` auto-approves every call to that tool apart from those exceptions and [reads from network paths](</docs/en/permissions#network-paths>), while a scoped rule like `Bash(npm test *)` auto-approves only matching calls, and other `Bash` calls that need approval still fall through to the callback. For checks that must run on every tool call, use a [`PreToolUse` hook](</docs/en/agent-sdk/hooks>): hooks run before every other step, and a hook deny applies even in `bypassPermissions` mode.
modified How Claude Code uses prompt caching View current →
--- a/prompt-caching.md +++ b/prompt-caching.md @@ -37,7 +37,7 @@ Claude Code also appends system context mid-conversation, such as file-change notices, and marks that block for caching on every provider and connection unless you set [`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>), in which case that block is sent uncached. At the provider’s own endpoint, Amazon Bedrock and its [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>), Google Cloud’s Agent Platform, and Microsoft Foundry cache the block the same way the Claude API does. When your requests pass through an [LLM gateway](</docs/en/llm-gateway>), a custom `ANTHROPIC_BASE_URL`, or a cloud provider base-URL override such as [`ANTHROPIC_BEDROCK_BASE_URL`](</docs/en/env-vars>), what stays cached depends on how the gateway handles the [`cache_control` markers](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching#explicit-cache-breakpoints>) Claude Code sends: * **Forwards them unchanged** : the block and your conversation cache the same as at the provider’s own endpoint. - * **Rejects the marked request with a`400` error naming `cache_control`**: Claude Code re-sends the request with the marker moved off the block and onto your last conversation message, and keeps it there for the rest of the conversation. The block bills as uncached input; your conversation stays cached. + * **Rejects the marked request with a`400` error naming `cache_control`**: Claude Code re-sends the request with the marker moved off the block and onto your last conversation message, and keeps it there until Claude Code exits. The block bills as uncached input; your conversation stays cached. * **Removes the markers while returning success** : your entire conversation history bills as uncached input on every turn. A gateway that converts block-form system content to a plain string drops the marker the same way. 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. @@ -93,7 +93,9 @@ Tool definitions sit in the system prompt layer, so the cache invalidates when the set of tool definitions in the request changes between turns. Toggling the [advisor tool](</docs/en/advisor>) is an exception: its definition sits after the cache breakpoint, so enabling or disabling `/advisor` keeps the cached prefix intact. Whether an [MCP server](</docs/en/mcp>) change does this depends on whether [tool search](</docs/en/mcp#scale-with-mcp-tool-search>) defers the session’s MCP tools, the default on supported models: * **Tools deferred** : Claude Code keeps the tool list from the conversation’s first request for the whole conversation, so a server connecting or disconnecting mid-session doesn’t disturb anything already cached. A server that finishes connecting after the first request supplies its tools as deferred definitions that Claude loads on demand. - * **Tools loaded upfront** : adding a definition invalidates the cache, and so does removing one on purpose. This applies when tool search is [below its `auto` threshold, disabled, or unavailable](</docs/en/mcp#configure-tool-search>), such as on Google Cloud’s Agent Platform models earlier than Opus 4.5, Sonnet 4.5, and Haiku 4.5, with a custom `ANTHROPIC_BASE_URL` gateway, or on a Microsoft Foundry [deployment hosted on Azure](<https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#hosting-options>) once Claude Code detects that the deployment rejects tool search. + * **Tools loaded upfront** : adding a definition invalidates the cache, and so does removing one on purpose. This applies when tool search is [off or unavailable](</docs/en/mcp#configure-tool-search>), such as on: + * Google Cloud’s Agent Platform models earlier than Opus 4.5, Sonnet 4.5, and Haiku 4.5 + * A Microsoft Foundry [deployment hosted on Azure](<https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#hosting-options>) once Claude Code detects that the deployment rejects tool search Without tool search, whether a mid-session server change invalidates the cache depends on what changed. For each change, this table gives whether the cache is kept and what happens to the tool definitions in the next request.
modified Agent SDK reference - Python View current →
--- a/python.md +++ b/python.md @@ -622,7 +622,7 @@ `set_model(model)`| Change the model for the current session. Pass `None` to reset to [Claude Code’s default model](</docs/en/model-config>). A session in `auto` mode [changes to `default` mode](</docs/en/agent-sdk/permissions#auto-mode-auto>) if the new model doesn’t support auto mode `rewind_files(user_message_id)`| Restore files to their state at the specified user message. Requires `enable_file_checkpointing=True`. See [File checkpointing](</docs/en/agent-sdk/file-checkpointing>) `get_mcp_status()`| Get the status of all configured MCP servers. Returns `McpStatusResponse` -`get_context_usage()`| Get a breakdown of context window usage by category, skill, and tool. The same data `/context` shows in an interactive session. Returns `ContextUsageResponse`. To compute the breakdown, Claude Code makes several token-counting API requests that don’t appear in the message stream; see how these requests are handled +`get_context_usage()`| Get a breakdown of context window usage by category, skill, and tool. Includes the data `/context` shows in an interactive session. Returns `ContextUsageResponse`. To compute the breakdown, Claude Code makes several token-counting API requests that don’t appear in the message stream; see how these requests are handled `reconnect_mcp_server(server_name)`| Retry connecting to an MCP server that failed or was disconnected `toggle_mcp_server(server_name, enabled)`| Enable or disable an MCP server mid-session. Disabling a stdio, SSE, or HTTP server removes its tools `stop_task(task_id)`| Stop a running background task. A `TaskNotificationMessage` with status `"stopped"` follows in the message stream @@ -1648,7 +1648,7 @@ `ContextUsageResponse` -Response from `ClaudeSDKClient.get_context_usage()`. This is the same payload Claude Code renders for the `/context` command in an interactive session, so alongside the token counts it carries display fields such as `color` and `gridRows` that Claude Code uses to draw the `/context` usage grid. Claude Code builds this payload by sending several requests to the [token-counting](<https://platform.claude.com/docs/en/build-with-claude/token-counting>) API. These requests don’t appear in the message stream, so cost tracking that reads the stream won’t see them. On the Anthropic API, token counting isn’t billed. +Response from `ClaudeSDKClient.get_context_usage()`. The response includes the payload Claude Code renders for the `/context` command in an interactive session. Alongside the token counts, that payload carries display fields such as `color` and `gridRows` that Claude Code uses to draw the `/context` usage grid. Claude Code builds this payload by sending several requests to the [token-counting](<https://platform.claude.com/docs/en/build-with-claude/token-counting>) API. These requests don’t appear in the message stream, so cost tracking that reads the stream won’t see them. On the Anthropic API, token counting isn’t billed. class ContextUsageResponse(TypedDict): categories: list[ContextUsageCategory] @@ -1847,7 +1847,12 @@ The `subtype` field determines which other fields are populated. It is one of `"success"`, `"error_during_execution"`, `"error_max_turns"`, `"error_max_budget_usd"`, or `"error_max_structured_output_retries"`. The Python dataclass flattens all variants into one shape, so fields that don’t apply to the returned subtype are `None`. Several fields carry diagnostic detail about how the conversation ended: - * `is_error`: `True` when the conversation ended in an error state. Always `True` on the `error_*` subtypes. On `subtype="success"` it is `True` when the final model request failed, meaning the agent loop completed but the last API call returned an error. + * `is_error`: `True` when the conversation ended in an error state. Always `True` on the `error_*` subtypes. On `subtype="success"` it is `True` in three cases. Check `stop_reason` to tell them apart: + * `"refusal"`: the model declined to respond. Read the refusal text in `result`, or in the preceding `AssistantMessage` when `result` is empty. + * `"tool_deferred_unavailable"`: the [deferred tool](</docs/en/hooks#defer-a-tool-call-for-later>) was no longer available when you resumed the session, for example because its MCP server wasn’t connected. In the two cases below, a prompt you send after resuming counts the same as one passed with the resume: + * No prompt: the call is still pending. Make the tool available and resume again without a prompt, and the call runs first. + * A prompt: Claude Code answers it without the tool’s result, and the deferred call is gone. Send a new prompt if you still need the tool called. + * Any other value: the turn ended on an error that Claude Code reported in place of a model response, such as an API error. Read `terminal_reason` for the cause, `result` for the message, and `api_error_status` for the HTTP status when the API returned one. * `api_error_status`: the HTTP status code of the terminating API error. `None` when the turn ended without one. Populated only on `subtype="success"`. * `result`: text of the final assistant message on `subtype="success"`, or `None` on the `error_*` subtypes. When `subtype="success"` and `is_error=True`, this holds the API error string if one is available but can be empty, so check `api_error_status` and the preceding `AssistantMessage` content for detail. * `errors`: loop-level error strings such as the max-turns message. Populated only on the `error_*` subtypes. @@ -2230,11 +2235,11 @@ errors: list[str] # an empty list when the result message reported none result: str | None api_error_status: int | None - terminal_reason: str | None # "max_turns", "api_error", ...; check this before subtype + terminal_reason: str | None # "max_turns", "api_error", ...; check after data["stop_reason"], before subtype session_id: str | None data: dict[str, Any] # the raw result message payload -To tell failures apart, check `terminal_reason` before `subtype`. When the final request fails, such as on an API error, Claude Code reports `subtype` `"success"` with the cause in `terminal_reason`, for example `"api_error"`; when a limit you set ends the run, such as `max_turns` or `max_budget_usd`, it reports an `error_*` subtype. +To tell failures apart, check `data["stop_reason"]` first, then `terminal_reason`, then `subtype`. A declined response has `stop_reason` `"refusal"`, usually with `subtype` `"success"`; its `terminal_reason` doesn’t single it out and can read `"completed"` or `"api_error"`. A failed final request has `subtype` `"success"` and its cause in `terminal_reason`, such as `"api_error"` for an API error. When the run hits a limit you set, such as `max_turns` or `max_budget_usd`, you get an `error_*` subtype. ### @@ -3640,10 +3645,12 @@ "Claude Code CLI not found. Try reinstalling: pip install --force-reinstall claude-agent-sdk" ) # Catch ResultError before ProcessError, which it subclasses. Its message - # carries the error text. A failed final request, such as an API error, - # arrives with subtype "success", so branch on terminal_reason first. + # carries the error text. A refusal and a failed final request both usually + # arrive with subtype "success", so check stop_reason, then terminal_reason. except ResultError as e: - if e.terminal_reason == "api_error": + if e.data.get("stop_reason") == "refusal": + print(f"Model declined to respond: {e}") + elif e.terminal_reason == "api_error": print(f"API request failed: {e}") else: print(f"Query ended with an error result ({e.terminal_reason or e.subtype}): {e}")
modified Mods reference View current →
--- a/reference.md +++ b/reference.md @@ -60,7 +60,7 @@ Event| Fires when| A hook can return ---|---|--- [`tool.call`](</docs/en/plugins/mods/events#guard-or-change-a-tool-call>)| A tool is about to run| `next(e)`, `{ deny: reason }`, or `{ result }` -[`tool.check`](</docs/en/plugins/mods/events#where-settings-hooks-run-in-the-order>)| Claude Code decides whether a tool call may run, after the `tool.call` and `PreToolUse` hooks. `next(e)` resolves to the decision the rules, the permission mode, and those hooks reached.| `{ decision }`, which is `allow`, `ask`, or `deny` +[`tool.check`](</docs/en/plugins/mods/events#where-settings-hooks-run-in-the-order>)| Claude Code decides whether a tool call may run, after the `tool.call` and `PreToolUse` hooks. `next(e)` resolves to the decision the rules, the permission mode, and those hooks reached.| `next(e)` or `{ decision }`, with `decision` set to `allow`, `ask`, or `deny` and an optional `reason` `tool.describe`| Once for each tool, when its description is first sent to Claude. A second time for an MCP tool when Claude loads it through [tool search](</docs/en/mcp#scale-with-mcp-tool-search>), with `e.description` set to the text Claude reads for the loaded tool.| `{ description }`, optionally with `isDeferred` set to `true` to put the tool behind tool search or `false` to load it upfront #### @@ -75,6 +75,14 @@ * **`e.ceiling`** : `ask` for a connector tool your organization set to `ask`, in [sessions where that setting reaches Claude Code](</docs/en/mcp#organization-controls-on-connector-tools>) On `tool.check`, `e.agentId` and `e.ceiling` require Claude Code v2.1.290 or later. + +#### + +​ + +The `e.isReadOnly` field on `tool.check` + +In a `tool.check` hook, `e.isReadOnly` is `true` when the tool reports this call as read-only. Otherwise the field is absent, not `false`. The value is the tool’s own report, so read [Check whether a tool call is read-only](</docs/en/plugins/mods/events#check-whether-a-tool-call-is-read-only>) before you approve a call on this field alone. On `tool.check`, `e.isReadOnly` requires Claude Code v2.1.304 or later. ### @@ -250,7 +258,7 @@ Namespace| Methods ---|--- `$.plugin`| `name`, `root`: this plugin’s name and directory -[`$.ui`](</docs/en/plugins/mods/interface#pick-where-to-draw>)| `resolve`, `invalidate`, `open`, `close`, `panes`, `focus`, `scroll`, `toast`, `status`, `log`, `notice`, `ask`, `copy`, `selection`, `blit` +[`$.ui`](</docs/en/plugins/mods/interface#pick-where-to-draw>)| `resolve`, `invalidate`, `open`, `close`, `panes`, `focus`, `scroll`, `toast`, `notify`, `status`, `log`, `notice`, `ask`, `copy`, `selection`, `blit` [`$.command`](</docs/en/plugins/mods/api#add-a-command>)| `register`, `run`, `list` [`$.tool`](</docs/en/plugins/mods/api#add-a-tool>)| `register`, `call`, `check`, `list` `$.agent`| `register`, `spawn`, `list`. `list()` returns this session’s subagents and teammates, each with a `status` of `pending`, `running`, `waiting`, `idle`, `completed`, `failed`, or `killed`, where `idle` and `waiting` require Claude Code v2.1.289 or later. @@ -324,7 +332,7 @@ `Svg`| An SVG document, up to 131,072 characters| | ✓| ✓ [`Client`](</docs/en/plugins/mods/interface#build-a-tree-from-elements>)| `module`, `key`| ✓| ✓| [`Raster`](</docs/en/plugins/mods/interface#draw-a-grid-of-colored-cells>)| `key`, `columns` up to 512, `rows` up to 256, `cells`. See [Draw a grid of colored cells](</docs/en/plugins/mods/interface#draw-a-grid-of-colored-cells>).| ✓| | -`Image`| PNG or RGBA bytes up to 2 MiB, or a file path, `columns` and `rows` up to 255, and `alt` text.| ✓| | +`Image`| PNG or RGBA bytes up to 2 MiB, or a file path, `columns` and `rows` up to 255, and `alt` text. See [which terminals draw it](</docs/en/plugins/mods/gallery#image-and-client>).| ✓| | More `Button` rules: `action` names one of Claude Code’s own [keybinding actions](</docs/en/keybindings>), and the user’s binding for it presses the button when that binding is a chord or a modified key. A digit `hotkey` on a button in the band also fires when the user types that digit alone into an empty prompt and pauses. When two buttons in one drawing name the same `hotkey`, the later one gets it. `autoFocus` accepts only `true` on any control, so omit the prop to leave it off. The VS Code extension ignores some element props and draws the element as if you had left them out:
modified Continue local sessions from any device with Remote Control View current →
--- a/remote-control.md +++ b/remote-control.md @@ -59,10 +59,10 @@ `-c`, `--continue`| Bring back the session that the last server in this directory started with, instead of creating a new one. See Resume sessions after stopping the server. Can’t be combined with `--session-id`, `--spawn`, `--capacity`, or `--create-session-in-dir`. Requires Claude Code v2.1.200 or later. `--session-id <id>`| Bring back one session by its ID. See Resume sessions after stopping the server. Can’t be combined with `--continue`, `--spawn`, `--capacity`, or `--create-session-in-dir`. Requires Claude Code v2.1.200 or later. `--spawn <mode>`| How the server creates sessions. -• `same-dir` (default): all sessions share the current working directory, so they can conflict if editing the same files. +• `same-dir` (default when no mode is saved): all sessions share the current working directory, so they can conflict if editing the same files. • `worktree`: each on-demand session gets its own [git worktree](</docs/en/worktrees>). Requires a git repository or a [`WorktreeCreate` hook](</docs/en/hooks#worktreecreate>). • `session`: single-session mode. Serves exactly one session and rejects additional connections. Set at startup only. -Press `w` at runtime to toggle between `same-dir` and `worktree`. +Press `w` at runtime to toggle between `same-dir` and `worktree`. The mode you switch to becomes the default for this project. `--capacity <N>`| Maximum number of concurrent sessions. Default is 32. Cannot be used with `--spawn=session`. `--[no-]create-session-in-dir`| Pre-create one session in the current directory when the server starts, so you have somewhere to type immediately. In `worktree` mode this session stays in the current directory while on-demand sessions get isolated worktrees. On by default. If you pass `--no-create-session-in-dir` to start with none, Claude Code archives the server’s sessions when you stop it, so there’s nothing to resume. `--permission-mode <mode>`| Set the starting [permission mode](</docs/en/permission-modes>) for the server’s sessions, such as `acceptEdits`. Accepts `manual` as an alias for `default`; an unrecognized mode stops the server at startup and lists the valid modes. @@ -72,7 +72,7 @@ `--verbose`| Show detailed connection and session logs. `--sandbox`, `--no-sandbox`| Removed in v2.1.300. If you pass either flag, the server [exits with an error](</docs/en/errors#sandbox-is-not-supported-by-claude-remote-control>) instead of starting. -If you pass a global `claude` flag before `remote-control`, or a wrapper script adds one, Claude Code doesn’t carry the flag over to the sessions the server creates. Claude Code lets the flag through only when dropping it is known not to change what those sessions can do, such as `--verbose` or `--model`. For any other flag, such as `--settings`, Claude Code [refuses to start](</docs/en/errors#not-carried-over-to-the-sessions-remote-control-starts>) and names the flag to remove.To sandbox the sessions the server starts, turn on [sandboxing](</docs/en/sandboxing>) in a settings file.Claude Code checks Remote Control eligibility before printing help, so `claude remote-control --help` returns an error instead of this flag list when you aren’t signed in with an eligible account. +If you pass a global `claude` flag before `remote-control`, or a wrapper script adds one, Claude Code doesn’t carry the flag over to the sessions the server creates. Claude Code lets the flag through only when dropping it is known not to change what those sessions can do, such as `--verbose` or `--model`. For any other flag, such as `--settings`, Claude Code [refuses to start](</docs/en/errors#not-carried-over-to-the-sessions-remote-control-starts>) and names the flag to remove.To sandbox the sessions the server starts, turn on [sandboxing](</docs/en/sandboxing>) in a settings file.To print the `remote-control` flags in your terminal, run `claude remote-control --help`. Before v2.1.302, without an eligible sign-in the command returned one of the errors under Troubleshooting instead. To start a normal interactive Claude Code session with Remote Control enabled, use the `--remote-control` flag (or `--rc`): @@ -150,7 +150,7 @@ * **Compaction and`/clear`**: while Claude Code [compacts the conversation](</docs/en/context-window#what-survives-compaction>), connected devices show the progress and then where the conversation was compacted. When you run `/clear`, the conversation resets on connected devices too. * **Switching conversations with`/resume`**: the connected device doesn’t receive the switched-to conversation’s title or earlier history, but new messages in both directions go to and from whichever conversation is open in your terminal. To work on the original conversation from the device again, run `/resume` in your terminal and switch back to it. * **Pulling a session with`/teleport`**: when you pull a [cloud session](</docs/en/claude-code-on-the-web#from-cloud-to-terminal>) into your terminal with `/teleport`, the connected device doesn’t receive the pulled conversation’s earlier history. New messages in both directions go to and from the pulled conversation, which is now the one open in your terminal. - * **Messages from your other sessions** : with [cross-session messaging](</docs/en/cross-session-messaging>), the same connection carries messages between your own sessions on different machines and from your [cloud sessions](</docs/en/claude-code-on-the-web>). + * **Messages from your other sessions** : with [cross-session messaging](</docs/en/cross-session-messaging>), the same connection carries messages between your own sessions on different machines. * **Diff of your changes** : when the session’s directory is in a git repository, a connected device’s diff pane shows your changes. On a branch that has commits ahead of the repository’s default branch, the pane shows the changes since the branch split from it, including your uncommitted edits. On the default branch itself, or on a branch that isn’t ahead of it, the pane shows only your uncommitted changes. * **Model** : when you pick a [model](</docs/en/model-config>) from a connected device, Claude Code runs the session on that model. Requires Claude Code v2.1.238 or later. A model you pick from the device’s model control applies to the current session only. When you send `/model <name>` from the device to an interactive session, Claude Code also sets your default for new sessions. * **Effort level** : when you set the [effort level](</docs/en/model-config#adjust-effort-level>) from a connected device, with `/effort` or the device’s effort control, Claude Code applies it to the session on your machine. If you pinned a level with `CLAUDE_CODE_EFFORT_LEVEL`, the session keeps that level, and Claude Code refuses a different pick from the effort control. Picking a level from the effort control requires Claude Code v2.1.234 or later on your machine. @@ -166,7 +166,7 @@ * **`true`** : connect automatically when an interactive session starts. * **`false`** : turn auto-connect off, though a `true` from [managed settings](</docs/en/managed-settings>) outranks it, because Claude Code saves the choice to your user settings. A `false` in project or local settings (`.claude/settings.json`, `.claude/settings.local.json`) turns auto-connect off even over a managed `true`. - * **`default`** : clear your choice and follow your organization’s admin default if one is set, otherwise Claude Code’s current default. + * **`default`** : clear your choice and follow your organization’s admin default if one is set, otherwise Claude Code’s current default. If you set `DISABLE_TELEMETRY` or `DO_NOT_TRACK`, see Auto-connect with `DISABLE_TELEMETRY` or `DO_NOT_TRACK` set. The VS Code extension and the Desktop app also have an auto-connect toggle: @@ -174,6 +174,17 @@ * **Desktop app** : **Settings > Claude Code > Connect new sessions to Remote Control**. See [Control which sessions appear on your other devices](</docs/en/desktop#control-which-sessions-appear-on-your-other-devices>). To turn auto-connect on from a settings file instead, set [`remoteControlAtStartup`](</docs/en/settings-reference#remotecontrolatstartup>) to `true` in your user `~/.claude/settings.json` or in [managed settings](</docs/en/managed-settings>). In project or local settings (`.claude/settings.json`, `.claude/settings.local.json`), Claude Code honors a `false` and turns auto-connect off for that repository, but ignores a `true`, so a checked-in file can’t turn on Remote Control for everyone who opens the repository. Auto-connect signs in with your own claude.ai account, so a session it starts appears only in your own account’s Claude apps and grants no one else access. With this setting on, each interactive Claude Code process registers one remote session. If you run multiple instances, each one gets its own remote session. To run multiple concurrent sessions from a single process, use server mode instead. + +#### + +​ + +Auto-connect with `DISABLE_TELEMETRY` or `DO_NOT_TRACK` set + +With only `DISABLE_TELEMETRY` or `DO_NOT_TRACK` set, your sessions don’t auto-connect through your organization’s admin default or Claude Code’s own default. If something else makes Remote Control unavailable for you, such as `DISABLE_GROWTHBOOK` or an LLM gateway, start with Requirements instead. Turning auto-connect on with only `DISABLE_TELEMETRY` or `DO_NOT_TRACK` set requires Claude Code v2.1.283 or later. To auto-connect, check whether your organization requires Trusted Devices: + + * **Not required** : set **Enable Remote Control for all sessions** to `true` in `/config`. + * **Required** : Remote Control isn’t available while `DISABLE_TELEMETRY` or `DO_NOT_TRACK` is set. Unset whichever of the two variables you set. If your sessions still don’t auto-connect, set **Enable Remote Control for all sessions** to `true` in `/config`. ### @@ -188,6 +199,17 @@ * **`claude remote-control --session-id<id>`**: brings back only the session whose ID you pass, and exits when that session ends. The ID is the part of the session’s URL at claude.ai/code between `/code/` and any `?`. These commands work for about four hours after the server stopped. After that, run `claude remote-control` to start a new session. If you archived a session in the meantime, `--continue` and `--session-id` unarchive it on Claude Code v2.1.228 or later. To bring back a session you started with `claude --remote-control` or `/remote-control`, resume the conversation with `claude --continue` or `claude --resume`. For the permission mode that the resumed conversation starts in, see [permission mode on resume](</docs/en/sessions#permission-mode-on-resume>). If Remote Control doesn’t reconnect, see Couldn’t reconnect to your Remote Control session. If you resume the conversation in a second terminal while the first one still has Remote Control on, Claude Code prints a `Remote Control not started here` notice in the second terminal and leaves Remote Control off there instead of taking the session away from the first. Run `/remote-control` in the second terminal to move Remote Control to it. When you resume a conversation in Claude Desktop or an IDE extension that had Remote Control on, Claude Code reattaches it to the existing claude.ai session instead of adding a new one to the session list. + +### + +​ + +Set the default spawn mode for a project + +If `claude remote-control` prints `Spawn mode: <mode> (saved for this folder; press w to change)` at startup, the server is starting in a spawn mode saved earlier for this project. The saved mode comes from a choice you made in your own terminal. If `claude remote-control` asked `Spawn mode for this project:` there, Claude Code kept what you answered: `1` for `same-dir` or `2` for `worktree`. If you pressed `w` while it ran, Claude Code kept the mode you switched to, even on a run you started with `--spawn same-dir` or `--spawn worktree`. + + * While the server runs in `same-dir` or `worktree` mode, press `w` in the server’s terminal to switch to the other one. Switching requires a git repository or a `WorktreeCreate` hook. + * To use a different mode for one run, pass `--spawn <mode>`. ##
modified Automate work with scheduled tasks View current →
--- a/routines.md +++ b/routines.md @@ -38,7 +38,7 @@ Create a scheduled task -Create a scheduled task from the web at [claude.ai/code/routines](<https://claude.ai/code/routines>), from the Desktop app, or from the CLI. All three surfaces write to the same cloud account, so a scheduled task you create in one shows up in the others immediately. In the Desktop app’s **Code** tab, click **Scheduled** in the sidebar or in the sidebar’s **More** menu, then **New task** , and continue with Create from the web. Scheduled tasks run autonomously as full Claude Code cloud sessions. You don’t choose a permission mode. The session runs shell commands, uses [skills](</docs/en/skills>) committed to the cloned repository, and calls any connectors you include, all without stopping for approval apart from some artifact actions. What a scheduled task can reach is determined by: +Create a scheduled task from the web at [claude.ai/code/routines](<https://claude.ai/code/routines>), from the Desktop app, or from the CLI. All three surfaces write to the same cloud account, so a scheduled task you create in one shows up in the others immediately. In the Desktop app’s **Code** tab, click **Scheduled** in the sidebar or in the sidebar’s **More** menu, then **New task** , and continue with Create from the web. Scheduled tasks run autonomously as full Claude Code cloud sessions. You don’t choose a permission mode. The session runs shell commands, uses [skills](</docs/en/skills>), and calls any connectors you include, all without stopping for approval apart from some artifact actions. Outside a [project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>), those skills include the ones committed to the cloned repository. What a scheduled task can reach is determined by: * The repositories you select * The [environment’s](</docs/en/cloud-environments>) network access and variables @@ -378,7 +378,7 @@ Scheduled tasks can use your connected MCP connectors to read from and write to external services during each run. For example, a task that triages support requests might read from a Slack channel and create issues in Linear. Connectors are the [claude.ai integrations](</docs/en/mcp#use-mcp-servers-from-claude-ai>) on your account. MCP servers you added locally in the CLI with `claude mcp add` are stored on your machine rather than your claude.ai account, so they do not appear in the connectors list. To use one of those servers in a scheduled task: * **As a connector** : add it as a connector at [claude.ai/customize/connectors](<https://claude.ai/customize/connectors>) - * **In the repository** : for a scheduled task with one repository, you can instead declare the server in a committed [`.mcp.json`](</docs/en/mcp#project-scope>) so it is part of the cloned repository + * **In the repository** : for a scheduled task with one repository outside a [project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>), you can instead declare the server in a committed [`.mcp.json`](</docs/en/mcp#project-scope>). A scheduled task in a project doesn’t load `.mcp.json`, so add the server as a connector When you create a scheduled task, all of your currently connected connectors are included by default. Remove any that aren’t needed to limit which tools Claude has access to during the run. You can also add connectors directly from the task’s creation or edit dialog. To manage or add connectors outside of that dialog, visit [claude.ai/customize/connectors](<https://claude.ai/customize/connectors>) or use `/schedule update` in the CLI.
modified Configure the sandboxed Bash tool View current →
--- a/sandboxing.md +++ b/sandboxing.md @@ -514,6 +514,14 @@ If a symlink appears at a protected settings file’s path during the session, the sandbox also denies writes to the file it points to, starting with the next command. There is no way to exempt one of these paths: an `allowWrite` entry or an `Edit` allow rule that covers the path doesn’t lift the protection. The only way to turn the protection off is `filesystem.disabled`, which turns off filesystem isolation for every path. To see most of these paths resolved for your machine, run `/sandbox` and open the **Config** tab, which lists them under **Denied within allowed** , mixed in with your own `denyWrite` entries. If `git merge` or `git checkout` fails with `unable to unlink old` on one of these paths, see A git command fails with `unable to unlink old`. +#### + +​ + +Denied paths that pass through a symlink + +On macOS, when a denied path passes through a symlink, such as a `~/.claude` that is a link into a dotfiles repository, the sandbox also denies the path’s real location. This covers the sandbox’s own denials and your literal `denyWrite` and `denyRead` entries. + ### ​ @@ -980,7 +988,15 @@ ✗ Sandbox settings not changed: /home/you/project/.claude/settings.local.json couldn't be updated (EACCES). Start Claude Code in a project folder you can write to. -If the reason in parentheses is `EACCES`, `EPERM`, or `EROFS`, start Claude Code in a project folder you can write to, then run `/sandbox` again in that session. If the reason begins with `Invalid JSON syntax in settings file`, correct the JSON in your project’s `.claude/settings.local.json`, then run `/sandbox` again. +If the reason in parentheses is `EACCES`, `EPERM`, or `EROFS`, start Claude Code in a project folder you can write to, then run `/sandbox` again in that session. If the reason begins with `Invalid JSON syntax in settings file`, correct the JSON in your project’s `.claude/settings.local.json`, then run `/sandbox` again. If no writable project folder is available to you, turn the sandbox on from your user settings instead. Add this to `~/.claude/settings.json`: + + { + "sandbox": { + "enabled": true + } + } + +This turns on auto-allow mode. For regular permissions mode, also set [`sandbox.autoAllowBashIfSandboxed`](</docs/en/settings-reference#sandbox-autoallowbashifsandboxed>) to `false`. The change takes effect in your running session at the next shell command Claude runs, and the **Mode** tab of `/sandbox` then marks the mode in effect. ##
modified Customize sessions in self-hosted environments View current →
Show diff (116 lines)
--- a/self-hosted-environments-configuration.md +++ b/self-hosted-environments-configuration.md @@ -291,7 +291,7 @@ `CLAUDE_RUNNER_ATTEMPT`| A per-session counter to use for logging. It isn’t a retry count or a request count. `0` for pre-warming requests, though a request for a session can carry `0` too. `CLAUDE_RUNNER_ORDER_SERVER_TIME`| Server time from the poll response’s HTTP `Date` header. When the hook verifies the work-order JWT’s `exp`, compare against this value instead of the local clock to tolerate skew. Empty when the gateway omitted the header. `CLAUDE_RUNNER_POOL_ID`| The ID of the environment the new runner should join, in `ccpool_...` form -`CLAUDE_RUNNER_ACCOUNT_ID`| Tagged ID of the account that enqueued the session, for per-account routing, quota, or chargeback. Empty when unavailable, and always empty for Claude Tag channel sessions, which no account enqueues. +`CLAUDE_RUNNER_ACCOUNT_ID`| Tagged ID of the account that enqueued the session. Use it for per-account routing, quota, or chargeback, not as a dedup key. Empty when unavailable, and always empty for Claude Tag channel sessions, which no account enqueues. `CLAUDE_RUNNER_ACCOUNT_EMAIL`| Email of the account that enqueued the session. Empty when unavailable. Treat the email as personally identifiable information and don’t log it. `CLAUDE_RUNNER_PRIMARY_REPO_URL`| URL of the session’s first git source, for routing to a runner with that repository pre-warmed. Empty when the session has no git sources. `CLAUDE_RUNNER_PRIMARY_REPO_REVISION`| Revision of the session’s first git source: branch, SHA, tag, or full reference name. Empty when unspecified. @@ -314,7 +314,7 @@ * **Exit 0** : submitted. * **Exit 1, or still running when`--hook-timeout` ends**: retryable failure. The session backs off and is re-offered. * **Exit 2 or higher** : non-retryable failure. The session is blocked from spawning again until a user sends it a new message or an [Owner](</docs/en/cloud-environments#organization-shared-environments>) selects **Retry** on it in the environment’s **Activity** tab. -On non-zero exit, the tail of the hook’s stderr appears in the **Activity** tab as the failure reason, so write the actionable error to stderr and never write secrets there. In a shell hook, keep transient failures retryable. A pre-warming request has no session to fail: the orchestrator logs a non-zero exit locally only, and the server re-requests the spawn after the `--expected-spawn-seconds` lease expires. +While a session backs off, it shows **Queued** in the **Activity** tab with no spawn error, so read the hook’s output in the orchestrator’s log. Once blocked, the session shows **Failed**. Expand it to read the spawn error, taken from the last 512 characters of the hook’s stderr. Write an actionable error to stderr, and no secrets. In a shell hook, keep transient failures retryable. A pre-warming request has no session to fail: the orchestrator logs a non-zero exit locally only, and the server re-requests the spawn after the `--expected-spawn-seconds` lease expires. 4. **Set`--expected-spawn-seconds` to at least your p99 time from spawn request to runner registration.** Measure from when the orchestrator receives the spawn request, and include any wait for capacity on your platform as well as boot time. This value is the server-side lease, and the work order expires with it, so a runner whose workload takes longer can’t register. All orchestrator replicas must use the same value. Everything the hook writes to stdout or stderr appears in the orchestrator’s log with credentials automatically redacted. If sessions stay queued, check the orchestrator’s `/healthz` body for queue counts, then open your environment’s **Activity** tab on the [**Cloud environments** admin page](<https://claude.ai/admin-settings/cloud-environments>): expand a failed session there for its spawn error, and select **Retry** to re-request it. A session that stays queued with no spawn error in the **Activity** tab can mean the hook is keyed on the session ID. To confirm, check whether your platform has a workload for that session’s first spawn request and none for the re-requests. If so, key the workload on `CLAUDE_RUNNER_ORDER_ID` instead. @@ -339,6 +339,26 @@ ​ +Send a background process’s output to a file + +If your `spawn-runner` hook leaves a process running in the background, send that process’s output to a file that the hook’s user can create. For example, append `>> "$HOME/claude-runner.log" 2>&1` to the command that starts the process, ahead of any `&`. This hook line shows where the redirect goes, with `your-background-command` standing in for the command your hook backgrounds: + + your-background-command >> "$HOME/claude-runner.log" 2>&1 & + +Without the redirect, the process writes to the hook’s stdout and stderr: + + * About a second after the hook exits, the orchestrator logs `exited, but a process it started still has the hook's stdout or stderr open`. From that line on, it logs up to 64 KB more of that output under `[runner:hook:spawn-runner:after-exit jti=<order id>]` and then drops the rest. + * Once the orchestrator exits, the process’s writes there fail. + +A runner your hook starts itself runs sessions on the orchestrator host, which holds the [environment secret](</docs/en/self-hosted-environments-deploy#harden-your-deployment>). Before v2.1.305, a hook that had exited still reached [`--hook-timeout`](</docs/en/self-hosted-environments-reference#orchestrator-cli-flags>) while a process it started had the hook’s stdout or stderr open, shown as: + + * **Activity tab** , in a failed session’s spawn error: `spawn-runner hook timed out after 60000ms`, or the last lines on the hook’s stderr. + * **Orchestrator log** : `timed out after 60000ms, sending SIGTERM to process tree`. + +#### + +​ + Keep transient failures retryable in a shell hook In a shell hook that uses `set -e`, a failure that a retry could have cleared can block the session. The hook stops at the failing command and exits with that command’s own status, and the orchestrator applies the exit-code contract to that status. Many failures return a status of 2 or higher, such as `127` when a command isn’t installed and `22` from `curl --fail` on an HTTP error, so they block the session at its first failure. A session the hook has already blocked stays blocked until a user sends it a new message or an [Owner](</docs/en/cloud-environments#organization-shared-environments>) selects **Retry** on it in the environment’s **Activity** tab. To turn such a failure into exit 1 instead, put these lines directly below the hook’s `#!` line, above anything that can fail: @@ -355,7 +375,17 @@ trap 'rc=$?; your-cleanup-command || true; [ "$rc" -eq 0 ] || [ -n "${PERMANENT:-}" ] || exit 1' EXIT - * **Commands that are allowed to fail** : if the hook didn’t use `set -e` before, it now stops at the first command that returns non-zero, such as a lookup that finds nothing or a duplicate submit that your platform rejects. If the hook acts on the result, make that command the condition of an `if`. If it ignores the result, follow the command with `|| true`. + * **Commands that are allowed to fail** : if the hook didn’t use `set -e` before, it now stops at the first command that returns non-zero, such as a lookup that finds nothing. If the hook acts on the result, make that command the condition of an `if`. If it ignores the result, follow the command with `|| true`. + * **The command that submits the workload** : don’t follow it with `|| true`. With `|| true`, the hook exits 0 even when your platform refuses the submit, for example over quota, and the session waits for a runner that was never started. Name the workload after `CLAUDE_RUNNER_ORDER_ID`, as the hook’s first rule says. An already-exists answer is then a redelivery of the same request, so treat that answer alone as success. For anything else, print the answer to stderr and exit 1, or call `permanent` if no retry can fix it. This example does that for `kubectl create`, with a `job.yaml` that holds only the workload: + + if ! out=$(kubectl create -f job.yaml 2>&1); then + case "$out" in + *AlreadyExists*) ;; + *) printf '%s\n' "${out:-kubectl create failed}" >&2; exit 1 ;; + esac + fi + +The orchestrator’s log then shows that message. If the hook creates other objects, name each after the order ID, give it its own command, and treat its already-exists answer as success in the same way. For an object that holds a secret, print a fixed message in place of the command’s output. To confirm the trap works, add a line directly below the `trap` line that calls a command that doesn’t exist, such as `no-such-command`. Run the hook file from your shell and check that `echo $?` prints `1`, then remove the line. @@ -458,10 +488,14 @@ * The enterprise-scope [managed MCP file](</docs/en/managed-mcp>) at its standard system path: `/etc/claude-code/managed-mcp.json` on Linux runner hosts, `/Library/Application Support/ClaudeCode/managed-mcp.json` on macOS hosts. Use it for locked-down fleets where only administrator-listed servers may load. See [exclusive control with managed-mcp.json](</docs/en/managed-mcp#exclusive-control-with-managed-mcp-json>) for the precedence rules. When this file is on the runner host, Claude Code skips the MCP servers Anthropic’s control plane delivers to a session, including claude.ai connectors, and names them in a warning on the session child’s stderr, which the runner records at the `debug` log level. Before v2.1.229, those sessions exited at startup with `You cannot dynamically configure MCP servers when an enterprise MCP config is present`. * The [`managedMcpServers`](</docs/en/settings-reference#managedmcpservers>) key in [managed settings](</docs/en/managed-settings>) on the runner host: provides HTTP and SSE servers without taking exclusive control, so servers from the other sources still load. Requires Claude Code v2.1.259 or later. - * `<repo>/.mcp.json`: project scope. Commit the file to the repository; its servers are auto-approved in cloud sessions. In a session with several repositories, at most one repository’s file loads. + * `<repo>/.mcp.json`: project scope. Outside a [project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>) thread, commit the file to the repository, and its servers are auto-approved in cloud sessions. In a session with several repositories, at most one repository’s file loads. * A [`--mcp-config`](</docs/en/cli-reference#cli-flags>) file from your wrapper script: append the flag after `"$@"`, as in `exec "$CLAUDE_RUNNER_CLAUDE_BIN" "$@" --mcp-config /etc/claude/mcp.json`. To keep that file’s servers running when the session’s delivered servers are updated mid-session, have your wrapper pass the full environment to the child, as `exec` does. Before v2.1.299, the stdio, HTTP, and SSE servers in that file shut down at the first such update that didn’t name them. -When connector delivery is enabled for your organization, Anthropic’s control plane delivers the connectors you’ve configured on claude.ai to interactively-created sessions through server-provided MCP configuration, routed through `api.anthropic.com`. Sessions created programmatically, such as [CLI dispatches](</docs/en/self-hosted-environments-testing#run-the-test-loop>), don’t receive connector delivery; give them MCP servers through any of the other sources this section lists instead. The child’s OAuth token doesn’t carry a scope for fetching connectors directly, so the child doesn’t attempt that fetch itself; delivery is server-driven. `settings.json` doesn’t carry MCP server definitions, and there is no top-level `mcpServers` field in the settings schema. In managed settings, provide servers with the [`managedMcpServers`](</docs/en/settings-reference#managedmcpservers>) key instead. Sessions inherit the runner’s environment, so set [`ENABLE_TOOL_SEARCH`](</docs/en/mcp#scale-with-mcp-tool-search>) there to control MCP tool search for every session a runner spawns; the MCP page covers the values. +When connector delivery is enabled for your organization, Anthropic’s control plane delivers the connectors you’ve configured on claude.ai to interactively-created sessions through server-provided MCP configuration, routed through `api.anthropic.com`. Sessions created programmatically, such as [CLI dispatches](</docs/en/self-hosted-environments-testing#run-the-test-loop>), don’t receive connector delivery; give them MCP servers through any of the other sources this section lists instead. The child’s OAuth token doesn’t carry a scope for fetching connectors directly, so the child doesn’t attempt that fetch itself; delivery is server-driven. + +In a session that received a connector, a server of the same name from the host’s `.claude.json` or a repository’s `.mcp.json` isn’t connected. To use both, give your server a different name. + +`settings.json` doesn’t carry MCP server definitions, and there is no top-level `mcpServers` field in the settings schema. In managed settings, provide servers with the [`managedMcpServers`](</docs/en/settings-reference#managedmcpservers>) key instead. Sessions inherit the runner’s environment, so set [`ENABLE_TOOL_SEARCH`](</docs/en/mcp#scale-with-mcp-tool-search>) there to control MCP tool search for every session a runner spawns; the MCP page covers the values. ### @@ -628,7 +662,7 @@ The runner gives each session its own config directory, seeded from a snapshot of the host’s `~/.claude/` that the runner captures once at startup: `settings.json`, `CLAUDE.md`, hooks, agents, commands, and skills in your runner image apply to every session as the user-level baseline. If you change config on a running host, the change takes effect only after you restart the runner. Set `SELF_HOSTED_RUNNER_HOST_CONFIG_DIR` to seed from a different path, or point it at an empty directory to disable seeding. Sessions also read these settings files: - * **Project settings** : a repository-committed `.claude/settings.json` layers on top of the user-level baseline. In a session with several repositories, at most one repository’s file takes effect. + * **Project settings** : outside a [project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>) thread, a repository-committed `.claude/settings.json` layers on top of the user-level baseline. In a session with several repositories, at most one repository’s file takes effect. * **Managed settings** : sessions read [`managed-settings.json`](</docs/en/settings#where-settings-live>) from the standard system path in your runner image. For whether its keys apply alongside [server-managed settings](</docs/en/server-managed-settings>), see [how Claude Code combines managed sources](</docs/en/managed-settings#how-claude-code-combines-managed-sources>). For the order these sources apply in, see [settings precedence](</docs/en/settings#settings-precedence>). When Anthropic’s control plane supplies a session with [Claude Code hooks](</docs/en/hooks>), the runner installs them alongside, not over, your own configuration. Requires Claude Code v2.1.229 or later. @@ -637,7 +671,7 @@ * **Who authors them** : the control plane populates the scripts from fixed constants in its own deployment, never from per-session or third-party input. * **What still governs them** : hooks delivered through `--settings` enter the ordinary merged hook configuration, not the managed tier, so your managed settings still apply. `disableAllHooks` disables them, and they are not among the categories [`allowManagedHooksOnly`](</docs/en/settings-reference#allowmanagedhooksonly>) keeps loaded. -When a person starts their own session, Claude Code also downloads the [skills enabled for their claude.ai account](</docs/en/skills#skills-in-cowork-and-cloud-sessions>) into that session’s config directory. A [cloud scheduled task](</docs/en/routines>) run doesn’t get its owner’s skills, and a session that sends model requests to Bedrock or Agent Platform doesn’t download any. For a skill those sessions need, commit it to the repository’s `.claude/skills/` or add it to your runner image. Outside [Claude Tag](<https://claude.com/docs/claude-tag/overview>) sessions, a session in a self-hosted environment runs with [auto memory](</docs/en/memory#auto-memory>) off by default. For instructions that should carry across sessions, use the `CLAUDE.md` in your runner image or in the repository. The runner’s snapshot of the host’s `~/.claude/` leaves out the `projects/` directory. Auto memory’s default storage location is under that directory. If you put memory files there, the runner doesn’t seed them into sessions, and they don’t turn auto memory on. +When a person starts their own session, Claude Code also downloads the [skills enabled for their claude.ai account](</docs/en/skills#skills-in-cowork-and-cloud-sessions>) into that session’s config directory. A [cloud scheduled task](</docs/en/routines>) run doesn’t get its owner’s skills, and a session that sends model requests to Bedrock or Agent Platform doesn’t download any. For a skill those sessions need, add it to your runner image or, outside a [project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>), commit it to the repository’s `.claude/skills/`. Outside [Claude Tag](<https://claude.com/docs/claude-tag/overview>) sessions, a session in a self-hosted environment runs with [auto memory](</docs/en/memory#auto-memory>) off by default. For instructions that should carry across sessions, use the `CLAUDE.md` in your runner image or in the repository. The runner’s snapshot of the host’s `~/.claude/` leaves out the `projects/` directory. Auto memory’s default storage location is under that directory. If you put memory files there, the runner doesn’t seed them into sessions, and they don’t turn auto memory on. ### @@ -645,12 +679,12 @@ Repository settings in sessions with several repositories -In a session with several repositories, Claude Code reads project settings from the directory the session starts in, so at most one repository’s `.claude/settings.json` takes effect as project settings. A hook defined in another repository’s file doesn’t run, a deny rule in it doesn’t apply, and its `env` isn’t set. +In a thread in a [project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>), no repository’s `.claude/settings.json` takes effect as project settings and no repository’s `.mcp.json` or skills load, wherever the thread starts. To give those threads a skill, add it to your runner image. In any other session with several repositories, Claude Code reads project settings from the directory the session starts in, so at most one repository’s `.claude/settings.json` takes effect as project settings. A hook defined in another repository’s file doesn’t run, a deny rule in it doesn’t apply, and its `env` isn’t set. * **`--capacity 1`, the default, with the built-in checkout**: the session starts in the first repository in its list of repositories. That repository’s `.claude/settings.json` takes effect as project settings and its `.mcp.json` loads, and the other repositories’ don’t. * **A`--capacity` above one, or a `checkout` hook**: the session starts in a per-session directory that contains the checkouts. No repository’s `.claude/settings.json` takes effect as project settings, no repository’s `.mcp.json` loads, and [`$CLAUDE_PROJECT_DIR`](</docs/en/hooks#reference-scripts-by-path>) in a hook command is that directory, not a checkout. -Each repository’s `CLAUDE.md` and skills load wherever the session starts. The runner passes every repository to Claude Code as an [additional directory](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>), so Claude Code also reads the `enabledPlugins` and `extraKnownMarketplaces` keys from each repository’s `.claude/settings.json`. To run a hook or apply a permission rule in every session, put it in `~/.claude/settings.json` on the runner host. The runner seeds the host file into every session, wherever the session starts. Write a path in a `Read` or `Edit` rule as a `//` absolute or `~/` home-relative [pattern](</docs/en/permissions#read-and-edit>), because other patterns anchor at the settings source or the current directory. +Each repository’s `CLAUDE.md` loads wherever the session starts. Outside a project thread, its skills load too. The runner passes every repository to Claude Code as an [additional directory](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>), so Claude Code also reads the `enabledPlugins` and `extraKnownMarketplaces` keys from each repository’s `.claude/settings.json`. To run a hook or apply a permission rule in every session, put it in `~/.claude/settings.json` on the runner host. The runner seeds the host file into every session, wherever the session starts. Write a path in a `Read` or `Edit` rule as a `//` absolute or `~/` home-relative [pattern](</docs/en/permissions#read-and-edit>), because other patterns anchor at the settings source or the current directory. ###
modified Deploy self-hosted environments to production View current →
--- a/self-hosted-environments-deploy.md +++ b/self-hosted-environments-deploy.md @@ -68,7 +68,7 @@ These host-side flows do reach `claude.ai`, so run them from a host whose egress allows it rather than widening session-container egress: * **The one-line installer** : fetches `install.sh` from `claude.ai` at install time. - * **Interactive`claude auth login`**: signs in through `claude.ai`, `claude.com`, and `platform.claude.com`. The [guided setup](</docs/en/self-hosted-environments-quickstart#run-the-guided-setup>), `doctor`’s signed-in mode, and [CI dispatch](</docs/en/self-hosted-environments-testing#authenticate-from-ci>) use it. The browser you sign in with also loads the claude.ai sign-in page’s browser checks from `hcaptcha.com`, `*.hcaptcha.com`, and `challenges.cloudflare.com`. + * **Interactive`claude auth login`**: signs in through `claude.ai`, `claude.com`, and `platform.claude.com`. The [guided setup](</docs/en/self-hosted-environments-quickstart#run-the-guided-setup>), `doctor`’s signed-in mode, and [CI dispatch](</docs/en/self-hosted-environments-testing#authenticate-from-ci>) use it. The browser you sign in with also loads the claude.ai sign-in page’s browser checks from `hcaptcha.com`, `*.hcaptcha.com`, and `challenges.cloudflare.com`. If your organization uses single sign-on, that browser can also be redirected through `sso.claude.com`. ### @@ -188,7 +188,7 @@ With the Anthropic git proxy, also called Anthropic-managed git, the runner image needs no SSH keys, credential helper, `.netrc`, or other git credentials for the session itself. Instead, the runner asks Anthropic to serve git for its sessions. For a user’s session that Anthropic serves, the runner’s clone and the session’s own fetches and pushes go through Anthropic, which uses the GitHub OAuth token stored for the session’s creator. How Anthropic serves git for a session covers bot and agent sessions. The git proxy is off unless you turn it on. A runner that reaches your git host with its own credentials doesn’t need it, and its git works with any git host. In exchange, the git proxy limits what the runner supports and changes what it needs: * **github.com only** : Anthropic serves a session only when all of its repositories are on github.com, and the git proxy doesn’t support GitHub Enterprise Server yet. On a runner with the git proxy, a session with a repository on another git host fails to start. - * **Credentials for the session’s repositories only** : Anthropic supplies git credentials for the repositories that are part of the session, not for other repositories on the same git host. A private submodule, a dependency that your package manager fetches with git, or a plugin marketplace in another repository gets no credential from Anthropic. Ask the people who create sessions to [add every repository](</docs/en/web-quickstart#start-a-task>) a session needs when they create it. + * **Credentials for the session’s repositories only** : Anthropic supplies git credentials for the repositories that are part of the session, not for other repositories on the same git host. A private submodule, a dependency that your package manager fetches with git, or a plugin marketplace in another repository gets no credential from Anthropic. Ask the people who create sessions to [add every repository](</docs/en/web-quickstart#start-a-task>) a session needs when they create it. Each run of a [cloud scheduled task](</docs/en/routines>) is a session with the task’s repositories, so ask each task’s owner to [add every repository its runs need](</docs/en/routines#edit-and-control-routines>). * **Branch pushes only** : a push that deletes a branch fails, and so does a push to any other kind of ref, such as a tag. For which branches a push can update, see [GitHub proxy](</docs/en/cloud-environments#github-proxy>). * **Connected GitHub accounts** : ask each person who creates user sessions with a repository to [connect GitHub](</docs/en/web-quickstart#connect-github>). Without their own connection, those sessions don’t start. * **`--capacity 1`** : the git proxy requires one session per runner process, so run more replicas for parallelism. Turn the Anthropic git proxy on lists the requirements. @@ -591,7 +591,8 @@ * **Tracked changes reset, untracked files persist** : at `--capacity 1`, each session starts from a hard reset that wipes the previous session’s tracked modifications, but the runner never runs `git clean`, so untracked files from the locked owner’s earlier sessions stay in the tree. * **Per-session directories persist too** : alongside the checkout, the runner creates per-session entries under `<base-dir>/_sessions/` for every session it runs. The session’s Claude config directory holds a local copy of the conversation transcript. Next to it sit the session’s uploaded files, when the session has any. The session directory sits there too: it holds any per-session worktrees and `checkout` hook checkouts while the session runs, and it keeps whatever else Claude wrote in it. By default the runner leaves these in place when the session ends, so on a disk that outlives the runner process they accumulate. Every session runs as the runner’s own user, so any later session that disk serves can read them. If you keep a persistent `--base-dir`, size the volume for that growth. The same applies to any setup that restarts the runner on the same filesystem, including the Docker Compose recipe. * **With`--remove-session-state`, per-session directories don’t persist**: start the runner with [`--remove-session-state`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) to have it delete each session’s per-session directories as the session ends. The deletion is best-effort: the directories stay when the runner is killed before its cleanup runs. The canonical clone and files a session wrote elsewhere on the host, such as the temporary directory, stay regardless. - * **With the git proxy, the reset becomes a checkout** : with `--use-anthropic-git-proxy`, the runner sanitizes the clone’s `.git/` before each session, keeping the object store, refs, and shallow state but deleting the index, so each session pays a full working-tree checkout instead of a near-instant reset; it still never re-clones. Submodule pre-warms aren’t supported under the proxy. + * **With the git proxy, the reset becomes a checkout** : with `--use-anthropic-git-proxy`, the runner sanitizes the clone’s `.git/` before each session. It keeps the object store and shallow state, and deletes the index. Without the index, each session starts with a full working-tree checkout instead of a near-instant reset. The runner still fetches into the existing clone rather than cloning the repository again. Submodule pre-warms aren’t supported under the proxy. + * **With the git proxy, a`reftable` pre-warm loses its refs**: when the runner sanitizes `.git/` before each session, it keeps `.git/refs/` and removes the `.git/reftable/` directory. A clone pre-warmed in git’s `reftable` ref format loses its refs that way, so pre-warm the clone in git’s `files` ref format instead. * **Long clones need no workaround** : the runner bounds each git operation with a 120-second no-progress watchdog and a 30-minute hard cap, not a flat timeout, so a slow cold clone that keeps reporting progress completes. ## @@ -693,6 +694,11 @@ * **Runner doesn’t appear in the environment** : confirm the host can reach `api.anthropic.com` over HTTPS, the environment secret is current, and the host clock is within five minutes of real time; larger skew causes authentication to fail. The runner logs `[runner:fatal]` with the rejection reason on auth failure. * **Runner exits at startup with`cannot create or write to base directory`**: the runner can’t create or write to `--base-dir`, which defaults to `/workspace`. Fix the directory’s ownership or point `--base-dir` at a writable path, as described in Keep the base directory and capacity identical across runners. If the runner instead logs `[runner:fatal]` saying the base directory check timed out, the directory is on a hung NFS or CSI mount. Check mount health rather than permissions. The runner prints both of these startup failures to stderr before it opens `--log-file`, so look for them in the terminal or your platform’s container logs rather than the log file. Before v2.1.225, the runner didn’t check the base directory at startup, and this misconfiguration failed sessions after pickup instead. * **Runner exits at startup with`RegisterRunner failed:` and a TLS certificate error**: the error can be `self signed certificate in certificate chain`, for example. The runner doesn’t trust the certificate authority (CA) behind the certificate it received, as happens behind a TLS-inspecting proxy. Set [`NODE_EXTRA_CA_CERTS`](</docs/en/network-config#custom-ca-certificates>) in the runner’s environment to a PEM file with the proxy’s root CA. You don’t set it again for sessions, which inherit it. Git doesn’t read it: for clones through that proxy, set `GIT_SSL_CAINFO` too. + * **Your start script prints a write error containing`Resource temporarily unavailable` and exits**: your script shares its stdout or stderr with the `claude self-hosted-runner` or [orchestrator](</docs/en/self-hosted-environments-configuration#on-demand-runners>) process it starts, which has switched that shared pipe or socket to non-blocking mode. When the pipe is full, a write from your script fails with this operating-system error instead of waiting, and under `set -e` the script exits. To stop the error, send the runner’s or orchestrator’s output to a file that your script’s user can create. Append `>> "$HOME/claude-runner.log" 2>&1` to the command that starts it, ahead of any `&` that backgrounds it: + + claude self-hosted-runner --environment-secret-file /etc/claude/environment-secret >> "$HOME/claude-runner.log" 2>&1 + +Your script’s own output still goes where it went before, while what the runner writes to stdout and stderr, its startup errors included, goes to that file. Use this shell redirect rather than [`--log-file`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) alone, which mirrors the log to a file while the runner keeps writing to stdout and stderr. If you already pass `--log-file`, keep it as well, because the redirect doesn’t change what that file receives. * **Orchestrator logs`poll failed:` with a TLS certificate error and keeps retrying**: the orchestrator doesn’t trust the CA behind the certificate it received, as happens behind a TLS-inspecting proxy. Set [`NODE_EXTRA_CA_CERTS`](</docs/en/network-config#custom-ca-certificates>) in the orchestrator’s environment to a PEM file with the proxy’s root CA. Set it for the runners your `spawn-runner` hook starts too. For example, a line can end `poll failed: self signed certificate in certificate chain — retrying in 1s`, with the TLS library’s words between the colon and the dash. To confirm the fix, check that `connected` is `true` in the orchestrator’s [`/healthz`](</docs/en/self-hosted-environments-reference#health-endpoint>) body. * **Sessions stay queued** : every online runner may be locked to a different owner. Check each runner’s `claude_code_self_hosted_runner_locked_account` [metric](</docs/en/self-hosted-environments-reference#prometheus-metrics>) or the `locked_account` field of its `[runner:health]` log line to see who holds it. Both show the owner’s email only after the runner has been issued a session token carrying an `act.email` claim, which a Claude Tag agent’s sessions never do. Without the claim, the runner emits no `locked_account` series and logs `locked_account=yes`, which tells you the runner is locked but not to which owner. Add replicas, or wait for an existing runner to drain and restart. If the environment uses on-demand runners, check the orchestrator instead; see [On-demand runners](</docs/en/self-hosted-environments-configuration#on-demand-runners>). * **Sessions fail immediately after pickup** : open the session in claude.ai/code to see the error. The most common causes are missing git credentials in the runner image and build tools that aren’t installed. On a runner started with `--use-anthropic-git-proxy`, see When sessions fail to start on a runner with the git proxy. An unwritable base directory stops the runner at startup instead of failing sessions. See the **Runner exits at startup with`cannot create or write to base directory`** entry in this list. @@ -701,6 +707,9 @@ * **Runner logs`Poll failed` lines containing `rejecting the malformed poll response`**: the runner received a work-poll response whose body isn’t the queue’s expected JSON, most often because something between the runner and `api.anthropic.com`, such as an intercepting proxy or a captive portal, answered with its own page. The runner rejects the response, counts it under the `transport` kind of the `claude_code_self_hosted_runner_poll_errors_total` [metric](</docs/en/self-hosted-environments-reference#prometheus-metrics>), and retries on the failed-poll schedule described in [Session lifecycle](</docs/en/self-hosted-environments#session-lifecycle>). The runner keeps serving its live sessions. Configure the proxy to pass responses from `api.anthropic.com` through unaltered. Before v2.1.246, the runner read such a response as an empty work queue, which could end its live sessions or make it exit. * **A session’s branch no longer exists on the remote** : for a git source the session only reads from, the runner skips that source and continues on the remaining ones. For the source the session pushes results to, a deleted branch, typically because it was merged and auto-deleted, fails the session with an error naming the repository and branch and asking you to restore the branch and retry. The runner fails the session with the same error when skipping would leave it with no repository at all. Before v2.1.228, such a session started in an empty directory. * **A session starts without one of its repositories** : on a runner with no [`checkout` hook](</docs/en/self-hosted-environments-configuration#checkout>), the git host can refuse the runner’s access check for a repository the session only reads from. The runner then skips that repository, logs a `[runner:warn] could not access context source` line naming the refusal, and starts the session on the remaining ones. The runner skips only a clear refusal: the host answers that the repository wasn’t found, git finds no credentials for the host, or authentication fails. A network failure, a timeout, or an HTTP `403` still fails the session start, as does a refusal for a repository the session pushes results to. The runner still fails a session that skipping would leave with no repository at all. With `--use-anthropic-git-proxy`, the runner skips only a repository the git proxy itself denies. The access check runs again each time the session starts on a runner, so once the runner’s git identity has read access, the next start clones the repository. Before v2.1.274, each of these refusals failed the session start. + * **A session fails to start with`This runner couldn't read`**: the runner asked the git host for a repository with its git credentials and got a not-found answer. The repository doesn’t exist, or those credentials can’t reach the repository. + * **If you administer the runner** : give its git credentials read access to the repository, then start a new session. + * **If you started the session** : if the repository doesn’t exist, start a new session with the right repository. If the runner can’t reach the repository, ask the runner’s administrator to grant access, then start a new session. * **Sessions take minutes to start** : the initial clone usually dominates. Watch the `claude_code_self_hosted_runner_session_init_duration_seconds` [metric](</docs/en/self-hosted-environments-reference#prometheus-metrics>) to confirm, and cut the clone with a pre-warmed checkout or a smaller `CLAUDE_RUNNER_FETCH_DEPTH`. * **Turns fail with a 401** : when a turn ends with a 401 or 403 from the Anthropic API, the runner fetches a fresh [`CLAUDE_CODE_OAUTH_TOKEN`](</docs/en/self-hosted-environments-configuration#wrapper-scripts>) from Anthropic and passes it to the session. The failed turn isn’t retried. This token is short-lived, and the runner rotates it over the session’s stdin. When a fetch fails, the runner logs an `inference_token refresh failed` line that says when it will retry, and it keeps retrying for as long as the session runs. If every call starts failing about 30 minutes into a session, a wrapper script has likely severed the session’s stdin, so token rotations can’t reach it; see [Keep stdin and file descriptor 3 attached](</docs/en/self-hosted-environments-configuration#keep-stdin-and-file-descriptor-3-attached>). Before v2.1.274, the runner stopped retrying a failed fetch after a few attempts and waited for the next scheduled one. A failed turn didn’t trigger a fetch, so every turn failed with a 401 until the next scheduled fetch. * **A turn fails in claude.ai/code with`This model needs a newer version of Claude Code`**: the Claude Code version that your runners start sessions with is older than the session’s model requires, so the API [rejects the request](</docs/en/errors#claude-code-does-not-support-this-model>). Upgrade the runners to the version the message asks for, or a later one, as described in Pin the version. Until then, people can pick a different model in the session.
modified Settings files and precedence View current →
--- a/settings.md +++ b/settings.md @@ -357,10 +357,12 @@ A [cloud session](</docs/en/claude-code-on-the-web>) runs in a [cloud environment](</docs/en/cloud-environments>) on a fresh clone of your repository, not on your machine. That changes which settings reach it: - * **Shared project settings** (`.claude/settings.json`): read in a session with one repository, because the file is part of the clone and the session starts inside it. Commit a setting there to apply it in those sessions. In an Anthropic-hosted environment, a session with several repositories starts above the clones and reads only the `enabledPlugins` and `extraKnownMarketplaces` keys from each repository’s `.claude/settings.json`, not permission rules, hooks, `env`, or other keys. The marketplaces and plugins those two keys declare still [don’t load in a cloud session](</docs/en/cloud-environments#what-carries-over-from-your-setup>). For a self-hosted environment, see [which repository’s settings apply](</docs/en/self-hosted-environments-configuration#repository-settings-in-sessions-with-several-repositories>). + * **Cloud threads in a project** : in a cloud thread in a [project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>), none of a repository’s `.claude/settings.json` permission rules, hooks, or `env` apply, however many repositories the project has. [What threads pick up from your repositories](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>) lists what to use instead. + * **Shared project settings** (`.claude/settings.json`): read in a session with one repository outside a project, because the file is part of the clone and the session starts inside it. Commit a setting there to apply it in those sessions. + * **Shared project settings with several repositories** : in an Anthropic-hosted environment, a session with several repositories starts above the clones and reads only the `enabledPlugins` and `extraKnownMarketplaces` keys from each repository’s `.claude/settings.json`, not permission rules, hooks, `env`, or other keys. The marketplaces and plugins those two keys declare still [don’t load in a cloud session](</docs/en/cloud-environments#what-carries-over-from-your-setup>). For a self-hosted environment, see [which repository’s settings apply](</docs/en/self-hosted-environments-configuration#repository-settings-in-sessions-with-several-repositories>). * **User and project local settings** (`~/.claude/settings.json` and `.claude/settings.local.json`): not read. Both stay on your machine, and the local file isn’t in the clone. * **Managed settings** : a `managed-settings.json` file or MDM profile on your device doesn’t reach a cloud session. Your organization’s [server-managed settings](</docs/en/server-managed-settings>) do; [surface coverage](</docs/en/model-config#surface-coverage>) lists which cloud sessions receive them. A [self-hosted environment](</docs/en/self-hosted-environments>) also reads the managed settings file in its runner image. [How Claude Code combines managed sources](</docs/en/managed-settings#how-claude-code-combines-managed-sources>) says when that file applies. - * **`/config`** : in your browser at claude.ai/code, opens the Claude Code section of your claude.ai settings instead of changing a value. To change a setting for a cloud session, set an [environment variable](</docs/en/cloud-environments#set-environment-variables>) on the environment, or in a session with one repository, commit the key to that repository’s `.claude/settings.json`. + * **`/config`** : in your browser at claude.ai/code, opens the Claude Code section of your claude.ai settings instead of changing a value. To change a setting for a cloud session, set an [environment variable](</docs/en/cloud-environments#set-environment-variables>) on the environment. In a session with one repository outside a project, you can instead commit the key to that repository’s `.claude/settings.json`. [What carries over from your setup](</docs/en/cloud-environments#what-carries-over-from-your-setup>) lists the rest: `CLAUDE.md`, skills, MCP servers, plugins, and credentials.
modified Example settings files View current →
--- a/settings-example.md +++ b/settings-example.md @@ -92,7 +92,7 @@ One team’s shared settings, committed to the repository so everyone who clones it gets the same permissions, hooks, and plugin marketplace. Save a file like this at `.claude/settings.json` at the top of the repository. What to know before you commit one: - * **Cloud sessions read it too.** A [cloud session](</docs/en/settings#settings-in-cloud-sessions>) starts from a clone of the repository, so the committed file applies there as well. + * **Cloud sessions outside a[project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>) read it too.** A [cloud session](</docs/en/settings#settings-in-cloud-sessions>) with one repository starts inside the clone, so the committed file applies there as well. * **Telemetry goes in managed or personal settings.** Claude Code ignores the [OpenTelemetry exporter variables](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) in a repository’s settings files, apart from some values that turn telemetry off. Set them in [managed settings](</docs/en/monitoring-usage#administrator-configuration>) for your organization, or in each person’s `~/.claude/settings.json`. * **Allow rules wait for trust.** Allow rules and `extraKnownMarketplaces` entries take effect after each person [trusts this folder itself](</docs/en/permissions#project-allow-rules-and-workspace-trust>), not only a parent folder; deny and ask rules apply in every session, trusted or not. * **The hook is a script in the repo.** This file’s hook runs `.claude/hooks/block-rm.sh`; [How a hook resolves](</docs/en/hooks#how-a-hook-resolves>) walks through writing it.
modified All settings View current →
--- a/settings-reference.md +++ b/settings-reference.md @@ -775,7 +775,7 @@ `showThinkingSummaries` -See summaries of Claude’s [extended thinking](</docs/en/model-config#extended-thinking>) in interactive sessions. Set it if you want the full summaries when you expand thinking with `Ctrl+O`. When unset or `false`, the Anthropic API redacts thinking blocks and Claude Code shows a collapsed stub; third-party providers don’t redact. +See summaries of Claude’s [extended thinking](</docs/en/model-config#extended-thinking>) in interactive sessions. Set it if you want the full summaries when you expand thinking with `Ctrl+O`. When unset or `false`, the Anthropic API redacts thinking blocks and Claude Code shows a collapsed stub. * **Scope** : `Any file` * **Type** : Boolean @@ -1491,6 +1491,8 @@ * **`allowWrite` and `denyWrite`**: on macOS, wildcards work. On Linux and WSL2, the sandbox mounts concrete paths, so Claude Code skips an entry that contains `*`, `?`, or `[` once the trailing `/**` is removed, and that entry has no effect. Claude Code adds the paths from your `Edit` permission rules to these lists, so the same limit applies to them, and the **Config** tab of `/sandbox` warns about `Edit` and `Read` permission rules that contain wildcards. * **`denyRead` and `allowRead`**: wildcards work on every platform. On Linux and WSL2, Claude Code expands a read entry to the concrete paths it matches, which it doesn’t do for the write lists. + +Braces match as ordinary characters in a name, so `~/data/{keys,tokens}` covers a directory literally named `{keys,tokens}`, not two alternatives. To cover `~/data/keys` and `~/data/tokens`, add each as its own entry. ### @@ -2612,7 +2614,7 @@ * `OTEL_EXPORTER_PROMETHEUS_HOST` and `OTEL_EXPORTER_PROMETHEUS_PORT` Only these values still apply from project and local settings, because they turn something off: `none` for the three exporter selectors, and an off value such as `0` for `OTEL_LOG_USER_PROMPTS`, `OTEL_LOG_TOOL_CONTENT`, and `OTEL_LOG_TOOL_DETAILS`. Such a value overrides the same variable in your user settings, but not one that the environment you start Claude Code from, a `--settings` file, or managed settings sets. When a project or local settings file sets a variable in this group, a local interactive session shows a notice at startup. Run `/status` or `claude doctor` to see which ones Claude Code ignored and which turned telemetry off; both list names, never values. A non-interactive run with `-p` or an Agent SDK session shows no notice, so check that your collector still receives data after you upgrade. If it doesn’t, set the variables in your user settings, managed settings, the job’s environment, or a file you pass with `--settings`. Ignoring this group in project and local settings requires Claude Code v2.1.282 or later. * Variables that change how Claude Code starts or syncs, such as `CLAUDE_CODE_PROCESS_WRAPPER`, `CLAUDE_CODE_SYNC_SKILLS`, `CLAUDE_CODE_SYNC_PLUGINS`, `CLAUDE_CODE_PLUGIN_CACHE_DIR`, and `CLAUDE_CODE_PLUGIN_SEED_DIR`. - * Variables that set the timers on an unanswered dialog: [`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`, `CLAUDE_AFK_TIMEOUT_MS`, and `CLAUDE_AFK_COUNTDOWN_MS`](</docs/en/env-vars#variables>). + * [`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`](</docs/en/env-vars#variables>), which sets the timer on an unanswered dialog. * [`CLAUDE_CODE_DISABLE_ATTACHMENTS`](</docs/en/env-vars#variables>), which turns off attachment processing. * [`CLAUDE_CODE_DISABLE_FILE_MENTIONS`](</docs/en/env-vars#variables>), which stops Claude Code from expanding `@` mentions of files and directories. Before v2.1.251, project and local settings could also set the variables in this list that choose where Claude Code writes its files or that export session content, except `HOME` and `XDG_CONFIG_HOME`. Before v2.1.290, they could also set the dialog timer variables and `CLAUDE_CODE_DISABLE_ATTACHMENTS`. @@ -2652,7 +2654,7 @@ `idleCompaction` -Idle compaction [compacts](</docs/en/context-window#what-survives-compaction>) a long conversation that you’ve stepped away from, shortly before its prompt cache expires. Your next message then sends a summary instead of the whole conversation. When you come back, the conversation shows `Compacted while idle, before the prompt cache expired`. Idle compaction is on by default for conversations that meet all of these conditions: +Idle compaction [compacts](</docs/en/context-window#what-survives-compaction>) a long conversation that you’ve stepped away from, shortly before its prompt cache expires. Your next message then sends a summary instead of the whole conversation. When you come back, the conversation shows a line that starts with `Compacted while idle, before the prompt cache expired`. Idle compaction is on by default for conversations that meet all of these conditions: * **Session** : you’re in an interactive terminal session * **Prompt cache** : the conversation is on the [one-hour prompt cache TTL](</docs/en/prompt-caching#which-ttl-each-request-gets>) @@ -2675,6 +2677,11 @@ "idleCompaction": false } +To turn idle compaction off or on from inside a session, run `/config` and change the **Idle compaction** row. Your choice is saved to your user settings and applies right away. The row requires Claude Code v2.1.302 or later. If you run one of those versions and `/config` doesn’t show the row, check for these causes: + + * **Another settings source sets the key** : a value in managed settings, the `--settings` flag, or a project or local settings file overrides your user settings. Change the key in that source instead + * **Feature flags are unavailable** : where Claude Code can’t [fetch feature flags from Anthropic](</docs/en/env-vars#features-that-need-feature-flag-fetching>), idle compaction doesn’t run, so there is nothing to turn off + The key requires Claude Code v2.1.290 or later. On an earlier version, which ignores this key, turn off `autoCompactEnabled` to stop idle compaction. #### @@ -2785,7 +2792,6 @@ * **Scope** : `User or managed` * **Type** : string, one of `"60s"`, `"5m"`, `"10m"`, or `"never"` * **Default** : `"never"` - * **Per-session overrides** : [`CLAUDE_AFK_TIMEOUT_MS`](</docs/en/env-vars>) takes precedence over this key for one session settings.json @@ -4617,7 +4623,14 @@ `strictPluginOnlyCustomization.hooks` -Lock the `hooks` surface. Claude Code stops running hooks from user, project, and local `settings.json`, and keeps running plugin hooks and hooks in managed settings. +Lock the `hooks` surface: + + * **Stops running** : + * Hooks from user, project, and local `settings.json` + * Frontmatter hooks in skills, custom commands, and agents, from the sources that a `skills` or `agents` lock would block + * **Keeps running** : plugin hooks and hooks in managed settings + +Skills, custom commands, and agents whose frontmatter hooks stop running still load while their own surface isn’t locked. * **Scope** : `Managed` * **Type** : the string `"hooks"` in the `strictPluginOnlyCustomization` array @@ -5570,7 +5583,7 @@ `preferredNotifChannel` -Choose how Claude Code notifies you when a task completes or a permission prompt is waiting. Appears in `/config` as **Local notifications**. +Choose how Claude Code notifies you when a task completes or a permission prompt is waiting. A [mod’s notifications](</docs/en/plugins/mods/api#show-something-without-starting-a-turn>) use the same setting. Appears in `/config` as **Local notifications**. * **Scope** : `Any file`. Claude Code also reads a value left in `~/.claude.json` by older versions. * **Type** : string, one of:
modified Advanced setup View current →
--- a/setup.md +++ b/setup.md @@ -176,7 +176,7 @@ Auto-updates -Claude Code checks for updates on startup and periodically while running. Updates download and install in the background, then take effect the next time you start Claude Code. Run `claude doctor` to see the result of the most recent update attempt. On macOS and Linux, the native installer manages the launcher at `~/.local/bin/claude` as a symlink into `~/.local/share/claude/versions/`. If you replace that launcher with your own script or symlink, auto-update and `claude update` leave it in place: new versions still install under the `versions/` directory, and your launcher decides which version runs. With a custom launcher, Claude Code also keeps every installed version on disk because it can’t tell which version the launcher needs. `claude doctor` reports a launcher that the native installer didn’t create. To let Claude Code manage the launcher again, remove `~/.local/bin/claude` and run `claude update`. If an npm global install can’t auto-update because the npm global directory isn’t writable, Claude Code shows a one-time notice at startup, and `claude doctor` lists the available fixes. See [permission errors during installation](</docs/en/troubleshoot-install#permission-errors-during-installation>) for details. +Claude Code checks for updates on startup and periodically while running. Updates download and install in the background, then take effect the next time you start Claude Code. Run `claude doctor` in your shell to see the result of the last update attempt Claude Code recorded. On a native installation, if it reports a failed attempt, see [`Auto-update failed` in the session footer](</docs/en/troubleshoot-install#auto-update-failed>) for what to do next. On macOS and Linux, the native installer manages the launcher at `~/.local/bin/claude` as a symlink into `~/.local/share/claude/versions/`. If you replace that launcher with your own script or symlink, auto-update and `claude update` leave it in place: new versions still install under the `versions/` directory, and your launcher decides which version runs. With a custom launcher, Claude Code also keeps every installed version on disk because it can’t tell which version the launcher needs. `claude doctor` reports a launcher that the native installer didn’t create. To let Claude Code manage the launcher again, remove `~/.local/bin/claude` and run `claude update`. If an npm global install can’t auto-update because the npm global directory isn’t writable, Claude Code shows a one-time notice at startup, and `claude doctor` lists the available fixes. See [permission errors during installation](</docs/en/troubleshoot-install#permission-errors-during-installation>) for details. Homebrew, WinGet, apt, dnf, and apk installations do not auto-update by default; see below to opt in for Homebrew and WinGet. To upgrade Homebrew manually, run `brew upgrade claude-code` or `brew upgrade claude-code@latest`, depending on which cask you installed. For WinGet, run `winget upgrade Anthropic.ClaudeCode`. For Linux package managers, see the upgrade commands in Install with Linux package managers.To have Claude Code run the upgrade command for you on Homebrew or WinGet, set [`CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE`](</docs/en/env-vars>) to `1`. Claude Code then runs the upgrade in the background when a new version is available and shows a restart prompt on success. The upgrade targets only the Claude Code package and does not affect other software you have installed.On WinGet the upgrade may fail while Claude Code is running because Windows locks the executable. In that case Claude Code shows the manual command instead. apt, dnf, and apk continue to require a manual upgrade because those commands need elevated privileges.**Known issue:** Claude Code may notify you of updates before the new version is available in these package managers. If an upgrade fails, wait and try again later.Homebrew keeps old versions on disk after upgrades. Run `brew cleanup` periodically to reclaim disk space.
modified Stream responses in real-time View current →
--- a/streaming-output.md +++ b/streaming-output.md @@ -318,7 +318,7 @@ Known limitations - * **Structured output** : with partial messages enabled, the JSON streams as a tool call’s unvalidated `input_json_delta` chunks, and only the validated result reaches the final `ResultMessage.structured_output`. See [structured outputs](</docs/en/agent-sdk/structured-outputs>) for details. + * **Structured output** : with partial messages enabled, the JSON streams as a tool call’s unvalidated `input_json_delta` chunks, and only the validated result reaches the final `ResultMessage.structured_output`. [Recognize the StructuredOutput tool call](</docs/en/agent-sdk/structured-outputs#recognize-the-structuredoutput-tool-call>) covers how that call appears in your stream. ##
modified Get structured output from agents View current →
--- a/structured-outputs.md +++ b/structured-outputs.md @@ -356,6 +356,19 @@ ​ +Recognize the StructuredOutput tool call + +When you set `outputFormat` in TypeScript or `output_format` in Python, your message stream carries a tool call named `StructuredOutput` that you never defined. Claude Code adds this tool to the session, and the agent calls it to return its answer. The [system init message](</docs/en/agent-sdk/typescript#sdksystemmessage>) lists it in the `tools` array, and each call arrives as two blocks: + + * A `tool_use` block named `StructuredOutput`, whose input is the object the agent produced for your schema + * A `tool_result` block reading `Structured output provided successfully` + +When that object doesn’t match your schema, the `tool_result` carries `is_error: true` instead and the agent calls `StructuredOutput` again, so your stream can hold several calls for one query. Read the validated data from `structured_output` on the result message rather than from a `tool_use` block, and see Error handling for the result you get when no attempt succeeds. If your application shows or logs tool calls, skip the ones named `StructuredOutput` so the mechanism doesn’t appear as a step the agent chose. A `tool_result` block carries no tool name, only the `tool_use_id` of the call it answers, so match that against the `id` of each call you skipped. + +## + +​ + Error handling Structured output generation can fail when the agent cannot produce valid JSON matching your schema. This typically happens when the schema is too complex for the task, the task itself is ambiguous, or the agent hits its retry limit trying to fix validation errors. It can also happen without any validation failure: a [model fallback](</docs/en/model-config#automatic-model-fallback>) can retract an already-completed output mid-stream, and if no retry replaces it the run ends with the same error. Check the `errors` list on the error result message to tell the two causes apart before debugging your schema. When an error occurs, the result message has a `subtype` indicating what went wrong:
modified Create custom subagents View current →
--- a/sub-agents.md +++ b/sub-agents.md @@ -876,6 +876,10 @@ * **Foreground** : if a rate limit, overload, or server error cuts off a subagent that already produced text output, the Agent tool returns that partial output with a note that the subagent was cut off and didn’t finish its task. A subagent that produced nothing, or whose only output was tool calls, fails with [`Agent terminated early due to an API error`](</docs/en/errors#agent-terminated-early-due-to-an-api-error>), followed by the error detail. * **Background** : the subagent is marked failed, and the message Claude receives when it ends names the API error and includes the subagent’s last output, so partial work isn’t lost. +If a subagent’s report opens with the following line, the subagent finished on a fallback model: + + ⚠ This agent switched to <model> because its earlier model could not be used. + When you configure a [fallback model chain](</docs/en/model-config#fallback-model-chains>) and a subagent encounters a failure the chain covers, such as its model being unavailable, Claude Code switches the subagent to the first model in the chain that accepts the request. The subagent keeps working instead of ending on the error. Once the underlying API error clears, ask Claude to retry the task or resume the subagent. ###
modified Test a mod View current →
--- a/test.md +++ b/test.md @@ -171,6 +171,7 @@ `prompt.fill`| `() => ({ isFilled: true })` `$.prompt.read`| `() => ({ value: { text: '...', cursor: 0 } })` `$.ui.copy`| `() => ({ value: { isCopied: true } })` +`$.ui.notify`| `() => ({ value: { isSent: true, channel: 'terminal_bell' } })`. The text is `e.text` and the title is `e.title`. `$.session.messages`| `() => ({ value: [{ role: 'assistant', text: '...', toolUses: [] }] })` `$.session.id`, `$.agent.list`| `() => ({ value: 'abc123' })`, `() => ({ value: [] })` `session.send`| `() => ({ isDelivered: true })`. `e.to` arrives as a string even when your mod passed `{ sessionId }`.
modified Scale to many tools with tool search View current →
--- a/tool-search.md +++ b/tool-search.md @@ -24,13 +24,17 @@ * **Claude Opus 4.5, Sonnet 4.5, Haiku 4.5, and later** : tool search is on by default. * **Earlier Agent Platform models** : the SDK loads tool definitions upfront, because their serving stacks reject the required beta header. `ENABLE_TOOL_SEARCH` can’t override this. -Before Claude Code v2.1.221, the SDK disabled tool search for all models on Google Cloud’s Agent Platform unless you set `ENABLE_TOOL_SEARCH`. The SDK also disables tool search when `ANTHROPIC_BASE_URL` points to a non-first-party host, since most proxies don’t forward `tool_reference` blocks. You can override that default with the `ENABLE_TOOL_SEARCH` environment variable: +Before Claude Code v2.1.221, the SDK disabled tool search for all models on Google Cloud’s Agent Platform unless you set `ENABLE_TOOL_SEARCH`. + +Tool search is on by default behind an `ANTHROPIC_BASE_URL` gateway, with nothing to set. If the gateway rejects it, see [Tool search through an LLM gateway](</docs/en/mcp#tool-search-through-a-gateway>). Before Claude Code v2.1.304, the SDK disabled tool search behind such a gateway unless `ENABLE_TOOL_SEARCH` was `true`, `auto`, or `auto:N`. + +You control whether and when tool definitions are deferred with the `ENABLE_TOOL_SEARCH` environment variable, which takes these values: Value| Behavior ---|--- -(unset)| Tool search is on. Tool definitions are deferred and discovered on demand. Falls back to loading upfront on models earlier than Opus 4 and Sonnet 4, Google Cloud’s Agent Platform models earlier than Opus 4.5, Sonnet 4.5, and Haiku 4.5, a non-first-party `ANTHROPIC_BASE_URL`, or a Microsoft Foundry deployment hosted on Azure. -`true`| Tool search stays on with a non-first-party `ANTHROPIC_BASE_URL`. The other (unset) fallbacks still apply. The SDK sends the beta header through proxies, and requests fail on proxies that don’t support `tool_reference` blocks. -`auto`| Counts the tokens in the tool definitions that tool search can defer and compares the total against the model’s context window. When the total reaches 10% of the window, tool search activates. Below that, the SDK loads every tool definition into context upfront. +(unset)| Tool search is on, with tool definitions deferred and discovered on demand. Falls back to loading upfront on models earlier than Opus 4 and Sonnet 4, on the earlier Agent Platform models, and on Microsoft Foundry deployments hosted on Azure. +`true`| Tool search is on, with the same fallbacks as (unset). +`auto`| Tool search is off, and tool definitions load upfront, until the definitions it can defer reach 10% of the model’s context window. Tool search then activates, and can [stay on in the same conversation](</docs/en/mcp#tools-that-stay-deferred-below-the-threshold>) even if those definitions later drop below 10%. `auto:N`| Same as `auto` with a custom percentage. `auto:5` activates when those definitions reach 5% of the context window. Lower values activate sooner. `false`| Tool search is off. All tool definitions are loaded into context on every turn.
modified Tools reference View current →
--- a/tools-reference.md +++ b/tools-reference.md @@ -489,7 +489,7 @@ The Read tool takes a file path and returns the contents with line numbers. Claude is instructed to always pass absolute paths. Reading an empty file returns a notice that the file exists but its contents are empty, and an `offset` past the last line returns a notice giving the file’s line count. Read handles several file types beyond plain text: - * **Images** : PNG, JPEG, GIF, and WebP files are returned as visual content that Claude can see, not as raw bytes. Claude Code resizes and recompresses large images to fit the model’s image size limits before sending them, so Claude may see a downscaled version of a large screenshot. If Claude misses fine pixel-level detail in a large image, ask it to crop the region you care about, such as with ImageMagick via Bash, and then read the crop. + * **Images** : PNG, JPEG, GIF, and WebP files are returned as visual content that Claude can see, not as raw bytes. Claude Code resizes and recompresses large images to fit the model’s image size limits before sending them, so Claude may see a downscaled version of a large screenshot. If Claude misses fine pixel-level detail in a large image, ask it to crop the region you care about, such as with ImageMagick via Bash, and then read the crop. Read refuses an image file larger than 128 MB with an error that tells Claude to resize the image or export a smaller copy, then read that copy. If Claude stops at the error instead of doing so, see [File is too large to read as an image](</docs/en/errors#file-is-too-large-to-read-as-an-image>). * **PDFs** : Claude reads short `.pdf` files whole. For PDFs longer than 10 pages, it reads in ranges with a `pages` parameter, such as `"1-5"`, up to 20 pages at a time. Page-range reads render pages with `pdftoppm` from poppler-utils, so install it with `brew install poppler` on macOS or `apt-get install poppler-utils` on Debian and Ubuntu. On Windows and other platforms, install a poppler build that puts `pdftoppm` on your `PATH`. Without it, a page-range read fails with `pdftoppm is not installed`. * **Jupyter notebooks** : `.ipynb` files return all cells with their outputs, including code, markdown, and visualizations. A notebook whose cells come to more than 256 KB, or more than the token limit, returns an error instead. Claude Code refuses to read a notebook file over 100 MB; the error tells Claude how to read a portion of the notebook instead, such as a slice of cells, with a shell command. @@ -554,7 +554,7 @@ * The IDs of recent API requests * The conversation transcript, when you left **Send transcript** at `yes` in the review screen. Sending from the card never includes the transcript -Claude Code keeps your working directory in the local draft so it can find the transcript, and doesn’t send the directory. In [organizations with Zero Data Retention](</docs/en/zero-data-retention#features-disabled-under-zdr>), and in organizations with the [HIPAA configuration](</docs/en/hipaa-setup>) applied, Claude Code leaves the tool out, as it does for `/feedback`. If a session in an organization with Zero Data Retention still offers the tool, drafts stay on your machine, and sending fails with `Feedback collection is not available for organizations with custom data retention policies.` +Claude Code keeps your working directory in the local draft so it can find the transcript, and doesn’t send the directory. In [organizations with Zero Data Retention](</docs/en/zero-data-retention#features-disabled-under-zdr>), and in organizations with the [HIPAA configuration](</docs/en/hipaa-setup>) applied, Claude Code leaves the SendFeedback tool out of your sessions. If a session in an organization with Zero Data Retention still offers the tool, drafts stay on your machine, and sending fails with `Feedback collection is not available for organizations with custom data retention policies.` ### @@ -655,6 +655,8 @@ * **Wait for the refill** : on Claude Code v2.1.290 or later, an interactive terminal session’s limit refills at about 100 calls per hour. To change the rate, set [`CLAUDE_CODE_WEB_SEARCH_REFILLS_PER_HOUR`](</docs/en/env-vars#variables>) to a number of calls per hour, such as `50`. * **Start a new conversation** : running [`/clear`](</docs/en/commands#all-commands>) at the Claude Code prompt also resets the count. If work that can still spawn subagents survives the clear, such as a running workflow, the count carries over instead. +In [non-interactive mode](</docs/en/headless>) with `-p` and in the [Agent SDK](</docs/en/agent-sdk/overview>), the limit applies per turn, not per session. A turn lasts from a message you send until Claude finishes responding. The limit resets when you send the next message after that or start a new `claude -p` run, even with [`--continue` or `--resume`](</docs/en/headless#continue-conversations>). For more searches, raise [`CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION`](</docs/en/env-vars#variables>) or set a refill rate with [`CLAUDE_CODE_WEB_SEARCH_REFILLS_PER_HOUR`](</docs/en/env-vars#variables>). + ## ​
modified Troubleshoot installation and login View current →
--- a/troubleshoot-install.md +++ b/troubleshoot-install.md @@ -27,6 +27,8 @@ `CRYPT_E_NO_REVOCATION_CHECK` or `CRYPT_E_REVOCATION_OFFLINE`| Work around blocked revocation checks `Failed to fetch version` or can’t reach download server| Check network and proxy settings `The connection dropped while downloading the update` or `Download timed out: exceeded the total deadline`| Run the update again or set your proxy +`Release verification failed for Claude Code`| Run `claude update` or `claude install` again +`Auto-update failed · Run claude doctor` in red in the session footer| Run `claude update` from your shell `irm is not recognized` or `The token '&&' is not a valid statement separator`| Use the right command for your shell `Cask 'claude-code' is unavailable: No Cask with this name exists`| Update Homebrew `Cask 'claude-code@latest' is not installed`| Upgrade the cask you installed @@ -527,6 +529,31 @@ ​ +Release verification failed for Claude Code + +This message from `claude update` or `claude install` means Claude Code couldn’t confirm that the release it was about to install is genuine, so it installed nothing. Any version you already have keeps working. + + Release verification failed for Claude Code <version> (<reason>). The update was not installed. + +Take the step that matches the value in parentheses in your message: + + * **A value that starts with`sidecar_fetch_`**: run the same command again from your shell. `claude update` succeeded if it prints a line that starts with `Successfully updated from`, and `claude install` succeeded if it prints `Claude Code successfully installed!`. + * **Any other value** : try the same command again later + +With any value, if the message repeats, report the problem and include the full message. + +### + +​ + +`Auto-update failed · Run claude doctor` in the session footer + +This red line means Claude Code tried to update itself in the background and the update didn’t install. You can keep working without doing anything. The line points you to `claude doctor`, whose `Last update attempt: failed (install_failed)` line gives a date but no cause. To finish the update or see why it failed, run `claude update` in your shell instead. If that install fails too, look for the error `claude update` prints under Find your error. + +### + +​ + Wrong install command on Windows If you see `'irm' is not recognized`, `The token '&&' is not a valid statement separator`, `A parameter cannot be found that matches parameter name 'fsSL'`, or `'bash' is not recognized as the name of a cmdlet`, you copied the install command for a different shell or operating system. If the command prints the script’s text instead of installing anything, you ran only part of it.
modified Troubleshoot the Agent SDK View current →
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -152,7 +152,10 @@ structured_output is None but the result says success -A result message can end with `subtype: "success"` while `structured_output` is `None` in Python or `undefined` in TypeScript. The run completes, but no validated output exists. One way to hit this is a schema no output can satisfy, for example conflicting length constraints. Treat this result as a failure in application code. Check both that `subtype` is `success` and that `structured_output` is present before using it. The [Error handling](</docs/en/agent-sdk/structured-outputs#error-handling>) section shows this pattern for both SDKs. If it happens repeatedly with a schema you believe is correct, verify the schema is satisfiable, then simplify it until outputs validate, and reintroduce constraints one at a time. +A result message can end with `subtype: "success"` while `structured_output` is `None` in Python or `undefined` in TypeScript. The run completes, but no validated output exists. Treat this result as a failure in application code. Check both that `subtype` is `success` and that `structured_output` is present before using it. The [Error handling](</docs/en/agent-sdk/structured-outputs#error-handling>) section shows this pattern for both SDKs. Then check for these causes: + + * **A request that Claude declined** : to detect this case in your code, check the result message’s `stop_reason` for `"refusal"`. For what to try next, see [Usage Policy refusal](</docs/en/errors#usage-policy-refusal>). + * **A schema no output can satisfy** : for example, a string whose `minLength` is greater than its `maxLength`. If `structured_output` is missing repeatedly with a schema you believe is correct, look for constraints that contradict each other. If you find none, simplify the schema until outputs validate, then reintroduce your constraints one at a time. ##
modified Agent SDK reference - TypeScript View current →
--- a/typescript.md +++ b/typescript.md @@ -754,7 +754,7 @@ `supportedModels()`| Returns available models with display info `supportedAgents()`| Returns available subagents as `AgentInfo``[]` `mcpServerStatus()`| Returns the status of connected MCP servers as `McpServerStatus``[]` -`getContextUsage(opts?)`| Returns an `SDKControlGetContextUsageResponse` breaking down the session’s context window usage by category, skill, and tool. With the default `detail`, it is the same data `/context` shows in an interactive session, computed with token-counting API requests that don’t appear in the message stream; see how these requests are handled. The `detail` option requires Agent SDK v0.3.257 or later +`getContextUsage(opts?)`| Returns an `SDKControlGetContextUsageResponse` breaking down the session’s context window usage by category, skill, and tool. With the default `detail`, it includes the data `/context` shows in an interactive session, computed with token-counting API requests that don’t appear in the message stream; see how these requests are handled. The `detail` option requires Agent SDK v0.3.257 or later `readFile(path, options?)`| Reads a file from the session’s filesystem. Claude Code resolves the path against `cwd`; What `readFile()` can read lists the files it serves. Pass `{ maxBytes }` to change the read cap (default 1 MB, ceiling 10 MB) and `{ encoding: 'base64' }` for binary files such as images. Resolves with an `SDKControlReadFileResponse`, or `null` on permission denial, a missing file, or a transport error. Requires TypeScript SDK v0.2.121 or later `reloadPlugins(options?)`| Reloads plugins from disk, so plugins you install or edit mid-session reach the running session. Resolves with an `SDKControlReloadPluginsResponse` listing the session’s commands, subagents, plugins, and MCP server status. Requires Agent SDK v0.2.85 or later. The `holdOnCacheImpact` option requires Agent SDK v0.3.268 or later `reloadSkills()`| Reloads skills from disk, so skills you add or edit mid-session become available to the running session. Resolves with an `SDKControlReloadSkillsResponse` listing the skills available after the reload. Requires Agent SDK v0.3.163 or later @@ -951,15 +951,29 @@ `SDKControlGetContextUsageResponse` -Return type of `getContextUsage()`. With the default `detail`, this is the same payload Claude Code renders for the `/context` command in an interactive session, so alongside the token counts it carries display fields such as `color` and `gridRows` that Claude Code uses to draw the `/context` usage grid. The method’s optional `detail` argument chooses how Claude Code counts each category. The `detail` argument requires Agent SDK v0.3.257 or later. +Return type of `getContextUsage()`. With the default `detail`, the response includes the payload Claude Code renders for the `/context` command in an interactive session. Alongside the token counts, that payload carries display fields such as `color` and `gridRows` that Claude Code uses to draw the `/context` usage grid. The method’s optional `detail` argument chooses how Claude Code counts each category. The `detail` argument requires Agent SDK v0.3.257 or later. * **`'full'`** : the default. Claude Code counts each category with [token-counting](<https://platform.claude.com/docs/en/build-with-claude/token-counting>) API requests. These requests don’t appear in the message stream, so cost tracking that reads the stream won’t see them. On the Anthropic API, token counting isn’t billed. * **`'summary'`** : pass `{ detail: 'summary' }` to get an answer from the last response’s usage and local estimates instead. No token-count requests go out, and the per-category numbers are approximate. -When you send `/context` as a prompt instead of calling the method, Claude Code attaches an `SDKContextUsage` payload to the `context_usage` field of the assistant message that delivers the result. That field requires Agent SDK v0.3.232 or later. +When you send `/context` as a prompt instead of calling the method, Claude Code attaches an `SDKContextUsage` payload to the `context_usage` field of the assistant message that delivers the result. That field requires Agent SDK v0.3.232 or later. In `SDKControlGetContextUsageResponse`, `categories[].id`, `mcpInstructions`, and the `pluginId` and `path` fields of `agents` and `skills.skillFrontmatter` entries require Agent SDK v0.3.304 or later. type SDKControlGetContextUsageResponse = { categories: { + id?: + | "system_prompt" + | "system_tools" + | "mcp_tools" + | "mcp_instructions" + | "mcp_tools_deferred" + | "system_tools_deferred" + | "custom_agents" + | "memory_files" + | "skills" + | "messages" + | "autocompact_buffer" + | "compact_buffer" + | "free_space"; name: string; tokens: number; color: string; @@ -990,6 +1004,10 @@ tokens: number; isLoaded?: boolean; }[]; + mcpInstructions?: { + serverName: string; + tokens: number; + }[]; deferredBuiltinTools?: { name: string; tokens: number; @@ -1006,6 +1024,8 @@ agents: { agentType: string; source: string; + pluginId?: string; + path?: string; tokens: number; }[]; slashCommands?: { @@ -1020,6 +1040,9 @@ skillFrontmatter: { name: string; source: string; + pluginName?: string; + pluginId?: string; + path?: string; tokens: number; }[]; }; @@ -2359,7 +2382,7 @@ Peer origin fields -A `peer` origin identifies which agent sent the message: an in-process [teammate](</docs/en/agent-teams>) sending to `main` with `SendMessage`, or a [cross-session peer](</docs/en/cross-session-messaging>), another of your Claude Code sessions. Cross-session peers require Claude Code v2.1.224 or later on macOS and Linux; see [cross-session messaging availability](</docs/en/cross-session-messaging#availability>) for the native Windows requirement. A cross-session peer can run on the same machine, or on [another of your machines](</docs/en/cross-session-messaging#message-sessions-on-other-machines>) or [in the cloud](</docs/en/claude-code-on-the-web>) when its message arrives through Remote Control. The two kinds of sender fill the fields differently: +A `peer` origin identifies which agent sent the message: an in-process [teammate](</docs/en/agent-teams>) sending to `main` with `SendMessage`, or a [cross-session peer](</docs/en/cross-session-messaging>), another of your Claude Code sessions. Cross-session peers require Claude Code v2.1.224 or later on macOS and Linux; see [cross-session messaging availability](</docs/en/cross-session-messaging#availability>) for the native Windows requirement. A cross-session peer can run on the same machine, or on [another of your machines](</docs/en/cross-session-messaging#message-sessions-on-other-machines>) when its message arrives through [Remote Control](</docs/en/remote-control>). * `from`: the teammate’s name, or the sender address for a cross-session peer. For a [one-way cross-machine message](</docs/en/cross-session-messaging#message-sessions-on-other-machines>), the sender has no reply address and `from` is `"unknown"`. The value is sender-authored; `verifiedPeerPid` is the verified identity. * `fromMode`: the sending session’s permission class, `bypass` or `prompting`, declared by a host that relays a peer message between your sessions, such as the [desktop app](</docs/en/desktop#work-across-sessions>). Claude Code reads it in the receiving session when it applies the [inbound controls](</docs/en/cross-session-messaging#control-inbound-messages>). Requires Agent SDK v0.3.234 or later. @@ -3201,7 +3224,7 @@ Tool Input Types -Documentation of input schemas for built-in Claude Code tools. These types are exported from `@anthropic-ai/claude-agent-sdk/sdk-tools` and can be used for type-safe tool interactions. +Documentation of input schemas for built-in Claude Code tools. These types are exported from `@anthropic-ai/claude-agent-sdk/sdk-tools` and can be used for type-safe tool interactions. The `StructuredOutput` tool has no type here: Claude Code builds its input schema from the schema you pass to `outputFormat`, so there is nothing fixed to export. See [Recognize the StructuredOutput tool call](</docs/en/agent-sdk/structured-outputs#recognize-the-structuredoutput-tool-call>) for what that call looks like in your message stream. ###
modified Use Claude Code in VS Code View current →
--- a/vs-code.md +++ b/vs-code.md @@ -198,6 +198,7 @@ * **Session titles** : new sessions receive AI-generated titles based on your first message. * **Rename and archive** : hover over a session to reveal these actions. Rename to give it a descriptive title, or archive to move it to the **Archived sessions** group at the bottom of the list. + * **Conversations missing with`claudeProcessWrapper` set**: update the extension to version 2.1.304 or later. The list then includes the conversations that were missing, along with sessions that `claude -p` or the [Agent SDK](</docs/en/agent-sdk/overview>) started in this workspace. If the conversation is open in another Claude Code process, such as `claude` in a terminal or another VS Code window, this notice appears in place of the prompt box: @@ -252,7 +253,11 @@ Run `/usage` to open the Account & usage dialog, which shows your signed-in account and your usage. The usage figures match how you signed in: - * **claude.ai plan** : usage bars for your plan’s limits, such as the current session and the week. Each bar shows how long until its limit resets. The dialog also breaks down what is contributing to your plan limits. It flags behaviors that account for 10% or more of recent usage, such as cache misses, long context, and subagent-heavy or highly parallel sessions. Each flagged behavior comes with a tip to reduce it. Attribution tables show how much usage came from each skill, subagent, plugin, and MCP server. Use the Day and Week toggle to switch between the last 24 hours and the last 7 days. The figures are approximate and computed from local sessions on this machine, so usage from other devices or claude.ai is not included. + * **claude.ai plan** : usage bars for your plan’s limits, such as the current session and the week. Each bar shows how long until its limit resets. The dialog also breaks down what is contributing to your plan limits: + * **Recommendations** : changes that lower your usage, one per row with the share of recent usage it addresses, such as `Trim ~/code/api/CLAUDE.md · 49k tokens per request` + * **Fix button** : to have Claude Code apply the recommendations it can, click the button under them, such as **Fix both**. To learn which rows the button acts on and what then happens in your session, see [Apply recommendations with the fix shortcut](</docs/en/costs#apply-recommendations-with-the-fix-shortcut>). Requires Claude Code v2.1.305 or later. The button isn’t shown while [Remote Control](</docs/en/remote-control>) is connected. If a warning reads `The usage fix wasn’t fully sent. Open usage and try again.` after Remote Control connected, [disconnect Remote Control](</docs/en/remote-control#check-connection-status>) before you try again. + * **Attribution** : tables of how much usage came from each skill, subagent, plugin, and MCP server +Use the Day and Week toggle to switch between the last 24 hours and the last 7 days. The figures are approximate and computed from local sessions on this machine, so usage from other devices or claude.ai is not included. * **Other sign-ins** : when plan limits don’t apply to your sign-in, such as on a third-party provider or with an API key, the Usage section shows the session’s own cost and token usage instead. The CLI’s `/usage` shows the same totals in its [Session block](</docs/en/costs#track-your-costs>). The sessions list in the Activity Bar also shows the active session’s totals under its **Account & usage** header. Requires Claude Code v2.1.277 or later. For more on tracking and reducing usage, see [Track your costs](</docs/en/costs#track-your-costs>). @@ -572,6 +577,14 @@ Monitor background processes Type `/tasks` in the prompt box to open the agent map, which lists the session’s background tasks, such as a dev server Claude left running as a background shell command. Click a task to open its card, where you can stop it. Requires Claude Code v2.1.277 or later. For a background shell command, or a [monitor](</docs/en/tools-reference#monitor-tool>) that runs a command, the card also shows the command’s latest output and refreshes it while the command runs. + +#### + +​ + +See a background subagent’s tool calls + +When a subagent shows as one status line with no tool calls, type `/tasks` in the prompt box to open the agent map and click the subagent there. The subagent is running in the background, and its card shows its tool calls and a button that opens its transcript. ## @@ -728,7 +741,7 @@ * **Claude’s replies** : the extension announces each reply once, when it’s complete, and stays silent while text streams in. Your screen reader reads code blocks as a line-count summary, reads links by their label, and reads tables cell by cell; the full reply stays readable in the transcript. * **Permission requests and questions** : the extension announces a request when its permission prompt appears, naming the tool Claude wants to use. It announces in the same way when Claude asks you a question and when Claude finishes a plan and waits for your review. - * **Status changes** : the extension announces when Claude starts working, when Claude is ready for your input, and when Claude Code starts compacting the conversation. + * **Status changes** : the extension announces when Claude starts working, when Claude is ready for your input, and when Claude Code starts compacting the conversation. If you send a prompt while the session’s [SessionStart](</docs/en/hooks#sessionstart>) hooks are still running, your screen reader also says “Running start-up hooks.” * **Queued messages** : when you send a message while Claude is working, the extension announces “Message queued.” for that message. * **Errors and model prompts** : the extension announces errors in the conversation, and announces when the [usage-credits consent prompt](</docs/en/model-config#fable-and-usage-credits>) or the [flagged-request prompt](</docs/en/model-config#ask-before-switching>) appears.
modified Orchestrate subagents at scale with dynamic workflows View current →
--- a/workflows.md +++ b/workflows.md @@ -395,11 +395,11 @@ Which agents run again -Claude Code replays the run in the order agents started, and each agent either returns its saved result or runs again: - - * **Completed** : returns its saved result. The first agent whose prompt differs from the previous run, because you edited the script or an earlier agent returned something different, runs again, and so does every agent after it, even ones that completed. +Claude Code replays the run in the order agents start, and each agent either returns its saved result or runs again: + + * **Completed** : returns its saved result. The first agent whose prompt differs from the previous run, because you edited the script or an earlier agent returned something different, runs again, and so does every agent after it, even ones that completed. Before v2.1.305, completed agents could also run again when you relaunched an unedited script whose `pipeline()` items or `parallel()` tasks ran more than one agent each. To stop those reruns for new runs, update Claude Code. * **Still running when you stopped** : starts over. Stopping the whole run doesn’t count any agent as failed. - * **Failed** : runs again, and so does every agent that started after it, even ones that completed. Stopping one agent alone, by selecting it in `/workflows` and pressing `x`, counts as failing. + * **Failed** : runs again, and so does every agent the script starts after it, even ones that completed. Stopping one agent alone, by selecting it in `/workflows` and pressing `x`, counts as failing. That last case means a failure in the middle of a fan-out reruns work that already finished. If a script starts A, B, C, and D in that order and B fails, relaunching returns A from cache and runs B, C, and D again. If you edit a script that started A, B, C, and D so that it starts A, C, B, and D, the second agent to start is now C, where the previous run started B. Relaunching returns A from cache and runs C, B, and D again.
modified Run parallel sessions with worktrees View current →
--- a/worktrees.md +++ b/worktrees.md @@ -329,7 +329,7 @@ * **Says`launch from the parent checkout` or `Run the resume from the project checkout`**: you launched Claude Code from inside the worktree. Launch from the main checkout instead; the worktree needs no recreation. * **Says`it cannot be resumed or re-entered`**: nothing in this session vouches for the worktree from where you launched. Recreate it; the directory and its work remain on disk for manual recovery, and when the worktree has a parent checkout, resuming from there also works. * **Says`it contains the protected checkout`**: the refused directory is a parent of your main checkout, such as your home directory. Don’t delete it. Change the worktree path, such as the path your `WorktreeCreate` hook returns or the `EnterWorktree` target, so the worktree doesn’t contain the checkout. - * **Says`the protected checkout <path> has a .git entry that could not be examined` or `has git metadata that could not be resolved`**: the problem is the main checkout’s git metadata, not the worktree’s. Don’t delete the worktree, and ignore the message’s trailing advice to recreate it, which doesn’t apply to these two endings. Repair the main checkout, for example a permissions problem or a git `dubious ownership` refusal on its `.git`, and retry. + * **Says`the protected checkout <path> has a .git entry that could not be examined` or `has git metadata that could not be resolved`**: the problem is the main checkout’s git metadata, not the worktree’s. Don’t delete the worktree, and ignore the message’s trailing advice to recreate it, which doesn’t apply to these two endings. Repair the main checkout, for example a permissions problem or a git `dubious ownership` refusal on its `.git`, and retry. Before v2.1.302, with git 2.56 or later, the `could not be resolved` ending also appeared when the `<path>` after `the protected checkout` held a stray `.git` file. Stray here means the path on that file’s `gitdir:` line doesn’t lead to a valid git repository. To recover, [update Claude Code](</docs/en/setup#update-claude-code>) and retry. When that `gitdir:` path no longer exists, you can also delete the `.git` file and retry. * **Says`its recorded path has a network spelling`**: Claude Code never resumes into a worktree at a network path. Recreate the worktree at a local path. * **Any other ending** : the message names the problem and its fix, such as removing a `core.worktree` redirect or recreating the worktree; follow it. Before deleting a directory whose message says its git identity could not be verified, address the named cause first, for example a symbolic link in the worktree’s path or git itself failing to run, since the directory may be healthy. When you do recreate, salvage any changes you need from the old directory first; it stays on disk.