modified Set up Claude Code for your organization View current →
--- a/admin-setup.md +++ b/admin-setup.md @@ -1,4 +1,4 @@ -Claude Code enforces organization policy through managed settings that take precedence over local developer configuration. You deliver those settings from the Claude admin console, your mobile device management (MDM) system, or a file on disk. The settings control which tools, commands, servers, and network destinations Claude can reach. This page walks through the deployment decisions in order. Each row links to the section below and to the reference page for that area. +Claude Code enforces organization policy through managed settings that take precedence over local developer configuration, apart from the exceptions under [Settings precedence](</docs/en/settings#settings-precedence>). You deliver those settings from the Claude admin console, your mobile device management (MDM) system, or a file on disk. The settings control which tools, commands, servers, and network destinations Claude can reach. This page walks through the deployment decisions in order. Each row links to the section below and to the reference page for that area. SSO, SCIM provisioning, and seat assignment are configured at the Claude account level. See the [Claude Enterprise Administrator Guide](<https://claude.com/resources/tutorials/claude-enterprise-administrator-guide>) and [seat assignment](<https://support.claude.com/en/articles/11845131-use-claude-code-with-your-team-or-enterprise-plan>) for those steps. @@ -34,7 +34,7 @@ Decide how settings reach devices -Managed settings define policy that takes precedence over local developer configuration. Claude Code checks the four sources below in priority order and applies the first one that returns a non-empty configuration. A small set of [cross-source lock keys](</docs/en/settings#settings-precedence>), such as the sandbox allowlist locks, is honored when any admin-controlled source sets them; when a [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) is configured, its output is the only source these checks read. +Managed settings define organization policy. Claude Code checks the four sources below in priority order and applies the first one that returns a non-empty configuration. A small set of [cross-source lock keys](</docs/en/settings#settings-precedence>), such as the sandbox allowlist locks, is honored when any admin-controlled source sets them; when a [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) is configured, its output is the only source these checks read. Mechanism| Delivery| Priority| Platforms ---|---|---|--- @@ -46,7 +46,7 @@ Windows: `C:\Program Files\ClaudeCode\managed-settings.json`| Medium| All Windows user registry| `HKCU\SOFTWARE\Policies\ClaudeCode`| Lowest| Windows only -A configured [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) preempts all four sources: its output becomes the only managed configuration for the run. See [Settings precedence](</docs/en/settings#settings-precedence>). Server-managed settings reach devices at authentication time and refresh hourly during active sessions, with no endpoint infrastructure. Delivery through the claude.ai admin console requires a Claude for Teams or Enterprise plan. Deployments on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry can get the same remote delivery by running a [Claude apps gateway](</docs/en/claude-apps-gateway>), or use one of the file-based or OS-level mechanisms instead. If your organization mixes providers, configure [server-managed settings](</docs/en/server-managed-settings>) for claude.ai users plus a [file-based or plist/registry fallback](</docs/en/settings#settings-files>) so other users still receive managed policy. The plist and HKLM registry locations work with any provider and resist tampering because they require admin privileges to write. The Windows user registry at HKCU is writable without elevation, so treat it as a convenience default rather than an enforcement channel. By default, WSL reads only the Linux file path at `/etc/claude-code`. To extend your Windows registry and `C:\Program Files\ClaudeCode` policy to WSL on the same machine, set [`wslInheritsWindowsSettings: true`](</docs/en/settings#available-settings>) in either of those admin-only Windows sources. Whichever mechanism you choose, managed values take precedence over user and project settings. Array settings such as `permissions.allow` and `permissions.deny` merge entries from all sources, so developers can extend managed lists but not remove from them. For [two exceptions](</docs/en/settings#settings-precedence>), `fallbackModel` and `availableModels`, the managed value replaces lower layers rather than merging. See [Server-managed settings](</docs/en/server-managed-settings>) and [Settings files and precedence](</docs/en/settings#settings-files>). +A configured [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) preempts all four sources: its output becomes the only managed configuration for the run. See [Settings precedence](</docs/en/settings#settings-precedence>). Server-managed settings reach devices at authentication time and refresh hourly during active sessions, with no endpoint infrastructure. Delivery through the claude.ai admin console requires a Claude for Teams or Enterprise plan. Deployments on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry can get the same remote delivery by running a [Claude apps gateway](</docs/en/claude-apps-gateway>), or use one of the file-based or OS-level mechanisms instead. If your organization mixes providers, configure [server-managed settings](</docs/en/server-managed-settings>) for claude.ai users plus a [file-based or plist/registry fallback](</docs/en/settings#settings-files>) so other users still receive managed policy. The plist and HKLM registry locations work with any provider and resist tampering because they require admin privileges to write. The Windows user registry at HKCU is writable without elevation, so treat it as a convenience default rather than an enforcement channel. By default, WSL reads only the Linux file path at `/etc/claude-code`. To extend your Windows registry and `C:\Program Files\ClaudeCode` policy to WSL on the same machine, set [`wslInheritsWindowsSettings: true`](</docs/en/settings#available-settings>) in either of those admin-only Windows sources. Whichever mechanism you choose, managed values take precedence over user and project settings, apart from the exceptions under [Settings precedence](</docs/en/settings#settings-precedence>). Array settings such as `permissions.allow` and `permissions.deny` merge entries from all sources, so developers can extend managed lists but not remove from them. For [two exceptions](</docs/en/settings#settings-precedence>), `fallbackModel` and `availableModels`, the managed value replaces lower layers rather than merging. See [Server-managed settings](</docs/en/server-managed-settings>) and [Settings files and precedence](</docs/en/settings#settings-files>). ###
modified Orchestrate teams of Claude Code sessions View current →
--- a/agent-teams.md +++ b/agent-teams.md @@ -122,7 +122,12 @@ Spawn 4 teammates to refactor these modules in parallel. Use Sonnet for each teammate. -Teammates don’t inherit the lead’s `/model` selection by default. To change the model used when the prompt doesn’t specify one, set **Default teammate model** in `/config`. Pick **Default (leader’s model)** to have teammates follow the lead’s current model. Teammates inherit the lead’s [effort level](</docs/en/model-config#adjust-effort-level>). In split-pane mode this applies from v2.1.186; earlier versions did not pass the lead’s session effort to split-pane teammates. +Teammates don’t inherit the lead’s `/model` selection by default. To change the model used when the prompt doesn’t specify one, set **Default teammate model** in `/config`. Pick **Default (leader’s model)** to have teammates follow the lead’s current model. Claude Code checks each teammate’s model, whether requested in your prompt or set through **Default teammate model** , against your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist. When the allowlist blocks a value, Claude Code substitutes another model: + + * **Family alias such as`opus`**: On the Anthropic API and Claude Platform on AWS, Claude Code runs the teammate on the newest version of that family the allowlist permits. On providers with provider-specific model IDs, where the [substitution doesn’t operate](</docs/en/model-config#restrict-model-selection>), a blocked alias falls back like any other blocked value per the next bullet + * **Any other blocked value, including a family alias on providers where the substitution doesn’t operate or whose family has no permitted version** : Claude Code uses the default teammate model. When the blocked value is the **Default teammate model** setting itself, Claude Code uses your provider’s default Opus model, or the lead’s model when the allowlist blocks that too + +Teammates inherit the lead’s [effort level](</docs/en/model-config#adjust-effort-level>). In split-pane mode this applies from v2.1.186; earlier versions did not pass the lead’s session effort to split-pane teammates. ### @@ -250,7 +255,15 @@ Permissions -Teammates start with the lead’s permission settings. If the lead runs with `--dangerously-skip-permissions`, all teammates do too. After spawning, you can change individual teammate modes, but you can’t set per-teammate modes at spawn time. When one agent sends another a message over `SendMessage`, the receiving agent is told it came from another Claude session, not from you. A teammate cannot approve a permission prompt or supply consent on your behalf, and a teammate that was denied an action cannot relay it to another teammate to bypass the check. In [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), the classifier treats an approval claim relayed from another agent as untrusted input rather than confirmation from you. Teammate permission prompts appear in the lead session, so approve them there yourself. Plan approval is the designed exception: the lead session grants teammate plan approvals without a separate prompt to you. +Teammates start with the lead’s permission settings. If the lead runs with `--dangerously-skip-permissions`, all teammates do too. After spawning, you can change individual teammate modes, but you can’t set per-teammate modes at spawn time. Teammate permission prompts appear in the lead session, so approve them there yourself. Plan approval is the designed exception: the lead session grants teammate plan approvals without a separate prompt to you. + +#### + +​ + +Messages between agents + +When one agent sends another a message over `SendMessage`, Claude Code tells the receiving agent the message came from another Claude session, not from you. A teammate cannot approve a permission prompt or supply consent on your behalf, and a teammate that was denied an action cannot relay it to another teammate to bypass the check. In [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), the classifier treats an approval claim relayed from another agent as untrusted input rather than confirmation from you. The classifier also reviews each message an agent sends before Claude Code delivers it, whether a plain message or a structured protocol message such as a shutdown request or plan approval response. A message the classifier blocks never reaches the recipient. ###
modified Manage multiple agents with agent view View current →
Show diff (154 lines)
--- a/agent-view.md +++ b/agent-view.md @@ -117,7 +117,13 @@ Pull request status -When a session opens a pull request, a `#1234` label appears at the right edge of the row, linked to the pull request. Claude Code emits the link even when it can’t detect hyperlink support, for example over SSH or tmux; set [`FORCE_HYPERLINK=0`](</docs/en/env-vars>) to render the label as plain text. The label persists when you send a follow-up to the session, so the pull request remains visible while the row reverts to live progress. Claude opens these pull requests from the session itself when the task calls for one; How file edits are isolated covers what Claude commits and pushes without asking and when it asks first. A session that works on an existing pull request is linked to it the same way. Editing, commenting on, closing, or marking a pull request ready with `gh` links the pull request that the command’s own output names, so a `gh` command whose captured output names no pull request doesn’t create a link; `gh pr merge` is the common case, because it prints its result only to an interactive terminal. Checking a pull request out with `gh pr checkout`, or pushing to a branch that has an open pull request, links it by looking up that branch with `gh pr view` instead. When a session is linked to more than one pull request, the label shows a count instead, such as `3 PRs`, colored by the open pull request that most needs attention. Open the peek panel to see them all. The pull request number is colored by its status: +When a session opens a pull request, a `#1234` label appears at the right edge of the row, linked to the pull request. Claude Code emits the link even when it can’t detect hyperlink support, for example over SSH or tmux; set [`FORCE_HYPERLINK=0`](</docs/en/env-vars>) to render the label as plain text. The label persists when you send a follow-up to the session, so the pull request remains visible while the row reverts to live progress. Claude opens these pull requests from the session itself when the task calls for one; How file edits are isolated covers what Claude commits and pushes without asking and when it asks first. A session that works on an existing pull request is linked to it the same way. Claude Code finds the pull request differently depending on the command Claude runs: + + * When Claude edits, comments on, closes, or marks a pull request ready with `gh`, Claude Code links the pull request that the command’s own output names. A `gh` command whose captured output names no pull request doesn’t create a link; `gh pr merge` is the common case, because it prints its result only to an interactive terminal. + * When Claude checks a pull request out with `gh pr checkout` or pushes to a branch, Claude Code looks the branch up with `gh pr view` and links its open pull request. + * The pull request doesn’t need to exist yet when Claude pushes: Claude Code retries the branch lookup after up to five later `git`, `gh`, `glab`, or `curl` commands run in the same directory, so a pull request created after the push, including one Claude creates through the GitHub REST API, links when a retry finds it. + +When a session is linked to more than one pull request, the label shows a count instead, such as `3 PRs`, colored by the open pull request that most needs attention. Open the peek panel to see them all. The pull request number is colored by its status: Color| Pull request status ---|--- @@ -148,7 +154,15 @@ Attach to a session -Press `Enter` or `→` on a selected row to attach. Agent view is replaced by the full interactive session. When you attach, Claude posts a short recap of what happened while you were away. While attached, the session behaves like any other Claude Code session: [commands](</docs/en/commands>), keyboard shortcuts, and features all work, with the exceptions below. While you’re attached, `/install-github-app` and the [`/mcp`](</docs/en/mcp>) settings list work normally, since a human at the terminal can complete their dialogs. When nobody is attached, these commands can’t open their dialogs, so the session appears under `Needs input` in agent view with a row such as `open this session to manage MCP servers`, and the transcript reply says the same. Attach and run the command again to continue; the needs-input row clears when you attach. `/mcp reconnect <server>`, `/mcp enable`, and `/mcp disable` work without attaching either way. Attached sessions always render in [fullscreen mode](</docs/en/fullscreen>), regardless of your `tui` setting, because a background session has no terminal scrollback to append to. Scroll with `PgUp`, `PgDn`, or the mouse wheel, and press `Ctrl+O` for transcript mode. Your terminal’s native scroll and tmux copy mode show only the current viewport, the same as when you run any fullscreen application. Press `←` on an empty prompt, or run `/exit`, to detach and return to agent view, whether you opened the session from agent view or with `claude attach <id>` from your shell. On Windows, if you press `←` within about half a second of attaching, Claude Code shows `Ambiguous ←, press again to detach`, because in that window the terminal can redeliver a press from before you attached. Press `←` again to detach. `Ctrl+Z` also detaches but goes back to where you started instead: agent view if you attached from there, or your shell if you ran `claude attach`. Use `Ctrl+Z` when a dialog has focus and isn’t responding to `←`. `Ctrl+C` keeps its standard interrupt behavior while attached: it cancels a running response or `!` shell command rather than detaching. Pressing `Ctrl+C` twice on an empty prompt detaches, the same as in any session. Detaching never stops a background session: `←`, `Ctrl+Z`, `/exit`, and double `Ctrl+C` or double `Ctrl+D` all leave it running. To end a session from inside it, run `/stop`. In a session running in the foreground, one you started in the terminal rather than attached to from agent view, pressing `←` on an empty prompt backgrounds it and opens agent view with that row selected, so you can switch sessions without leaving the terminal. The same single press detaches an attached session. If you press `←` right after you delete the last of the prompt’s text or move through prompt history, Claude Code asks you to confirm: the first press shows `Press ← again to open agents`, or `Press ← again to go back to agents` in an attached session, and the second press switches. When `←` backgrounds a foreground session, agent view shows `Your conversation moved to the background` above the list, with that session’s row already selected. From there: +Press `Enter` or `→` on a selected row to attach. Agent view is replaced by the full interactive session. When you attach, Claude posts a short recap of what happened while you were away. While attached, the session behaves like any other Claude Code session: [commands](</docs/en/commands>), keyboard shortcuts, and features all work, with the exceptions below. While you’re attached, `/install-github-app` and the [`/mcp`](</docs/en/mcp>) settings list work normally, since a human at the terminal can complete their dialogs. When nobody is attached, these commands can’t open their dialogs, so the session appears under `Needs input` in agent view with a row such as `open this session to manage MCP servers`, and the transcript reply says the same. Attach and run the command again to continue; the needs-input row clears when you attach. `/mcp reconnect <server>`, `/mcp enable`, and `/mcp disable` work without attaching either way. Attached sessions always render in [fullscreen mode](</docs/en/fullscreen>), regardless of your `tui` setting, because a background session has no terminal scrollback to append to. Scroll with `PgUp`, `PgDn`, or the mouse wheel, and press `Ctrl+O` for transcript mode. Your terminal’s native scroll and tmux copy mode show only the current viewport, the same as when you run any fullscreen application. Press `←` on an empty prompt, or run `/exit`, to detach and return to agent view, whether you opened the session from agent view or with `claude attach <id>` from your shell. On Windows, if you press `←` within about half a second of attaching, Claude Code shows `Ambiguous ←, press again to detach`, because in that window the terminal can redeliver a press from before you attached. Press `←` again to detach. `Ctrl+Z` also detaches but goes back to where you started instead: agent view if you attached from there, or your shell if you ran `claude attach`. Use `Ctrl+Z` when a dialog has focus and isn’t responding to `←`. `Ctrl+C` keeps its standard interrupt behavior while attached: it cancels a running response or `!` shell command rather than detaching. Pressing `Ctrl+C` twice on an empty prompt detaches, the same as in any session. Detaching never stops a background session: `←`, `Ctrl+Z`, `/exit`, and double `Ctrl+C` or double `Ctrl+D` all leave it running. To end a session from inside it, run `/stop`. + +#### + +​ + +Switch sessions without leaving the terminal + +In a session running in the foreground, one you started in the terminal rather than attached to from agent view, pressing `←` on an empty prompt backgrounds it and opens agent view with that row selected, so you can switch sessions without leaving the terminal. The same single press detaches an attached session. If you press `←` right after you delete the last of the prompt’s text or move through prompt history, Claude Code asks you to confirm: the first press shows `Press ← again to open agents`, or `Press ← again to go back to agents` in an attached session, and the second press switches. When `←` backgrounds a foreground session, agent view shows `Your conversation moved to the background` above the list, with that session’s row already selected. From there: * Press `Enter` to reopen the conversation. * Press `Esc` to undo the switch and return to the conversation. If `Esc` shows `Still starting — try again in a moment`, the background session isn’t ready yet, so press `Esc` again in a moment. @@ -169,13 +183,7 @@ * Press `Ctrl+R` to rename a session * Press `Enter` on a group header to collapse it -To remove a session from the list, press `Ctrl+X` to stop it and `Ctrl+X` again within two seconds to delete it. Pressing `Ctrl+X` on a group header deletes every session in that group after confirmation. 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. Deleting removes the session from agent view. If Claude created a worktree for the session, deleting removes that worktree too, including any uncommitted changes in it, so commit work you want to keep first. A worktree you created yourself and started the session inside is left in place. The conversation transcript stays on your local machine and remains available through `claude --resume`. Deleting never removes a worktree with commits that aren’t pushed anywhere, or one that another running session claims or has locked. Claude Code keeps the worktree and the session, and the footer names the kept path and the reason. Push the commits, or close the other session, then delete again. When a delete is refused, the session’s row shows `not deleted` with the reason, and a worktree that couldn’t be removed is reported with the underlying git error. A worktree that git no longer recognizes, for example one removed from git’s records by `git worktree prune`, doesn’t block deletion: the session is deleted, the worktree directory is left untouched on disk, and the footer names its path. You can also delete a session whose worktree directory doesn’t belong to any git repository, for example because the repository was deleted after the session started, or because a [WorktreeCreate hook](</docs/en/hooks#worktreecreate>) created the directory outside any git repository. What happens to the directory depends on what remains in it and whether another session references it: - - * If the directory is already gone, Claude Code deletes the session immediately. - * When files remain in it, no repository can verify them, so agent view asks for the `Ctrl+X` double-press as the confirmation to discard those files. For a worktree Claude Code created with git, the delete then removes the directory and everything in it. For a hook-created directory, Claude Code runs your [`WorktreeRemove` hook](</docs/en/hooks#worktreeremove>) instead; without one, it refuses the delete and keeps the session. `claude rm` keeps the session and worktree in every case and names the reason. - * Either way, Claude Code keeps a directory that another finished session’s records also name, since its files may be that session’s work. - -Deleting also clears the session from the supervisor’s session list, whether you delete with `Ctrl+X` or with `claude rm` from the shell, so the removal persists across supervisor restarts. 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: +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 always 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: * `/resume` names an id or a search term * the view is scoped with `--cwd` @@ -303,11 +311,12 @@ Copy the session with /fork -Run `/fork` to copy the current conversation into a new background session while the original keeps running. The copy starts with everything in the conversation up to that point, plus the working directory, model, permission mode, effort level, and any directories or “don’t ask again” permission grants you added during the session, and appears as its own row in agent view. From that moment the two sessions are independent: what the copy does never reaches the original conversation. Requires Claude Code v2.1.212 or later; on v2.1.161 through v2.1.211, `/fork` starts a [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>) instead, which is now `/subtask`. When agent view is turned off, `/fork` keeps the forked-subagent behavior and `/subtask` isn’t available. Pass a prompt such as `/fork open a draft pull request with the work so far` and the copy starts working on it immediately. Without a prompt the copy waits for its first instruction: select its row in `claude agents` and press `Space` to send one, or run `claude attach <id>`. The selected row shows `space to send it a prompt` while it waits. The `/fork` confirmation is one line showing the copy’s state, such as `session running`, the name of its agent-view row, and its session ID for `claude attach`. Click the name to switch into the copy: this session moves to the background, the same as pressing `←`, and agent view opens the copy’s session. Claude Code instructs the copy to make its code changes, including changes it makes through shell commands, outside the checkout this session is editing, except when the copy edits that checkout in place because the layout is a bare repository or worktree isolation is turned off. The checkout the copy edits depends on where the current session is running, and the confirmation names the location whenever the copy edits an existing checkout: +Run `/fork` to copy the current conversation into a new background session while the original keeps running. The copy starts with everything in the conversation up to that point, plus the model, permission mode, effort level, and any directories or “don’t ask again” permission grants you added during the session, and appears as its own row in agent view. See the bullets below for where the copy starts. From that moment the two sessions are independent: what the copy does never reaches the original conversation. Requires Claude Code v2.1.212 or later; on v2.1.161 through v2.1.211, `/fork` starts a [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>) instead, which is now `/subtask`. When agent view is turned off, `/fork` keeps the forked-subagent behavior and `/subtask` isn’t available. Pass a prompt such as `/fork open a draft pull request with the work so far` and the copy starts working on it immediately. Without a prompt the copy waits for its first instruction: select its row in `claude agents` and press `Space` to send one, or run `claude attach <id>`. The selected row shows `space to send it a prompt` while it waits. The `/fork` confirmation is one line showing the copy’s state, such as `session running`, the name of its agent-view row, and its session ID for `claude attach`. Click the name to switch into the copy: this session moves to the background, the same as pressing `←`, and agent view opens the copy’s session. Except when the copy edits in place, Claude Code instructs it to create a worktree of its own before making code changes. Outside a git repository, only a copy moved out of a hook-created worktree gets the instruction; with no [`WorktreeCreate` hook](</docs/en/hooks#worktreecreate>), the copy edits in place. A copy moved out of your worktree is also told never to edit, run commands in, or enter that worktree, whatever the isolation setting. Where the copy starts depends on where the current session is running: * Like any dispatched session, the copy moves into its own worktree before editing files. In that case the confirmation doesn’t mention where the copy runs. - * When the current session is itself running inside a linked [worktree](</docs/en/worktrees>) that has a main working tree to return to, the copy starts in that main working tree, so the two sessions don’t edit the same checkout. When its task builds on your work, Claude Code also instructs the copy to base a new branch on yours, since your branch stays checked out in your worktree. The confirmation ends with `runs in the origin tree`. - * In a bare-repository layout there is no main working tree, so the copy stays where it is, and the confirmation ends with `edits this checkout`. The same note appears when worktree isolation is turned off, because the copy then edits the files you have open. + * When your session moved into its linked [worktree](</docs/en/worktrees>) after it started, the copy starts back where the session was before the move and, unless it edits in place, makes its code changes in a worktree of its own there. When your worktree is checked out on a branch, that instruction also tells a copy whose task builds on your work to base its new branch on yours, since your branch stays checked out in your worktree. The confirmation ends with `runs in the origin tree`. + * When you launched the session inside a linked worktree of a repository that has a main working tree, the copy starts in that main working tree, with the same worktree-of-its-own rule but no branch instruction. The confirmation ends with `runs in the origin tree` here too. + * A session launched inside a worktree of a bare-repository layout has no main working tree to return to, so the copy stays where it is, and the confirmation ends with `edits this checkout`. The same note appears when worktree isolation is turned off in a session that isn’t inside a linked worktree, because the copy then edits the files you have open. Sessions started with launch flags the copy wouldn’t inherit, such as a replaced system prompt or a `--tools` allowlist, can’t be forked; Claude Code says so instead of making a partial copy. A session dispatched from agent view forks normally: the copy is launched with the same [agent definition](</docs/en/sub-agents>) and appended instructions as the session it came from. @@ -372,7 +381,7 @@ How file edits are isolated -Every background session, whether started from agent view, `/bg`, or `claude --bg`, starts in your working directory. Before editing files, Claude moves the session into an isolated [git worktree](</docs/en/worktrees>) under `.claude/worktrees/`, so parallel sessions can read the same checkout but each writes to its own. Claude skips the worktree when: +Every background session, whether started from agent view, `/bg`, or `claude --bg`, starts in your working directory. Before editing files, Claude moves the session into an isolated [git worktree](</docs/en/worktrees>) under `.claude/worktrees/`, so parallel sessions can read the same checkout but each writes to its own. Once the session is in its worktree, Claude Code [blocks file edits and commands that reach the main checkout](</docs/en/worktrees#how-claude-code-enforces-isolation>), for the session and for any subagents it spawns. Claude skips the worktree when: * The session is already inside a linked git worktree, whether Claude created it under `.claude/worktrees/` or you created it with `git worktree add` somewhere else * The working directory isn’t a git repository and no [`WorktreeCreate` hook](</docs/en/hooks#worktreecreate>) is configured @@ -386,15 +395,7 @@ } } -Outside a git repository, sessions write to the working directory directly and aren’t isolated from each other, so avoid dispatching parallel sessions that edit the same files. If you use a different version control system, configure a [`WorktreeCreate` hook](</docs/en/worktrees#non-git-version-control>) and Claude isolates edits the same way it does for git. When the hook fails in a directory that isn’t a git repository, the session skips isolation for that directory and edits the working directory in place. Inside a git repository, writes stay blocked until the session isolates. Deleting a session removes or keeps the worktree Claude created for it, depending on how you delete it and what the worktree holds: - - * Deleting in agent view with `Ctrl+X` twice removes the worktree, including any uncommitted changes, so commit the changes you want to keep first. - * Deleting from the shell with `claude rm` keeps a worktree that has uncommitted changes, along with its session row. - * Neither path removes a worktree with commits that aren’t pushed anywhere: the worktree is kept together with its session and the output names the kept path and the reason. - * When the session’s worktree directory doesn’t belong to any git repository, because the repository was deleted later or a hook created the directory outside one, deletion depends on what remains in the directory and which path you use; Organize the list covers which path removes, keeps, or refuses the delete. - * A worktree you created yourself and started the session inside is left in place either way. - -To find a session’s worktree path, peek the session or attach and check its working directory. A [subagent](</docs/en/sub-agents>) the background session spawns inherits the session’s working directory, so its file edits land in the session’s worktree rather than your working copy. To give a subagent its own separate worktree instead, set [`isolation: worktree`](</docs/en/sub-agents#supported-frontmatter-fields>) in its frontmatter or pass `isolation: "worktree"` when spawning it. When a background session has made code changes in a worktree Claude entered, Claude Code instructs Claude to preserve the work before finishing, so it survives if you delete the session and its worktree: +Outside a git repository, sessions write to the working directory directly and aren’t isolated from each other, so avoid dispatching parallel sessions that edit the same files. If you use a different version control system, configure a [`WorktreeCreate` hook](</docs/en/worktrees#non-git-version-control>) and Claude isolates edits the same way it does for git. When the hook fails in a directory that isn’t a git repository, the session skips isolation for that directory and edits the working directory in place. Inside a git repository, writes stay blocked until the session isolates. To find a session’s worktree path, peek the session or attach and check its working directory. A [subagent](</docs/en/sub-agents>) the background session spawns inherits the session’s working directory, so its file edits land in the session’s worktree rather than your working copy. To give a subagent its own separate worktree instead, set [`isolation: worktree`](</docs/en/sub-agents#supported-frontmatter-fields>) in its frontmatter or pass `isolation: "worktree"` when spawning it. When a background session has made code changes in a worktree Claude entered, Claude Code instructs Claude to preserve the work before finishing, so it survives if you delete the session and its worktree: * **Commit and push** : Claude commits without asking, and pushes the branch when the repository has a remote. * **Draft pull request** : Claude opens one when the task calls for it, and the `#N` label appears on the row. @@ -402,6 +403,26 @@ * **Your git instructions take precedence** : if the task, `CLAUDE.md`, or [memory](</docs/en/memory>) says you handle committing or pushing yourself, Claude leaves git to you. A session editing a checkout it didn’t isolate itself still asks before committing or switching branches. This applies when isolation is set to `"none"`, when the worktree move failed, or when the session started inside a worktree that already existed. Whatever the task, Claude ends the job with a report saying what it did and where the work is: a path, a branch, a pull request, or the answer itself. + +#### + +​ + +What deleting a session removes + +Delete a session with `Ctrl+X` twice in agent view or with `claude rm`. Except in the kept cases below, the session leaves the list. Its transcript stays on your machine through `claude --resume`, and the removal survives supervisor restarts. What happens to a worktree Claude created for the session: + + * Agent view removes it, including uncommitted changes, so commit what you want to keep first. + * `claude rm` keeps it, along with the session row, when it has uncommitted changes. + * Neither path removes one with unpushed commits, or one that another running session claims or has locked: Claude Code keeps the worktree and the session and names the kept path and the reason. In agent view, a refused delete shows `not deleted` with the reason on the session’s row. Push the commits or close the other session, then delete again. + * One git no longer recognizes, for example after `git worktree prune`, doesn’t block the delete: the session is deleted and the directory stays on disk. + +A worktree you created yourself and started the session inside is left in place either way. A session whose worktree directory belongs to no git repository, because the repository was deleted or a [`WorktreeCreate` hook](</docs/en/hooks#worktreecreate>) created the directory elsewhere, can still be deleted. While files remain in the directory: + + * Agent view asks for the same `Ctrl+X` double-press before discarding them. For a hook-created directory it runs your [`WorktreeRemove` hook](</docs/en/hooks#worktreeremove>) instead, and without one it refuses the delete and keeps the session. + * `claude rm` keeps the session and worktree, and names the reason. + +Either path keeps a directory that another finished session’s records name. ### @@ -474,7 +495,7 @@ `claude stop <id>`| Stop a session. Also accepts `claude kill` `claude respawn <id>`| Restart a session, running or stopped, with its conversation intact, e.g. to pick up an updated Claude Code binary `claude respawn --all`| Restart every running session, e.g. to move all sessions onto an updated Claude Code binary at once -`claude rm <id>`| Remove a session from the list, along with a worktree Claude created for it when that’s safe to delete; see how deleting handles worktrees. The conversation transcript stays on your local machine and remains available through `claude --resume` +`claude rm <id>`| Remove a session from the list, along with a worktree Claude created for it when that’s safe to delete; see What deleting a session removes. The conversation transcript stays on your local machine and remains available through `claude --resume` `claude daemon status`| Print the supervisor’s state, version, socket directory, and worker count `claude daemon stop --any`| Stop the supervisor process and the background sessions it hosts. Pass `--keep-workers` to leave background sessions running so the next supervisor reconnects to them. The next `claude agents` or `claude --bg` starts a fresh supervisor @@ -677,7 +698,7 @@ `.claude/worktrees/` is filling up -Deleting a session in agent view removes the worktree Claude created for it, and a worktree that can’t be removed safely keeps its session row so it isn’t orphaned. A worktree directory that git no longer recognizes is left on disk when its session is deleted, so remove leftover directories you don’t need by hand. `claude rm` keeps a worktree that has uncommitted changes, and its session row, and prints the kept path. List leftover entries with `git worktree list` in the project directory and remove each with `git worktree remove <path>`. See [Clean up worktrees](</docs/en/worktrees#clean-up-worktrees>). +Deleting a session in agent view removes the worktree Claude created for it, but some deletes keep the worktree or leave its directory on disk, so leftover directories can accumulate. Directories git no longer recognizes don’t appear in `git worktree list`, so remove those by hand. List leftover entries with `git worktree list` in the project directory and remove each with `git worktree remove <path>`. See [Clean up worktrees](</docs/en/worktrees#clean-up-worktrees>). ## @@ -689,7 +710,7 @@ * **Rate limits apply** : background sessions consume your subscription usage the same as interactive sessions, so running ten agents in parallel uses quota roughly ten times as fast as running one. * **Sessions are local** : background sessions run on your machine. They are preserved across sleep but stop if the machine shuts down. - * **Claude-created worktrees are deleted with the session in agent view** : commit changes before deleting a session that edited files in its own worktree. A worktree with commits that aren’t pushed anywhere is kept along with the session. `claude rm` also keeps a worktree that has uncommitted changes together with its session, and a worktree you created yourself is left in place. + * **Claude-created worktrees are deleted with the session in agent view** : commit changes before deleting a session that edited files in its own worktree. Some deletes keep the worktree instead. ## @@ -715,7 +736,7 @@ ---|--- v2.1.221| `/status` shows a `Session kind` row: `background job · attached` or `background job · unattended` in a background session, depending on whether a terminal is attached, and `interactive` in any other session. Before this release, `/status` didn’t report the session kind. -`/fork`: except when the copy edits in place, in a bare-repository layout or with worktree isolation turned off, Claude Code instructs the copy to create a new worktree of its own before making code changes, and a copy that moved to the main working tree to base a new branch on the original session’s branch instead of entering the original’s worktree to check it out. Before this release, the copy received no isolation instruction and could end up editing the worktree or checkout the original session was still working in. +`/fork`: Claude Code instructs the copy to isolate its work from the original session’s: the copy creates a worktree of its own before making code changes, stays out of the original session’s worktree, and bases a new branch on the original’s branch when its task builds on that work. See the linked section for the exact conditions. Before this release, the copy received no isolation instruction and could end up editing the worktree or checkout the original session was still working in. With [vim editor mode](</docs/en/interactive-mode#vim-editor-mode>) on, pressing `←` right after undoing the prompt back to empty with `u` asks for the same confirmation as deleting the text or moving through prompt history, and switches only on the second press; before this release the press switched immediately. v2.1.219| With [vim editor mode](</docs/en/interactive-mode#vim-editor-mode>) on, pressing `←` on an empty prompt opens agent view from NORMAL mode as well as INSERT, and the footer’s `←` hint shows in NORMAL mode; before this release the gesture and hint were INSERT-only, and in NORMAL mode `←` on an empty prompt did nothing. Typing into the input while Claude Code waits to background the session cancels the switch with `Backgrounding cancelled — you have unsent text in the input. Send it or clear it, then press ← again.` so a typed draft isn’t lost.
modified Claude Code changelog View current →
--- a/changelog.md +++ b/changelog.md @@ -1,4 +1,30 @@ This page is generated from the [CHANGELOG.md on GitHub](<https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md>). Run `claude --version` to check your installed version. + +​ + +2.1.223 + +August 6, 2026 + + * Added owner wildcard entries (`"owner/*"`) to the `strictKnownMarketplaces` and `blockedMarketplaces` managed settings for allowing or blocking all marketplace repos under a GitHub org + * Added a warning when workflow agents, forked skills, slash commands, or resumed background agents’ requested subagent model is restricted and the parent model runs instead + * Added a `/teleport` hint in cloud sessions showing how to continue locally with `claude --teleport <session id>` + * Fixed a Bash permission bypass where a crafted command could hide parts of itself from permission checks + * Fixed permission prompts so commands padded with tabs or invisible Unicode can no longer hide part of the command from the approval dialog + * Fixed workflow scripts being able to use dynamic `import()` to run code outside the workflow sandbox + * Fixed a permission gap where an agent definition’s `bypassPermissions` mode ignored the org bypass-permissions disable policy + * Fixed resuming a session after a mid-session `/cd` coming back empty + * Fixed gateway model discovery hiding Claude models registered under provider-prefixed IDs such as `vertex_ai/claude-*` or `bedrock/anthropic.claude-*` + * Fixed `modelOverrides` keys that aren’t Anthropic model IDs being treated as the session’s canonical model ID; unknown keys are now ignored as documented + * Fixed managed settings: server-delivered settings no longer disable the env block of a machine-local `managed-settings.json` or MDM profile; admin env now merges per key + * Fixed sandboxed commands failing to start on Linux when `sandbox.filesystem.denyWrite` covers the working directory + * Fixed forked background agents getting stuck “already resuming” for the rest of the session when rebuilding the fork’s parent prompt failed during resume + * Fixed a resumed session failing every turn, or leaving the interactive app on an unresponsive error screen, when its history held a malformed diagnostics attachment + * Fixed a rare hang when parsing unusual `git push` output + * Changed `CLAUDE_CODE_DISABLE_1M_CONTEXT` to hold every Claude model with a native 1M window to 200K via auto-compaction, not just a fixed list; a startup warning now appears when auto-compaction isn’t holding the session to 200K + * Changed auto-compact to keep sessions on unrecognized model IDs within the assumed context window instead of letting them grow past it; set `CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT=1` to restore the previous behavior + * Changed `/review` to be an alias of `/code-review`, which reviews the current diff or a PR (`/code-review <level> <pr#>`); use `/code-review ultra` for a deep cloud review + * Changed `/code-review` with no effort level to reuse the level you typed last; type a level like `/code-review high` to change it ​
modified Claude apps gateway deployment and operations View current →
--- a/claude-apps-gateway-deploy.md +++ b/claude-apps-gateway-deploy.md @@ -273,7 +273,8 @@ Claude Desktop reports that its bootstrap configuration couldn’t be fetched| `/user/bootstrap` returned 404: the policy matching the user doesn’t carry a `desktop` key, or no policy matched. The gateway’s audit log records each rejection as `desktop_bootstrap.denied` with the reason.| Add a `desktop` block to the policy that matches the user, or to the `match: {}` base layer; an empty `desktop: {}` suffices. See [Claude Desktop overlay](</docs/en/claude-apps-gateway-config#claude-desktop-overlay>). Startup shows `Gateway login is configured in managed settings, but this Claude Code build does not include Cloud gateway support.`| The installed Claude Code build predates gateway support| Have the developer update Claude Code to a release that includes Cloud gateway support CLI `/login`: `Gateway hosts must be on your organization's private network; <host> resolves to the public (or unrecognized) address <ip>`| The gateway hostname resolves to at least one public IP address. Claude Code checks each resolved address and requires every one to be private. A common cause is a dual-stack name where one family resolves to a public address, including AWS internal dual-stack load balancers, which return public-range AAAA addresses. Anthropic-operated public gateway endpoints are exempt from the check, and `/login` accepts them over `https://`. Before v2.1.206, `/login` rejected them like any other public address| Have the gateway name resolve only to private addresses on developer machines. For a dual-stack name, drop the public-range record or serve a separate internal-only DNS name. See the [private-network prerequisite](</docs/en/claude-apps-gateway#prerequisites>). -CLI `/login`: `Gateway login requires a direct connection and does not support connecting through an HTTP proxy`| An `HTTPS_PROXY` or `HTTP_PROXY` applies to the gateway host and the proxy’s hostname resolves to a public address. A proxy whose host resolves only to private addresses is allowed and doesn’t trigger this error| Add the gateway host to `NO_PROXY` on the developer’s machine so the connection is direct, or use a proxy whose hostname resolves to private addresses +CLI `/login`: `Gateway login would go through proxy <proxy>, which is not on a private network`| An `HTTPS_PROXY` or `HTTP_PROXY` applies to the gateway host and the proxy’s hostname resolves to a public address. A proxy whose host resolves only to private addresses is allowed and doesn’t trigger this error| Add the gateway host to `NO_PROXY` on the developer’s machine so the connection is direct, or use a proxy whose hostname resolves to private addresses. The message names the exact `NO_PROXY` entry to add +CLI `/login`: `Could not resolve the configured HTTP proxy`| The hostname in `HTTPS_PROXY` or `HTTP_PROXY` doesn’t resolve from the developer’s machine, typically because it isn’t connected to the corporate network| Have the developer connect to your network or VPN and retry, or fix the proxy URL CLI `/login`: `Could not resolve gateway host <host>`| The machine can’t resolve the gateway’s internal DNS name, typically because it isn’t on the corporate network| Have the developer connect to your network or VPN, then retry `/login` Boot exits with a config validation error naming `store.postgres_url`| No Postgres configured; the gateway requires Postgres| Set `store.postgres_url`. For local development, use a throwaway container: `docker run --rm -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust postgres`. Boot exits: `requires the native binary`| Running under Node instead of the native binary| Install Claude Code with one of the [standalone install methods](</docs/en/setup>)
modified Explore the .claude directory View current →
--- a/claude-directory.md +++ b/claude-directory.md @@ -18,7 +18,7 @@ File| Location| Purpose ---|---|--- -`managed-settings.json`| System-level, varies by OS| Enterprise-enforced settings that you can’t override. See [server-managed settings](</docs/en/server-managed-settings>). +`managed-settings.json`| System-level, varies by OS| Enterprise-enforced settings that you can’t override, apart from [narrow exceptions](</docs/en/settings#settings-precedence>). See [server-managed settings](</docs/en/server-managed-settings>). `CLAUDE.local.md`| Project root| Your private preferences for this project, loaded alongside CLAUDE.md. Create it manually and add it to `.gitignore`. Installed plugins| `~/.claude/plugins`| Cloned marketplaces, installed plugin versions, and per-plugin data, managed by `claude plugin` commands. Orphaned versions are deleted 14 days after a plugin update or uninstall. See [plugin caching](</docs/en/plugins-reference#plugin-caching-and-file-resolution>). @@ -55,7 +55,7 @@ Several things can override what you put in these files: - * [Managed settings](</docs/en/server-managed-settings>) deployed by your organization take precedence over everything + * [Managed settings](</docs/en/server-managed-settings>) deployed by your organization take precedence over everything, apart from the [exceptions under Settings precedence](</docs/en/settings#settings-precedence>) * CLI flags like `--permission-mode` or `--settings` override `settings.json` for that session * Some environment variables take precedence over their equivalent setting, but this varies: check the [environment variables reference](</docs/en/env-vars>) for each one
added Claude Tag View current →
--- a/claude-tag.md +++ b/claude-tag.md @@ -0,0 +1 @@ +Claude Tag is a Slack integration that runs `@Claude` in your team’s channels as your organization’s shared identity with admin-configured access. Anyone in a channel can tag `@Claude` into a thread and assign it a task. Read the [Claude Tag documentation](<https://claude.com/docs/claude-tag/overview>) on claude.com to set it up and start using it. Claude Tag is available on Team and Enterprise plans, and is distinct from the earlier [Claude Code in Slack](</docs/en/slack>), which runs each session under an individual user’s account. On Pro and Max plans, where Claude Tag isn’t available, Claude Code in Slack remains the setup path.
modified CLI reference View current →
--- a/cli-reference.md +++ b/cli-reference.md @@ -95,7 +95,7 @@ `--maintenance`| Run [Setup hooks](</docs/en/hooks#setup>) with the `maintenance` matcher before the session (print mode only)| `claude -p --maintenance "query"` `--max-budget-usd`| Maximum dollar amount to spend on API calls before stopping (print mode only). Spend from [subagents](</docs/en/sub-agents>) counts toward the cap. Once spend reaches the cap, spawning another subagent fails with `Budget limit reached`, and Claude Code stops background subagents that are still running; the cap-enforcement behaviors require Claude Code v2.1.217 or later| `claude -p --max-budget-usd 5.00 "query"` `--max-turns`| Limit the number of agentic turns (print mode only). Exits with an error when the limit is reached. No limit by default. With `--input-format stream-json`, a message sent while Claude is working stays queued and runs as its own turn, with its own limit, when the limit ends the current one. Before v2.1.205, Claude Code discarded that message| `claude -p --max-turns 3 "query"` -`--mcp-config`| Load MCP servers from JSON files or strings (space-separated)| `claude --mcp-config ./mcp.json` +`--mcp-config`| Load MCP servers from JSON files or strings (space-separated). When you pass this flag with `-p`, Claude Code waits for still-pending servers to connect before running the first turn, up to the [`MCP_TIMEOUT`](</docs/en/env-vars>) startup timeout, 30 seconds by default; a server with a [cached tool list](</docs/en/mcp#managing-your-servers>) skips the wait and connects on first use. The wait requires Claude Code v2.1.221 or later| `claude --mcp-config ./mcp.json` `--model`| Sets the model for the current session with an alias for the latest model (`sonnet`, `opus`, `haiku`, or `fable`) or a model’s full name. Overrides the [`model`](</docs/en/settings#available-settings>) setting and [`ANTHROPIC_MODEL`](</docs/en/model-config#environment-variables>)| `claude --model claude-sonnet-5` `--name`, `-n`| Set a display name for the session, shown in `/resume` and the terminal title. You can resume a named session with `claude --resume <name>`. @@ -104,7 +104,7 @@ `--no-session-persistence`| Disable session persistence so sessions are not saved to disk and cannot be resumed. Print mode only. The [`CLAUDE_CODE_SKIP_PROMPT_HISTORY`](</docs/en/env-vars>) environment variable does the same in any mode| `claude -p --no-session-persistence "query"` `--output-format`| Specify output format for print mode (options: `text`, `json`, `stream-json`)| `claude -p "query" --output-format json` `--permission-mode`| Begin in a specified [permission mode](</docs/en/permission-modes>). Accepts `default`, `acceptEdits`, `plan`, `auto`, `dontAsk`, `bypassPermissions`, or `manual` as an alias for `default`. The `manual` alias selects the mode the UI labels Manual and requires Claude Code v2.1.200 or later; `claude --help` lists it in place of `default`, and both values work. Overrides `defaultMode` from settings files| `claude --permission-mode plan` -`--permission-prompt-tool`| Specify an MCP tool to handle permission prompts in non-interactive mode. Claude Code waits for that tool’s MCP server to connect before running the first turn, up to the [`MCP_TIMEOUT`](</docs/en/env-vars>) startup timeout of 30 seconds. Before v2.1.206, a slow-starting server could make the run [exit with an error that the MCP tool was not found](</docs/en/errors#mcp-permission-prompt-tool-not-found>). +`--permission-prompt-tool`| Specify an MCP tool to handle permission prompts in non-interactive mode. Claude Code waits for that tool’s MCP server to connect before running the first turn, up to the [`MCP_TIMEOUT`](</docs/en/env-vars>) startup timeout, 30 seconds by default. Before v2.1.206, a slow-starting server could make the run [exit with an error that the MCP tool was not found](</docs/en/errors#mcp-permission-prompt-tool-not-found>). The prompt tool can’t approve an MCP tool marked as [requiring user interaction](</docs/en/mcp#require-approval-for-a-specific-tool>): Claude Code converts an `allow` result for one to a deny. This restriction requires Claude Code v2.1.199 or later| `claude -p --permission-prompt-tool mcp_auth_tool "query"` `--plugin-dir`| Load a plugin from a directory or `.zip` archive for this session only. Each flag takes one path. Repeat the flag for multiple plugins: `--plugin-dir A --plugin-dir B.zip`| `claude --plugin-dir ./my-plugin`
modified Code Review View current →
--- a/code-review.md +++ b/code-review.md @@ -96,13 +96,7 @@ Install the Claude GitHub App -Follow the prompts to install the Claude GitHub App to your GitHub organization. The app requests these repository permissions: - - * **Contents** : read and write - * **Issues** : read and write - * **Pull requests** : read and write - -Code Review uses read access to contents and write access to pull requests. The broader permission set also supports [GitHub Actions](</docs/en/github-actions>) if you enable that later. +Follow the prompts to install the Claude GitHub App: pick the GitHub organization that owns the repositories you want reviewed, choose which repositories the app can access, and approve the requested permissions.To review a pull request, Claude reads your repository contents through the app’s read access, and posts comments and the check run through its write access to pull requests and checks. During installation, you grant a broader permission set shared by other Claude features, such as [GitHub Actions](</docs/en/github-actions>); see [GitHub App permissions](</docs/en/github-actions#github-app-permissions>) for the full list. 4
modified Commands View current →
--- a/commands.md +++ b/commands.md @@ -38,7 +38,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. Alias: `/share`. Before v2.1.212, `/bug` and `/share` were aliases of `/feedback` `/cd <path>`| Move this session to a new working directory. The conversation’s prompt cache is preserved: the new directory’s [`CLAUDE.md`](</docs/en/memory>) is appended as a message instead of rebuilding the system prompt. The session is relocated to the new directory’s project storage, so `--resume` and `--continue` find it from there. Prompts you to trust the directory if you haven’t worked in it before. Typing a partial path shows matching directory suggestions; press `Tab` to accept one. The suggestions require Claude Code v2.1.206 or later. To grant access to an extra directory without moving the session, use `/add-dir`. Restrict or disable `/cd` targets with [`Cd` permission rules](</docs/en/permissions#cd>). Requires Claude Code v2.1.169 or later; earlier versions report `Unknown command: /cd` `/chrome`| Configure [Claude in Chrome](</docs/en/chrome>) settings -`/claude-api [migrate|managed-agents-onboard]`| **[Skill](</docs/en/skills#bundled-skills>).** Load Claude API reference material for your project’s language (Python, TypeScript, Java, Go, Ruby, C#, PHP, or cURL) and Managed Agents reference. Covers tool use, streaming, batches, structured outputs, and common pitfalls. Also activates automatically when your code imports `anthropic` or `@anthropic-ai/sdk`. Run `/claude-api migrate` to upgrade existing Claude API code to a newer model: Claude asks which files to scan and which model to target, then updates model IDs, thinking configuration, and other parameters that changed between versions. Run `/claude-api managed-agents-onboard` for an interactive walkthrough that creates a new Managed Agent from scratch +`/claude-api [migrate|managed-agents-onboard|prompt-audit]`| **[Skill](</docs/en/skills#bundled-skills>).** Load [Claude API](<https://platform.claude.com/docs/en/api/overview>) and Managed Agents reference material for your project’s language. Also activates automatically when your code imports `anthropic` or `@anthropic-ai/sdk`. Run `migrate` to upgrade existing Claude API code to a newer model, `managed-agents-onboard` for a walkthrough that creates a new Managed Agent, or `prompt-audit` to flag instructions written for older models in your prompts, skills, and tool descriptions and propose fixes as a diff. The `prompt-audit` subcommand requires Claude Code v2.1.221 or later `/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] [target]`| **[Skill](</docs/en/skills#bundled-skills>).** Review the current diff for correctness bugs and cleanup opportunities. Pass `--fix` to apply findings, `--comment` to post them as inline GitHub PR comments, or `ultra` to run a deep [cloud review](</docs/en/ultrareview>). See [Review a diff locally](</docs/en/code-review#review-a-diff-locally>) for effort levels, targeting, and how it relates to `/simplify` `/color [color|default]`| Set the prompt bar color for the current session. Available colors: `red`, `blue`, `green`, `yellow`, `purple`, `orange`, `pink`, `cyan`. Use `default` to reset, or run with no argument to pick a random color. When [Remote Control](</docs/en/remote-control>) is connected, the color syncs to claude.ai/code. Also available in non-interactive mode (`-p`); requires Claude Code v2.1.205 or later @@ -53,7 +53,7 @@ `/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; on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and Claude Platform on AWS the underlying tool can’t reach claude.ai, so the command is unavailable `/desktop`| Continue the current session in the Claude Code Desktop app. Requires macOS or x64 Windows and a Claude subscription. Alias: `/app` -`/diff`| Open an interactive diff viewer showing uncommitted changes and per-turn diffs. Use left/right arrows to switch between the current git diff and individual Claude turns, and up/down to browse files. Press Enter to open the selected file’s diff, scroll it with up/down or PageUp/PageDown, and press Esc to return to the file list. As of v2.1.198, the open viewer also refreshes automatically when the repository’s git state changes outside the session, such as a branch switch or commit in another terminal +`/diff`| Open an interactive diff viewer showing uncommitted changes and per-turn diffs. Use left/right arrows to switch between the current git diff and individual Claude turns, and up/down to browse files. Press Enter to open the selected file’s diff, scroll it with up/down or PageUp/PageDown, and press Esc to return to the file list. Claude Code computes these diffs from raw git blob content, so diff drivers and `textconv` filters configured in `.gitattributes` or git config don’t apply. Before v2.1.222, workspace-configured drivers and filters could rewrite the viewer’s output. The open viewer also refreshes automatically when the repository’s git state changes outside the session, such as a branch switch or commit in another terminal; the auto-refresh requires Claude Code v2.1.198 or later `/doctor`| **[Skill](</docs/en/skills#bundled-skills>).** Run a setup checkup that diagnoses issues and can fix them. Checks installation health, including duplicate or leftover installs, `PATH` problems, and unparseable settings files. Finds unused skills, MCP servers, and plugins versus their context cost, flags slow [hooks](</docs/en/hooks>), and checks for a newer version on your release channel. Deduplicates local `CLAUDE.md` files against checked-in ones, trims checked-in [`CLAUDE.md`](</docs/en/memory>) files by cutting content Claude could derive from the codebase, and migrates the always-loaded guidance that remains into [skills](</docs/en/skills>) and nested `CLAUDE.md` files that load on demand. The trim cuts sections such as directory layouts, dependency lists, and architecture overviews, and keeps pitfalls, rationale, and conventions that differ from tool defaults. Also offers to make [auto mode](</docs/en/permissions#permission-modes>) your default and to [pre-approve](</docs/en/permissions>) frequently denied read-only commands. Reports findings first and asks for confirmation before changing anything. From the terminal, `claude doctor` prints read-only installation diagnostics without starting a session. Alias: `/checkup`. The `CLAUDE.md` trim check requires Claude Code v2.1.206 or later. Before v2.1.206, the version check compared Homebrew installs against the `autoUpdatesChannel` setting rather than the [installed cask’s channel](</docs/en/setup#configure-release-channel>). Before v2.1.205, `/doctor` opened a read-only diagnostics screen and pressing `f` sent the report to Claude `/effort [level|auto]`| Set the model [effort level](</docs/en/model-config#adjust-effort-level>). Accepts `low`, `medium`, `high`, `xhigh`, `max`, or [`ultracode`](</docs/en/workflows#let-claude-decide-with-ultracode>); available levels depend on the model, and `max` and `ultracode` are session-only. `auto` resets to the model default. Without an argument, opens an interactive slider. Takes effect immediately without waiting for the current response to finish. Also available in non-interactive mode (`-p`) with a level argument, where it applies to the current session only; requires Claude Code v2.1.205 or later. While the [model-default effort hold](</docs/en/model-config#adjust-effort-level>) is in force, a non-interactive `/effort` reports `Not applied`, so pass `--effort` at launch instead `/exit`| Exit the CLI. In an attached [background session](</docs/en/agent-view#attach-to-a-session>), this detaches and the session keeps running. Alias: `/quit` @@ -61,8 +61,8 @@ `/fast [on|off]`| Toggle [fast mode](</docs/en/fast-mode>) on or off. In non-interactive mode (`-p`), `/fast` works only in a session launched with fast mode in its [`--settings`](</docs/en/cli-reference#cli-flags>) value, for example `claude -p --settings '{"fastMode": true}'`; the toggle then applies to the current session only and isn’t saved as your default, and in any other non-interactive session the command reports that fast mode isn’t available. Requires Claude Code v2.1.205 or later `/feedback [report]`| Send product feedback about Claude Code. Opens the same dialog as `/bug` with the same consent step and sending rules `/fewer-permission-prompts`| **[Skill](</docs/en/skills#bundled-skills>).** Scan your transcripts for common read-only Bash and MCP tool calls, then add a prioritized allowlist to project `.claude/settings.json` to reduce permission prompts -`/focus`| Toggle the focus view, which shows only your last prompt, a one-line tool-call summary with edit diffstats, and the final response. As of v2.1.198, the tool-call summary also counts the subagents launched in the turn and collapses completed background-task notifications into a single count. The selection persists across sessions; set [`viewMode`](</docs/en/settings#available-settings>) in settings to override it. Only available in [fullscreen rendering](</docs/en/fullscreen>) -`/fork [prompt]`| Copy the current conversation into a new [background session](</docs/en/agent-view#from-inside-a-session>) and keep working here. The copy starts with everything in this conversation up to now and runs as its own row in [agent view](</docs/en/agent-view>); the two sessions are independent from that point on. Pass a prompt and the copy starts working on it immediately; without one it waits in agent view for its first prompt. To hand a side task to a subagent whose result comes back into this conversation, use `/subtask`. To switch into a copy yourself, use `/branch`. Requires Claude Code v2.1.212 or later; on v2.1.161 through v2.1.211 `/fork` starts a [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>) instead, and before v2.1.161 it is an alias for `/branch` unless forked subagents were enabled, by setting [`CLAUDE_CODE_FORK_SUBAGENT`](</docs/en/env-vars>) to `1` from v2.1.117 or by a server-side rollout. When [agent view is turned off](</docs/en/agent-view#turn-off-agent-view>), `/fork` keeps the forked-subagent behavior +`/focus`| Toggle the focus view, which shows only your last prompt, a one-line tool-call summary with edit diffstats, and the final response. As of v2.1.198, the tool-call summary also counts the subagents launched in the turn and collapses completed background-task notifications into a single count. The selection persists across sessions; set [`viewMode`](</docs/en/settings#available-settings>) in settings to override it. Only available in [fullscreen rendering](</docs/en/fullscreen>). The [VS Code extension](</docs/en/vs-code#use-the-prompt-box>) offers its own Focus view as a command-menu toggle, stored as an extension setting, independent of `viewMode` +`/fork [prompt]`| [Copy the current conversation](</docs/en/agent-view#copy-the-session-with-/fork>) into a new background session and keep working here; the two sessions are independent from that point on. Pass a prompt and the copy starts working on it immediately; without one it waits in agent view for its first prompt. Except when the copy [edits in place](</docs/en/agent-view#how-file-edits-are-isolated>), Claude Code instructs it to create a worktree of its own before making code changes; the isolation instruction requires Claude Code v2.1.221 or later. To hand a side task to a subagent whose result comes back into this conversation, use `/subtask`; to switch into a copy yourself, use `/branch`. Requires Claude Code v2.1.212 or later; on v2.1.161 through v2.1.211, and whenever [agent view is turned off](</docs/en/agent-view#turn-off-agent-view>), `/fork` starts a [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>) instead `/goal [condition|clear]`| Set a [goal](</docs/en/goal>): Claude keeps working across turns until the condition is met. With no argument, shows the current or most recently achieved goal. `clear`, `stop`, `off`, `reset`, `none`, or `cancel` removes an active goal early `/heapdump`| Write a JavaScript heap snapshot and a memory breakdown to `~/Desktop`, or your home directory on Linux without a Desktop folder, for diagnosing high memory usage. Attach only the `-diagnostics.json` file when reporting a memory issue; the `.heapsnapshot` contains your full conversation and credentials, so don’t share it. Doesn’t appear in the command menu; type it in full. See [what to do with the output](</docs/en/troubleshooting#high-cpu-or-memory-usage>) `/help`| Show help and available commands @@ -94,7 +94,7 @@ `/reload-skills`| Re-scan [skill](</docs/en/skills>) and command directories so skills added or changed on disk during the session become available without restarting. Reports how many skills are available and how many were added or removed. Added in v2.1.152 `/remote-control`| Make this session available for [Remote Control](</docs/en/remote-control>) from claude.ai. Running it while signed out prints that Remote Control requires a claude.ai subscription and tells you how to sign in; before v2.1.206 it reported `Unknown command: /remote-control`. Alias: `/rc` `/remote-env`| Choose the default environment for [cloud agents](</docs/en/cloud-environments#select-an-environment-from-the-cli>) -`/rename [name]`| Rename the current session and show the name on the prompt bar. Without a name, auto-generates one from conversation history. Also available in non-interactive mode (`-p`); requires Claude Code v2.1.205 or later +`/rename [name]`| Rename the current session and show the name on the prompt bar. Without a name, auto-generates one from conversation history. Also available in non-interactive mode (`-p`); requires Claude Code v2.1.205 or later. From every rename surface, including claude.ai and the desktop app, Claude Code replaces control and invisible characters in the new name with spaces and caps the name at 200 characters. If the name is empty once invisible characters are removed, Claude Code rejects it and shows `That name is empty once invisible characters are removed. Usage: /rename <name>`. The character replacement and length cap require Claude Code v2.1.221 or later `/resume [session]`| Resume a conversation by ID or name, or open the session picker. As of v2.1.144, [background sessions](</docs/en/agent-view>) appear in the picker marked with `bg`; one that is still running can’t be resumed here, so attach to it from `claude agents` or stop it there first. Alias: `/continue` `/review [PR]`| Run a fast single-pass, read-only review of a GitHub pull request by number. With no argument, lists open PRs to pick from; text after the PR number becomes additional review instructions. From v2.1.186 through v2.1.201, `/review` instead ran the same multi-agent engine as `/code-review medium`. For a multi-agent review at a chosen effort level, use [`/code-review <level> <pr#>`](</docs/en/code-review#review-a-diff-locally>); for a cloud-based review, see [`/code-review ultra`](</docs/en/ultrareview>) `/rewind`| Rewind the conversation and/or code to a previous point, or summarize from a selected message. See [checkpointing](</docs/en/checkpointing>). Aliases: `/checkpoint`, `/undo` @@ -109,7 +109,7 @@ `/simplify [target]`| **[Skill](</docs/en/skills#bundled-skills>).** Review the changed code for cleanup opportunities and apply the fixes. Four review [agents](</docs/en/sub-agents>) run in parallel, covering reuse of existing helpers, simplification, efficiency, and whether the change is at the right level of abstraction. From v2.1.154, the review doesn’t look for correctness bugs. Use `/code-review` to find bugs. On earlier versions, `/simplify` is equivalent to `/code-review --fix`. Pass a path or PR reference to review a specific target `/skills`| List available [skills](</docs/en/skills>). As of v2.1.121, type to filter the list by name. Press `t` to sort by token count. Press `Space` to [cycle a skill’s visibility to Claude and the `/` menu](</docs/en/skills#override-skill-visibility-from-settings>), then `Enter` to save `/stats`| Alias for `/usage`. Opens on the Stats tab -`/status`| Open the Settings interface on the Status tab, showing version, model, account, and connectivity. Works while Claude is responding +`/status`| Open the Settings interface on the Status tab, showing version, model, account, and connectivity. A `Session kind` row reads `background job · attached` or `background job · unattended` in a [background session](</docs/en/agent-view>), depending on whether a terminal is attached, and `interactive` in any other session. Before v2.1.221, `/status` didn’t show this row. Works while Claude is responding `/statusline`| Configure Claude Code’s [status line](</docs/en/statusline>). Describe what you want, or run without arguments to auto-configure from your shell prompt `/stickers`| Order Claude Code stickers `/stop`| Stop the current [background session](</docs/en/agent-view>). Only available while attached to a background session; the transcript and any worktree are kept. To detach without stopping, use `/exit` or press `←`
modified Manage costs effectively View current →
--- a/costs.md +++ b/costs.md @@ -23,7 +23,28 @@ Usage by model: claude-sonnet-4-6: 1.2k input, 5.3k output, 940.0k cache read, 50.0k cache write ($0.55) -These totals reset when `/clear` starts a new session, so the next session’s total cost starts at $0. Before v2.1.211, they kept accumulating across `/clear` for the lifetime of the Claude Code process. On a Pro, Max, Team, or Enterprise plan, `/usage` also shows a breakdown of what counts against your plan limits. It attributes recent usage to skills, subagents, plugins, and individual MCP servers, with each shown as a percentage of the total. It also flags behaviors such as long context or cache misses when one accounts for 10% or more of recent usage. 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. 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. In the [VS Code extension](</docs/en/vs-code#check-account-and-usage>), the same breakdown appears in the Account & usage dialog with a Day and Week toggle. Requires Claude Code v2.1.174 or later. +These totals reset when `/clear` starts a new session, so the next session’s total cost starts at $0. Before v2.1.211, they kept accumulating across `/clear` for the lifetime of the Claude Code process. + +#### + +​ + +Plan usage breakdown + +On a Pro, Max, Team, or Enterprise plan, `/usage` also shows a breakdown of what counts against your plan limits: + + * **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. + +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 same breakdown appears in the Account & usage dialog with a Day and Week toggle. Requires Claude Code v2.1.174 or later. + +#### + +​ + +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. ### @@ -39,7 +60,7 @@ Team or Enterprise member with billing access| Opens your organization’s usage settings in the browser Team or Enterprise member without billing access| Asks you to confirm, then sends a request to your organization’s admins. Before v2.1.211, Claude Code sent the request without a confirmation step -For Team and Enterprise members without billing access, the confirmation appears only in interactive sessions: in non-interactive mode with the `-p` flag and from [Remote Control](</docs/en/remote-control>), the command sends no request and tells you to run it in an interactive session instead. On Pro and Max plans, when you reach your spend limit with usage credits still available, Claude Code prompts you to raise or remove the limit without leaving the CLI. If the server rejects the change, see [Could not update your spend limit](</docs/en/errors#could-not-update-your-spend-limit>). +For Team and Enterprise members without billing access, the confirmation appears only in interactive sessions: in non-interactive mode with the `-p` flag and from [Remote Control](</docs/en/remote-control>), the command sends no request and tells you to run it in an interactive session instead. If you run `/usage-credits` again while your earlier request is waiting on an admin, Claude Code tells you a request has already been sent rather than sending a duplicate. After an admin dismisses your request, running the command again sends a new one. Before v2.1.222, a dismissed request also blocked new requests. On Pro and Max plans, when you reach your spend limit with usage credits still available, Claude Code prompts you to raise or remove the limit without leaving the CLI. If the server rejects the change, see [Could not update your spend limit](</docs/en/errors#could-not-update-your-spend-limit>). ##
modified Debug your configuration View current →
--- a/debug-your-config.md +++ b/debug-your-config.md @@ -29,7 +29,7 @@ Check resolved settings -Settings merge across managed, user, project, and local scopes. Managed settings always win when present. Among the rest, the closer scope overrides the broader one in the order local, then project, then user. Some settings can also be set by command-line flags or [environment variables](</docs/en/env-vars>), which act as another override layer. When a setting doesn’t seem to apply, the value you set is usually being overridden by another scope or an environment variable. Run `/doctor` to check your configuration and installation. It reports what it finds, including invalid settings files, duplicate installations, unused extensions, and checked-in `CLAUDE.md` content Claude can derive from the codebase, then proposes fixes it applies only after you confirm. The `CLAUDE.md` trim check requires Claude Code v2.1.206 or later. Before v2.1.205, `/doctor` opened a read-only diagnostics screen and pressing `f` sent the report to Claude to fix. From the terminal, `claude doctor` prints read-only installation and settings diagnostics without starting a session. Run `/status` to see which settings sources are active, including whether managed settings are in effect. To understand which scope wins for a given key, see [How scopes interact](</docs/en/settings#how-scopes-interact>). +Settings merge across managed, user, project, and local scopes. Managed settings apply first when present, apart from the exceptions under [Settings precedence](</docs/en/settings#settings-precedence>). Among the rest, the closer scope overrides the broader one in the order local, then project, then user. Some settings can also be set by command-line flags or [environment variables](</docs/en/env-vars>), which act as another override layer. When a setting doesn’t seem to apply, the value you set is usually being overridden by another scope or an environment variable. Run `/doctor` to check your configuration and installation. It reports what it finds, including invalid settings files, duplicate installations, unused extensions, and checked-in `CLAUDE.md` content Claude can derive from the codebase, then proposes fixes it applies only after you confirm. The `CLAUDE.md` trim check requires Claude Code v2.1.206 or later. Before v2.1.205, `/doctor` opened a read-only diagnostics screen and pressing `f` sent the report to Claude to fix. From the terminal, `claude doctor` prints read-only installation and settings diagnostics without starting a session. Run `/status` to see which settings sources are active, including whether managed settings are in effect. To understand which scope wins for a given key, see [How scopes interact](</docs/en/settings#how-scopes-interact>). ## @@ -102,7 +102,7 @@ MCP servers added under `mcpServers` in `settings.json` never appear| `settings.json` does not read an `mcpServers` key| Define project servers in `.mcp.json` at the repository root, or run `claude mcp add --scope user` for user-scoped servers. See [MCP configuration](</docs/en/mcp>). Project MCP server added but doesn’t appear| The one-time approval prompt was dismissed| Project-scoped servers require approval. Run `/mcp` to see status and approve. MCP server fails to start from some directories| `command` or `args` uses a relative file path| Use absolute paths for local scripts. Executables on your `PATH` like `npx` or `uvx` work as-is. -MCP server starts without expected environment variables| Variables are in `settings.json` `env`, which doesn’t propagate to MCP child processes| Set per-server `env` inside `.mcp.json` instead. +MCP server starts without expected environment variables| The server’s config entry doesn’t set them, and they aren’t in the environment Claude Code passes to stdio servers: its own environment, minus the [variables it strips from subprocesses](</docs/en/monitoring-usage#administrator-configuration>)| Set per-server `env` inside the server’s `.mcp.json` entry, which doesn’t depend on the launch environment or workspace trust. `Bash(rm *)` deny rule doesn’t block `/bin/rm` or `find -delete`| Prefix rules match the literal command string, not the underlying executable| Add explicit patterns for each variant, or use a [PreToolUse hook](</docs/en/hooks-guide>) or the [sandbox](</docs/en/sandboxing>) for a hard guarantee. ##
modified Desktop application View current →
--- a/desktop.md +++ b/desktop.md @@ -368,7 +368,7 @@ Session isolation requires [Git](<https://git-scm.com/downloads>). Most Macs include Git by default. Run `git --version` in Terminal to check; if it prints a version number, Git is installed. On Windows, Git is required for the Code tab to work: [download Git for Windows](<https://git-scm.com/downloads/win>), install it, and restart the app. If you run into Git errors, ask Claude in the [Cowork tab](<https://claude.com/product/cowork>) to help troubleshoot your setup. -Use the controls at the top of the sidebar to filter sessions by status, project, or environment, and to group sessions by project. To rename a session, click the session title in the toolbar at the top of the active session. Claude Code applies the rename to the session’s underlying CLI name too, so the new name appears when you list sessions from a terminal with `claude agents`; the shared rename requires Claude Code v2.1.221 or later. To check context usage, see Check usage. When context fills up, Claude automatically summarizes the conversation and continues working. You can also type `/compact` to trigger summarization earlier and free up context space. See [the context window](</docs/en/how-claude-code-works#the-context-window>) for details on how compaction works. The desktop app sends an OS notification when a Code session finishes a task and you aren’t currently viewing that session. +Use the controls at the top of the sidebar to filter sessions by status, project, or environment, and to group sessions by project. To rename a session, click the session title in the toolbar at the top of the active session. For a session on a local environment, Claude Code applies the rename to the session’s underlying CLI name too, so the new name appears in the `claude agents` listing on that machine; the shared rename requires Claude Code v2.1.221 or later. To check context usage, see Check usage. When context fills up, Claude automatically summarizes the conversation and continues working. You can also type `/compact` to trigger summarization earlier and free up context space. See [the context window](</docs/en/how-claude-code-works#the-context-window>) for details on how compaction works. The desktop app sends an OS notification when a Code session finishes a task and you aren’t currently viewing that session. ###
modified Development containers View current →
--- a/devcontainer.md +++ b/devcontainer.md @@ -79,7 +79,7 @@ Enforce organization policy -A dev container is a convenient place to apply organization policy, because the same image and configuration run on every engineer’s machine. Claude Code reads `/etc/claude-code/managed-settings.json` on Linux and applies it at the highest precedence in the [settings hierarchy](</docs/en/settings#how-scopes-interact>), so values there override anything an engineer sets in `~/.claude` or the project’s `.claude/` directory. Copy the file into place from your Dockerfile: +A dev container is a convenient place to apply organization policy, because the same image and configuration run on every engineer’s machine. Claude Code reads `/etc/claude-code/managed-settings.json` on Linux and applies it at the highest precedence in the [settings hierarchy](</docs/en/settings#how-scopes-interact>), so values there override anything an engineer sets in `~/.claude` or the project’s `.claude/` directory, apart from the exceptions under [Settings precedence](</docs/en/settings#settings-precedence>). Copy the file into place from your Dockerfile: Dockerfile
modified Environment variables View current →
--- a/env-vars.md +++ b/env-vars.md @@ -153,7 +153,7 @@ `ANTHROPIC_VERTEX_BASE_URL`| Override Google Cloud’s Agent Platform endpoint URL. Use for custom Google Cloud’s Agent Platform endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) `ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID for Google Cloud’s Agent Platform requests. Overridden by `GCLOUD_PROJECT`, `GOOGLE_CLOUD_PROJECT`, or the project in your `GOOGLE_APPLICATION_CREDENTIALS` credential file. See [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) `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 idle timeout that aborts a streaming model response when no bytes arrive. Set to `0` to disable the timeout, for example when a slow [gateway](</docs/en/llm-gateway>) or local model pauses longer than 5 minutes between chunks. Set to `1` to keep the timeout on every provider. When unset, the timeout is inactive on direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) connections, where Claude Code’s own byte-level stream watchdog runs, and active on every other provider, including [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), [Mantle](</docs/en/amazon-bedrock#use-the-mantle-endpoint>), [Amazon Bedrock](</docs/en/amazon-bedrock>), and gateway connections, so a stalled stream aborts instead of hanging. As of v2.1.169 +`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 and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>). 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. Requires Claude Code v2.1.169 or later `API_TIMEOUT_MS`| Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). Increase this when requests time out on slow networks or when routing through a proxy. Values above the maximum overflow the underlying timer and cause requests to fail immediately `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 long-running bash commands (default: 120000, or 2 minutes) @@ -170,6 +170,7 @@ `CLAUDE_AUTO_BACKGROUND_TASKS`| Set to `1` to force-enable automatic backgrounding of long-running agent tasks. When enabled, subagents are moved to the background after running for approximately two minutes. Also enables [automatic backgrounding of long MCP tool calls](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) in non-interactive mode on Claude Code v2.1.212 or later `CLAUDE_AX_SCREEN_READER`| Set to `1` to render screen-reader friendly output: flat text without decorative borders or animations. Set to `0` to force screen-reader mode off even when [`axScreenReader`](</docs/en/settings#available-settings>) is `true`. The [`--ax-screen-reader`](</docs/en/cli-reference#cli-flags>) flag takes precedence. Requires Claude Code v2.1.181 or later `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`| Return to the original working directory after each Bash or PowerShell command in the main session +`CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds for the byte-level streaming idle watchdog only; when set, it takes precedence over `CLAUDE_STREAM_IDLE_TIMEOUT_MS` for that watchdog and leaves the event-level watchdog unchanged. Claude Code clamps this variable to between 10 seconds and 30 minutes. Requires Claude Code v2.1.210 or later `CLAUDE_CLIENT_PRESENCE_FILE`| Path to a file that an external tool, such as a screen-lock listener, creates when you unlock your screen and deletes when you lock it. While the file exists, Claude Code skips [Remote Control mobile push notifications](</docs/en/remote-control#mobile-push-notifications>), so you stop getting pushes while you are actively using the computer. When the file is absent or unreadable, notifications are sent as normal. Claude Code checks the file once per push-triggering event rather than polling it. Requires Claude Code v2.1.181 or later `CLAUDE_CODE_ACCESSIBILITY`| Set to `1` to keep the native terminal cursor visible and disable the inverted-text cursor indicator. Allows screen magnifiers like macOS Zoom to track cursor position `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD`| Set to `1` to load memory files from directories specified with `--add-dir`. Loads `CLAUDE.md`, `.claude/CLAUDE.md`, `.claude/rules/*.md`, and `CLAUDE.local.md`. By default, additional directories do not load memory files @@ -287,7 +288,7 @@ `CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS`| Maximum time in milliseconds that [non-interactive mode](</docs/en/headless#background-tasks-at-exit>) with the `-p` flag waits after the final turn for background subagents and workflows whose result is part of the output. Default: `600000`, or 10 minutes. When the cap is exceeded, remaining background tasks are terminated and the process exits. Set to `0` to wait indefinitely. This cap is separate from the five-second grace period that applies to plain background shells `CLAUDE_CODE_PROCESS_WRAPPER`| Launch the processes Claude Code starts from its own binary, such as the background service that hosts [agent view](</docs/en/agent-view>) sessions, through a corporate launcher given as an argv prefix like `/opt/corp/launcher`. Set it in the `env` block of user or [managed settings](</docs/en/permissions#managed-settings>), not as a shell export, so the detached background service inherits it; project and local settings can’t set it. Equivalent to the [`processWrapper` setting](</docs/en/settings#available-settings>), which requires Claude Code v2.1.210 or later; this variable takes precedence when both are set. The VS Code extension configures its own launcher separately through its `claudeProcessWrapper` setting. Ignored on Windows. See [Run Claude Code behind a corporate launcher](</docs/en/corporate-launcher>) for the value format, what the launcher covers, and the contract the launcher must satisfy. Requires Claude Code v2.1.208 or later `CLAUDE_CODE_PROPAGATE_TRACEPARENT`| Set to `1` to propagate W3C trace context when `ANTHROPIC_BASE_URL` points at a custom proxy. Propagation covers the `traceparent` header on model and HTTP MCP requests and the `TRACEPARENT` environment variable for Bash, PowerShell, and hook subprocesses. By default, propagation is enabled only when connected directly to the Anthropic API. Added in v2.1.152. See [Traces (beta)](</docs/en/monitoring-usage#traces-beta>) -`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files are ignored so user settings cannot override the host’s routing. The automatic telemetry opt-out for Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry is also skipped, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) +`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, Claude Code ignores provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files, so user settings can’t override the host’s routing. Claude Code also ignores model-selection keys such as `model`, `fallbackModel`, and `modelOverrides` in [managed settings](</docs/en/permissions#managed-settings>), whichever managed source delivers them, so the host’s model configuration takes precedence over an out-of-date managed model pin; an [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist in managed settings still applies unless the host supplies its own. Claude Code also skips the automatic telemetry opt-out for Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) `CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution `CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud session `CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link output back to the session](</docs/en/cloud-environments#link-output-back-to-the-session>) @@ -336,13 +337,13 @@ `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, session history, and plugins are stored under this path, as are credentials on Linux and Windows; on macOS, credentials are in the system Keychain. Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'` `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 active [effort level](</docs/en/model-config#adjust-effort-level>) for the turn: `low`, `medium`, `high`, `xhigh`, or `max`. Ultracode is not a distinct level and reports as `xhigh`. 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. When unset, the watchdog is enabled by default for direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) connections. The byte watchdog aborts a connection when no bytes arrive on the wire for 180 seconds by default on direct Anthropic API connections, 300 seconds on Claude Platform on AWS and when enabled on Amazon Bedrock, or for the value of `CLAUDE_STREAM_IDLE_TIMEOUT_MS` when that is set, which is clamped to a minimum of 5 minutes, independent of the event-level watchdog +`CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. 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. Off by default. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` -`CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `0` to force-disable the event-level streaming idle watchdog, or set to `1` to force-enable it. When unset, the watchdog is on by default for all providers. Before v2.1.196, the unset default was server-controlled on the direct Anthropic API and off on other providers. As of v2.1.169, providers other than the direct Anthropic API and Claude Platform on AWS also have a default-on 5-minute body idle timeout independent of this variable; see `API_FORCE_IDLE_TIMEOUT`. On Amazon Bedrock, you can also enable the independent byte-level watchdog with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`; the two run together when both are set. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` +`CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `0` to force-disable the event-level streaming idle watchdog, or set to `1` to force-enable it. When unset, the watchdog is on by default for all providers. Before v2.1.196, the unset default was server-controlled on the direct Anthropic API and off on other providers. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS`; for the other stall timers that run alongside this one, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) `CLAUDE_ENV_FILE`| Path to a shell script whose contents Claude Code runs before each Bash command in the same shell process, so exports in the file are visible to the command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [Setup](</docs/en/hooks#setup>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks `CLAUDE_PID`| Claude Code sets this to its own process ID in the subprocesses it spawns: Bash and PowerShell tool commands and hook commands. On Linux, the Bash tool’s shell integration uses it to refuse a `pkill` pattern that would match the Claude Code process itself; see [the error reference](</docs/en/errors#pkill-pattern-matches-the-claude-code-process>). Read it from your own scripts to identify or signal the parent Claude Code process deliberately. Requires Claude Code v2.1.214 or later `CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is provided. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. The `--remote-control-session-name-prefix` CLI flag sets the same value for a single invocation -`CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. When you set this variable explicitly, the minimum is `300000` (5 minutes); lower values are silently clamped to absorb extended thinking pauses and proxy buffering. When unset, the event-level watchdog defaults to 300 seconds and the byte-level watchdog defaults to 180 seconds on direct Anthropic API connections (300 seconds on Claude Platform on AWS and other providers). The unset 180-second byte-watchdog default is a separate value and is not subject to the 5-minute clamp. The body idle timeout described under `API_FORCE_IDLE_TIMEOUT` applies independently. On Amazon Bedrock, also applies when `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1` +`CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the event- and byte-level streaming idle watchdogs close a stalled connection. When you set this variable explicitly, the minimum is `300000` (5 minutes); lower values are silently clamped to absorb extended thinking pauses and proxy buffering, and the byte-level watchdog caps the value at 30 minutes. `CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS` takes precedence over this variable for the byte-level watchdog. For the per-watchdog unset defaults, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) `DEBUG`| Set to `1` to enable debug mode, equivalent to launching with [`--debug`](</docs/en/cli-reference#cli-flags>). Debug logs are written to `~/.claude/debug/<session-id>.txt`, or to the path set by `CLAUDE_CODE_DEBUG_LOGS_DIR`. Only the truthy values `1`, `true`, `yes`, and `on` enable debug mode, so namespace patterns like `DEBUG=express:*` set for other tools do not trigger it `DISABLE_AUTOUPDATER`| Set to `1` to disable automatic background updates. Manual `claude update` still works. Use `DISABLE_UPDATES` to block both `DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs. Overrides the [`autoCompactEnabled`](</docs/en/settings#available-settings>) setting @@ -382,8 +383,9 @@ `MAX_STRUCTURED_OUTPUT_RETRIES`| Number of times to retry when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode (the `-p` flag). Defaults to 5 `MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024; see `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on Fable 5, which cannot have thinking turned off; on [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. Nonzero values are ignored on adaptive reasoning models unless `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` is set `MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret` -`MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. As of Claude Code v2.1.142, MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish. Set to `0` to restore the blocking 5-second connection wait. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still block startup regardless, since their tools must be present when the first prompt is built -`MCP_CONNECT_TIMEOUT_MS`| How long blocking MCP startup waits, in milliseconds, for the connection batch before snapshotting the tool list (default: 5000). Applies when `MCP_CONNECTION_NONBLOCKING=0` or for servers marked [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>). Servers still pending at the deadline keep connecting in the background but won’t appear until the next query. Distinct from `MCP_TIMEOUT`, which bounds an individual server’s connect attempt +`MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish; before v2.1.142, the blocking wait was the default. Set to `0` to restore the blocking 5-second connection wait. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still make startup wait regardless, except when served from the [discovery cache](</docs/en/mcp#managing-your-servers>), since their tools must be present when the first prompt is built. In non-interactive mode (`-p`), Claude Code also waits for still-pending servers before the first turn regardless of this variable, with a longer deadline when you pass [`--mcp-config`](</docs/en/cli-reference#cli-flags>) explicitly; see that flag’s entry for the cached-server exception +`MCP_CONNECT_TIMEOUT_MS`| How long blocking MCP startup waits, in milliseconds, for the connection batch before snapshotting the tool list (default: 5000). Applies when `MCP_CONNECTION_NONBLOCKING=0` or for servers marked [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>). Servers still pending at the deadline keep connecting in the background. Distinct from `MCP_TIMEOUT`, which bounds an individual server’s connect attempt +`MCP_DISCOVERY_CACHE`| Set to `0` to turn off the cross-process MCP discovery cache, so every server connects at startup instead of showing the [`connects on first use` cached status](</docs/en/mcp#managing-your-servers>) and connecting on its first tool call. The cached status requires Claude Code v2.1.221 or later `MCP_OAUTH_CALLBACK_PORT`| Fixed port for the OAuth redirect callback, as an alternative to `--callback-port` when adding an MCP server with [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>) `MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of remote MCP servers (HTTP/SSE) to connect in parallel during startup (default: 20) `MCP_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of local MCP servers (stdio) to connect in parallel during startup (default: 3)
modified Error reference View current →
Show diff (222 lines)
--- a/errors.md +++ b/errors.md @@ -41,10 +41,12 @@ `Login expired · Please run /login`| Authentication `Failed to authenticate: OAuth session expired and could not be refreshed`| Authentication `does not meet scope requirement user:profile`| Authentication +`claude.ai rejected the session token` / `session token rejected`| Authentication `AWS credentials expired or invalid`| Authentication `AWS authentication failed`| Authentication `AWS default-chain credential resolve timed out`| Authentication `Unable to connect to API`| Network +`Unable to connect to Anthropic services` during setup| Network `Socket is closed`| Network `Waiting for API response · will retry in`| Automatic retries, or Network if it persists `Bedrock streaming response has content-type "..."; expected "application/vnd.amazon.eventstream"`| Network @@ -83,6 +85,8 @@ `Shell command failed for pattern "!`git ... origin/HEAD...`"`| Command-line errors `Input must be provided either through stdin or as a prompt argument when using --print`| Command-line errors `Diff is too large for ultrareview` / `PR #<N> is too large for ultrareview`| Command-line errors +`Could not find merge-base with <branch>`| Command-line errors +`Your checkout has no branches (detached HEAD only)`| Command-line errors `Failed to resume the conversation`| Command-line errors `Marketplace "<name>" is registered from an untrusted source`| Plugin errors `references ${user_config.*} in a shell-form command`| Plugin errors @@ -113,13 +117,15 @@ Claude Code retries transient failures up to 10 times with exponential backoff before showing you an error. It doesn’t always retry a failure that arrives partway through Claude’s response. When you see one of the errors on this page, Claude Code has already exhausted those retries, unless the failure is one it doesn’t retry. Claude Code retries these failures: * Server errors, overloaded responses, and request timeouts. - * Dropped connections. This covers a connection that drops in the middle of a request, before any part of Claude’s response has completed: Claude Code re-issues the request with the same backoff, and the turn continues. Before v2.1.198, Claude Code stopped the turn with a connection error when the connection dropped mid-response, before any visible output had streamed. + * Dropped connections. This covers a connection that drops in the middle of a request, before Claude has started a block of text or a tool call in its response: Claude Code re-issues the request with the same backoff, and the turn continues. Before v2.1.198, Claude Code stopped the turn with a connection error when the connection dropped mid-response, before any visible output had streamed. + * A stalled response stream while the response is still in progress, before Claude has started a block of text or a tool call: Claude Code aborts the stalled connection and re-issues the request at most once, outside the 10-attempt budget above. * Temporary 429 throttles. When you’re signed in with a claude.ai subscription, this includes 429 throttles that don’t carry your plan’s quota headers. Before v2.1.199, Claude Code retried those throttles only for API key and Enterprise sign-ins. Claude Code doesn’t retry these failures: * A TLS certificate validation failure, such as a TLS-inspecting proxy, a missing `NODE_EXTRA_CA_CERTS` bundle, or an expired certificate. Claude Code reports the error on the first attempt, so you can fix the certificate setup right away; see SSL certificate errors. Claude Code still retries transient TLS conditions such as a handshake timeout. Before v2.1.199, Claude Code retried certificate failures through the full retry budget before showing the error. - * A server error, dropped connection, or stalled stream that arrives after Claude has completed a block of text or a tool call in its response. Claude Code could execute the same tool calls twice if it re-ran the request, so it keeps what Claude completed and shows an incomplete-response notice. Claude Code still runs any tool calls Claude completed and continues the turn from their results. Before v2.1.199, Claude Code discarded the partial output and reported the whole turn as an error when a server error arrived mid-stream. + * A server error, dropped connection, or stalled stream that arrives after Claude has started a block of text or a tool call in its response, but before it finishes the response. Claude Code could execute the same tool calls twice if it re-ran the request, so it keeps what Claude completed and shows an incomplete-response notice. Claude Code still runs any tool calls Claude completed and continues the turn from their results. Before v2.1.199, Claude Code discarded the partial output and reported the whole turn as an error when a server error arrived mid-stream. + * A failure that arrives after Claude has finished the response: nothing needs retrying, so Claude Code keeps the complete response and ends the turn normally. * An Amazon Bedrock streaming response with an unexpected content-type, because the gateway or proxy rewriting the response would rewrite the retry the same way. Requires Claude Code v2.1.208 or later. ### @@ -128,7 +134,7 @@ What you see while Claude Code retries or waits -While retrying, the spinner shows a `Retrying in Ns · attempt x/y` countdown after an error label. The label names the specific reason from the first attempt for failures you can act on right away: the network is down, a TLS handshake failed, or you hit a rate limit. For other errors it reads `API error` at first. As of v2.1.198 it switches to the specific reason from the third attempt, or on the final attempt when `CLAUDE_CODE_MAX_RETRIES` allows fewer than three; earlier versions switch only on the final attempt. As of v2.1.198, the usual spinner tip is suppressed during retries. Once the error reason is revealed, if the failure is a 529 overload the line below the countdown also names where to check service status: `status.claude.com` on the Anthropic API, or the provider or gateway host named in the message on other configurations. If no data arrives on the response stream for 20 seconds while a request is still pending, the spinner shows `Waiting for API response · will retry in … · check your network` before any retry has started. The request has not failed yet: the countdown runs to the point where Claude Code aborts the stalled connection, after which it retries the request, ends the turn with an error such as The response above may be incomplete, or shows that notice and continues the turn from the results of any tool calls Claude completed. The banner clears on its own once data resumes or a retry succeeds; if it reappears on every attempt, treat it as a network issue. As of v2.1.185 the threshold is 20 seconds; earlier versions show the banner after 10 seconds with different wording. While Claude is consulting the [advisor](</docs/en/advisor>), the banner appears after 90 seconds without data instead of 20, because a long advisor review can send nothing for well over 20 seconds. Before v2.1.214, the 20-second threshold applied during advisor calls too, so the banner appeared during advisor reviews even when nothing was wrong. +While retrying, the spinner shows a `Retrying in Ns · attempt x/y` countdown after an error label. The label names the specific reason from the first attempt for failures you can act on right away: the network is down, a TLS handshake failed, or you hit a rate limit. For other errors it reads `API error` at first. As of v2.1.198 it switches to the specific reason from the third attempt, or on the final attempt when `CLAUDE_CODE_MAX_RETRIES` allows fewer than three; earlier versions switch only on the final attempt. As of v2.1.198, the usual spinner tip is suppressed during retries. Once the error reason is revealed, if the failure is a 529 overload the line below the countdown also names where to check service status: `status.claude.com` on the Anthropic API, or the provider or gateway host named in the message on other configurations. If no data arrives on the response stream for 20 seconds while a request is still pending, the spinner shows `Waiting for API response · will retry in … · check your network` before any retry has started. The request hasn’t failed yet: the countdown runs to the point where Claude Code aborts the stalled connection. After the abort, Claude Code retries the request, ends the turn with an error when the failure isn’t retryable or retries run out, shows The response above may be incomplete and continues the turn from the results of any tool calls Claude completed, or ends the turn normally when Claude had already finished the response before the stall. The banner clears on its own once data resumes or a retry succeeds; if it reappears on every attempt, treat it as a network issue. Before v2.1.185, the banner appeared after 10 seconds with different wording. While Claude is consulting the [advisor](</docs/en/advisor>), the banner appears after 90 seconds without data instead of 20, because a long advisor review can send nothing for well over 20 seconds. Before v2.1.214, the 20-second threshold applied during advisor calls too, so the banner appeared during advisor reviews even when nothing was wrong. ### @@ -207,7 +213,7 @@ The response above may be incomplete -A streaming request failed after Claude had started producing a response. Re-sending the request could run the same tool calls twice, so Claude Code keeps the output Claude completed and appends this notice instead of discarding the turn. Which variant you see names the cause: +A streaming request failed after Claude had started a block of text or a tool call, while the response was still in progress. Re-sending the request could run the same tool calls twice, so Claude Code keeps the output Claude completed and appends this notice instead of discarding the turn. Which variant you see names the cause: API Error: Server error mid-response. The response above may be incomplete. API Error: Connection closed mid-response. The response above may be incomplete. @@ -215,9 +221,14 @@ * `Server error mid-response`: a mid-stream overloaded or 5xx server error. This variant requires Claude Code v2.1.199 or later; before then that case discarded the partial output and reported the whole turn as an error. * `Connection closed mid-response`: the connection dropped. - * `Response stalled mid-stream`: the stream stopped sending data. - -Claude Code never shows this notice for a failure that happens before Claude starts producing a response: at that point it either retries the failure or ends the turn with a different error. See Automatic retries. **What to do:** + * `Response stalled mid-stream`: the stream stopped sending data. Before v2.1.222, this variant could also appear on [gateway](</docs/en/gateways>) connections reached through `ANTHROPIC_BASE_URL` or `ANTHROPIC_AWS_BASE_URL` while the server’s keep-alive pings were still arriving, because Claude Code counted only parsed response events there; upgrading stops those spurious timeouts on those routes. Gateways reached through a provider base URL such as `ANTHROPIC_BEDROCK_BASE_URL` aren’t wrapped by the byte watchdog; see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>). + +Claude Code shows this notice only when the failure lands after Claude has started a block of text or a tool call and before the response finishes: + + * While the response is in progress, before Claude has started a block of text or a tool call, Claude Code either retries the failure or ends the turn with a different error. See Automatic retries. + * When one of these failures arrives after Claude has finished the response, Claude Code keeps the complete response and ends the turn normally, without this notice. Before v2.1.222, Claude Code showed the `Connection closed mid-response` or `Response stalled mid-stream` notice when the connection dropped or stalled after the response finished, and reported the turn as an error even though the response was complete. + +**What to do:** * In an interactive session, read the response that remains on screen: Claude Code keeps every block Claude completed before the error, but discards an interrupted final block when the turn ends, so the final sentences or tool calls may be missing. Reply with `continue` to have Claude pick up from its last completed block. * In [non-interactive mode](</docs/en/headless>) (`-p`): @@ -434,9 +445,9 @@ Could not resolve authentication method. Expected one of apiKey, authToken, credentials, config, or profile to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted -Before v2.1.174, a background or cloud session assigned to an idle pre-initialized worker could fail this way even when valid credentials were configured. Upgrade to recover. On current versions the error means no credential was available to the worker process. **What to do:** - - * Upgrade to v2.1.174 or later if this appears in a background or cloud session and your credentials are already configured +On current versions the error means no credential was available to the worker process. Before v2.1.174, a background session assigned to an idle pre-initialized worker could fail this way even when valid credentials were configured. Before v2.1.176, a cloud session that sat idle before being claimed could too. Upgrade to recover. **What to do:** + + * Upgrade to v2.1.176 or later if this appears in a background or cloud session and your credentials are already configured * Confirm `ANTHROPIC_API_KEY`, `CLAUDE_CODE_OAUTH_TOKEN`, or your cloud provider credentials are set in the environment that launches the worker, not only in your interactive shell * For the Agent SDK, see [authentication setup in the quickstart](</docs/en/agent-sdk/quickstart#setup>) * Run `/status` in an interactive session in the same environment to confirm which credential source resolves @@ -482,14 +493,16 @@ This organization has been disabled -A stale `ANTHROPIC_API_KEY` from a disabled Console organization is overriding your subscription login. - - Your ANTHROPIC_API_KEY belongs to a disabled organization · Unset the environment variable to use your other credentials +Claude Code is using a stale `ANTHROPIC_API_KEY` from a disabled Console organization. When you have a saved subscription login, the key overrides it. + + Your ANTHROPIC_API_KEY belongs to a disabled organization · Unset the environment variable to use your subscription instead + Your ANTHROPIC_API_KEY belongs to a disabled organization · Update or unset the environment variable API Error: 400 ... This organization has been disabled. -Environment variables take precedence over `/login`, so a key exported in your shell profile or loaded from a `.env` file is used even when you have a working Pro or Max subscription. In non-interactive mode (`-p`), the key is always used when present. **What to do:** +The hint after the `·` depends on your saved credentials: the first form appears when a stored `/login` can take over after you unset the key, and the second when the key is your only credential. Environment variables take precedence over `/login`, so a key exported in your shell profile or loaded from a `.env` file is used even when you have a working Pro or Max subscription. In non-interactive mode (`-p`), the key is always used when present. **What to do:** * Unset `ANTHROPIC_API_KEY` in the current shell and remove it from your shell profile, then relaunch `claude` + * If the message says `Update or unset`, you have no saved login to fall back to. Unset the key and run `/login`, or replace the key with one from an active Console organization. * Run `/status` afterward to confirm the active credential is your subscription * If no environment variable is set and the error persists, the disabled organization is the one tied to your `/login`. Contact support or sign in with a different account. @@ -629,6 +642,23 @@ **What to do:** * Run `/login` to get a new token with the current scopes. You don’t need to log out first. + +### + +​ + +claude.ai rejected the session token + +A [claude.ai connector](</docs/en/mcp#use-mcp-servers-from-claude-ai>) request failed because claude.ai rejected the token from your Claude Code login, usually a login that expired and couldn’t be refreshed. The rejected token is your login, not the connector’s own authorization in claude.ai, so authorizing the connector again doesn’t resolve it. In `/mcp`, the connector shows as `connected · session token rejected` and its detail view reads: + + claude.ai rejected the session token. Run /login, then reconnect. + +**What to do:** + + * Run `/login` to sign in again + * Reconnect the connector from `/mcp`, or run `/mcp reconnect <server>`. Reconnecting before you sign in again leaves the connector in the same state. The `/mcp` panel’s **Reconnect** option reports `your claude.ai session token was rejected`; the typed `/mcp reconnect <server>` form reports a successful reconnect even though the token is still rejected. + +Before v2.1.222, Claude Code marked the connector as needing authentication instead, which pointed you at the connector’s authorization flow even though completing it didn’t resolve the state. ### @@ -719,12 +749,32 @@ ​ +Unable to connect to Anthropic services + +During first-run setup, Claude Code checks that it can reach `api.anthropic.com` and `platform.claude.com` before showing the sign-in step. When either check fails, Claude Code prints the reason and exits. + + Unable to connect to Anthropic services + Failed to connect to api.anthropic.com: ECONNREFUSED + Connection to api.anthropic.com timed out after 10 seconds + A proxy is configured via HTTPS_PROXY. Check that it allows connections to the host above. + +Claude Code sends the check through the same [proxy configuration](</docs/en/network-config>) as API requests and gives each probe 10 seconds. When the failed probe went through a proxy, the message names the environment variable that configured it, such as `HTTPS_PROXY`. Before v2.1.222, the check used a different proxy transport with no timeout: behind a proxy URL with the `https://` scheme, it could stall on `Checking connectivity...` indefinitely and then fail even though API requests through the same proxy succeed. **What to do:** + + * If the message names a proxy variable, check that its value points at the right proxy and ask your network team to allow HTTPS connections through it to the host in the message. See [Network configuration](</docs/en/network-config>). + * Work through the checks in Unable to connect to API. The `curl` test and firewall guidance there apply to this check too. + * If your network is open and the failure persists, Claude Code may not be [available in your country](<https://www.anthropic.com/supported-countries>) + +### + +​ + Socket is closed -`Socket is closed` means the connection carrying a streaming response was closed while the response was still arriving. The most common cause is a corporate proxy on Windows dropping an established tunnel mid-response. Claude Code either retries the request or keeps the partial response: - - * If Claude hasn’t completed any text or tool call yet, Claude Code treats the failure as a dropped connection and retries the request automatically, so the turn continues. - * If Claude has completed a block of text or a tool call, Claude Code keeps what Claude completed and shows an incomplete-response notice. It still runs any tool calls Claude completed and continues the turn from their results. +`Socket is closed` means the connection carrying a streaming response was closed while the response was still arriving. The most common cause is a corporate proxy on Windows dropping an established tunnel mid-response. Claude Code either retries the request or keeps the response Claude produced: + + * If the response is still in progress and Claude hasn’t started any block of text or a tool call, Claude Code treats the failure as a dropped connection and retries the request automatically, so the turn continues. + * If Claude has started a block of text or a tool call but hasn’t finished the response, Claude Code keeps what Claude completed and shows an incomplete-response notice. It still runs any tool calls Claude completed and continues the turn from their results. + * If the socket closes after Claude has finished the response, Claude Code ends the turn normally with the complete response. Before v2.1.214, Claude Code didn’t retry this failure, and the turn stopped with an error containing `Socket is closed`. **What to do:** @@ -946,10 +996,9 @@ 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 - API Error: 400 ... Extra inputs are not permitted ... tools.0.custom.input_examples API Error: 400 ... Unexpected value(s) for the `anthropic-beta` header -Claude Code sends beta-only fields such as `context_management`, `effort`, and tool `input_examples` 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:** +Claude Code sends beta-only fields such as `context_management` and `effort` 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. * As a fallback, set [`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1`](</docs/en/env-vars>) before launching. This disables features that require the beta header so requests succeed through a gateway that cannot forward it. @@ -1000,7 +1049,7 @@ Your active subscription plan does not include the model you selected. - Claude Opus is not available with the Claude Pro plan · Select a different model in /model + Claude Opus is not available with the Claude Pro plan. If you have updated your subscription plan recently, run /logout and /login for the plan to take effect. **What to do:** @@ -1303,6 +1352,27 @@ * Pass a base branch closer to your work, such as `/code-review ultra develop`, so the review covers only the diff against that branch * Split the change into smaller branches and review each one. The files the message names contribute the most changed lines, so start by moving those to their own branch. + +### + +​ + +Could not find merge-base with the base branch + +`/code-review ultra` and the `claude ultrareview` subcommand review the diff between your branch and a base branch, which needs a commit the two share. When `git merge-base` finds none, Claude Code refuses the review before the cloud session starts. On a clone Claude Code can verify is complete, with at least one branch, it falls back to [reviewing every tracked file](</docs/en/ultrareview#diff-limits-and-fallbacks>) instead of refusing. You see this refusal when the base branch can’t be found at all, when Claude Code can’t verify that your clone is complete, or in the rare repository where the whole-tree diff isn’t possible, such as the SHA-256 object format. + + Could not find merge-base with main. Pass the base branch explicitly (e.g. `/code-review ultra develop`) or make sure you're in a git repo with a main branch. + +The hint after the first sentence depends on what Claude Code observed: + + * **You didn’t pass a base branch** : Claude Code compared against the repository’s default branch and suggests passing your base explicitly, as in the example above + * **You passed a base branch that was already in your clone** : the hint reads `Make sure <branch> exists locally or on origin (try `git fetch origin <branch>`)` + * **You passed a base branch that wasn’t in your clone** : Claude Code fetched it from origin before comparing. The hint reads `<branch> was fetched from origin but shares no history with HEAD. If another branch is your real base, pass it explicitly (`/code-review ultra <branch>`)`; when Claude Code can’t tell whether your clone is shallow, it suggests `git fetch --unshallow origin` instead. Before v2.1.221, the hint suggested `git fetch --unshallow origin` for every fetched base branch, and on a complete clone that command fails with `fatal: --unshallow on a complete repository does not make sense`. + +**What to do:** + + * If another branch is your real base, pass it explicitly: `/code-review ultra <branch>` + * If your clone might not have full history, run `git fetch --unshallow origin` and rerun the review ###
modified Feature availability View current →
--- a/feature-availability.md +++ b/feature-availability.md @@ -71,7 +71,8 @@ [Advisor](</docs/en/advisor>)| ✓| ✓| ✗| ✗| ✗| ✗ [Channels](</docs/en/channels>)| ✓| ✓| ✗| ✗| ✗| ✗ [`/loop` scheduled tasks](</docs/en/scheduled-tasks>)| ✓| ✓| See note 3| See note 3| See note 3| See note 3 -[GitHub Actions](</docs/en/github-actions>) and [GitLab CI/CD](</docs/en/gitlab-ci-cd>)| ✓| ✓| ✓| ✓| ✓| ✗ +[GitHub Actions](</docs/en/github-actions>)| ✓| ✓| ✓| ✗| ✓| ✓ +[GitLab CI/CD](</docs/en/gitlab-ci-cd>)| ✓| ✓| ✓| ✓| ✓| ✗ ### @@ -119,11 +120,11 @@ **Alternatives:** for scheduling, use [`/loop`](</docs/en/scheduled-tasks>) with an explicit interval instead of `/schedule`. For cloud sessions, use [GitHub Actions](</docs/en/github-actions>) or [GitLab CI/CD](</docs/en/gitlab-ci-cd>). For web lookups, use the [WebFetch tool](</docs/en/tools-reference#webfetch-tool-behavior>) with a specific URL. -**Not available:** all features that require a Claude subscription, plus [fast mode](</docs/en/fast-mode>), [Advisor](</docs/en/advisor>), [Channels](</docs/en/channels>), the [analytics dashboard](</docs/en/analytics>), [server-managed settings](</docs/en/server-managed-settings>), and the [`/design-sync` and `/radio` commands](</docs/en/commands#all-commands>).**Available where Amazon Bedrock is not:** [web search](</docs/en/tools-reference#websearch-tool-behavior>).**Partial support:** +**Not available:** all features that require a Claude subscription, plus [fast mode](</docs/en/fast-mode>), [Advisor](</docs/en/advisor>), [Channels](</docs/en/channels>), [GitHub Actions](</docs/en/github-actions>), the [analytics dashboard](</docs/en/analytics>), [server-managed settings](</docs/en/server-managed-settings>), and the [`/design-sync` and `/radio` commands](</docs/en/commands#all-commands>).**Available where Amazon Bedrock is not:** [web search](</docs/en/tools-reference#websearch-tool-behavior>).**Partial support:** * [`/loop`](</docs/en/scheduled-tasks>): explicit intervals only -**Alternatives:** for scheduling, use [`/loop`](</docs/en/scheduled-tasks>) with an explicit interval instead of `/schedule`. For cloud sessions, use [GitHub Actions](</docs/en/github-actions>) or [GitLab CI/CD](</docs/en/gitlab-ci-cd>). +**Alternatives:** for scheduling, use [`/loop`](</docs/en/scheduled-tasks>) with an explicit interval instead of `/schedule`. For cloud sessions, use [GitLab CI/CD](</docs/en/gitlab-ci-cd>). **Not available:** all features that require a Claude subscription, plus [fast mode](</docs/en/fast-mode>), [Advisor](</docs/en/advisor>), [Channels](</docs/en/channels>), the [analytics dashboard](</docs/en/analytics>), [server-managed settings](</docs/en/server-managed-settings>), and the [`/design-sync` and `/radio` commands](</docs/en/commands#all-commands>).**Partial support:** @@ -135,7 +136,7 @@ **Alternatives:** for scheduling, use [`/loop`](</docs/en/scheduled-tasks>) with an explicit interval instead of `/schedule`. For cloud sessions, use [GitHub Actions](</docs/en/github-actions>) or [GitLab CI/CD](</docs/en/gitlab-ci-cd>). -**Not available:** all features that require a Claude subscription, plus [fast mode](</docs/en/fast-mode>), [Advisor](</docs/en/advisor>), [Channels](</docs/en/channels>), [GitHub Actions](</docs/en/github-actions>) and [GitLab CI/CD](</docs/en/gitlab-ci-cd>), the [analytics dashboard](</docs/en/analytics>), [server-managed settings](</docs/en/server-managed-settings>), and the [`/design-sync` and `/radio` commands](</docs/en/commands#all-commands>).**Partial support:** +**Not available:** all features that require a Claude subscription, plus [fast mode](</docs/en/fast-mode>), [Advisor](</docs/en/advisor>), [Channels](</docs/en/channels>), [GitLab CI/CD](</docs/en/gitlab-ci-cd>), the [analytics dashboard](</docs/en/analytics>), [server-managed settings](</docs/en/server-managed-settings>), and the [`/design-sync` and `/radio` commands](</docs/en/commands#all-commands>).**Partial support:** * [Desktop](</docs/en/desktop>): only via [Claude Desktop on 3P](<https://claude.com/docs/third-party/claude-desktop/overview>) * [Web search](</docs/en/tools-reference#websearch-tool-behavior>): [deployments hosted on Anthropic](<https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#hosting-options>) only @@ -143,7 +144,7 @@ * [`/loop`](</docs/en/scheduled-tasks>): explicit intervals only * [Zero Data Retention](</docs/en/zero-data-retention>): subject to your Azure agreement -**Alternatives:** for scheduling, use [`/loop`](</docs/en/scheduled-tasks>) with an explicit interval instead of `/schedule`. +**Alternatives:** for scheduling, use [`/loop`](</docs/en/scheduled-tasks>) with an explicit interval 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, as are [server-managed settings](</docs/en/server-managed-settings>) when the API key belongs to a Team or Enterprise organization.
modified Rewind file changes with checkpointing View current →
--- a/file-checkpointing.md +++ b/file-checkpointing.md @@ -729,7 +729,7 @@ ​ -”No file checkpoint found for message” error +”No file checkpoint found for this message” error This error occurs when the checkpoint data doesn’t exist for the specified user message UUID. **Common causes** :
modified Claude Code GitHub Actions View current →
Show diff (1045 lines)
--- a/github-actions.md +++ b/github-actions.md @@ -1,34 +1,9 @@ -Claude Code GitHub Actions brings AI-powered automation to your GitHub workflow. With a simple `@claude` mention in any PR or issue, Claude can analyze your code, create pull requests, implement features, and fix bugs - all while following your project’s standards. For automatic reviews posted on every PR without a trigger, see [GitHub Code Review](</docs/en/code-review>). - -Claude Code GitHub Actions is built on top of the [Claude Agent SDK](</docs/en/agent-sdk/overview>), which enables programmatic integration of Claude Code into your applications. You can use the SDK to build custom automation workflows beyond GitHub Actions. - -## - -​ - -Why use Claude Code GitHub Actions? - - * **Instant PR creation** : Describe what you need, and Claude creates a complete PR with all necessary changes - * **Automated code implementation** : Turn issues into working code with a single command - * **Follows your standards** : Claude respects your `CLAUDE.md` guidelines and existing code patterns - * **Simple setup** : Get started in minutes with our installer and API key - * **Secure by default** : Your code stays on Github’s runners - -## - -​ - -What can Claude do? - -Claude Code provides a powerful GitHub Action that transforms how you work with code: - -### - -​ - -Claude Code Action - -This GitHub Action allows you to run Claude Code within your GitHub Actions workflows. You can use this to build any custom workflow on top of Claude Code. [View repository →](<https://github.com/anthropics/claude-code-action>) +[Claude Code GitHub Actions](<https://github.com/anthropics/claude-code-action>) is a GitHub Action that runs Claude Code inside your repository’s workflows. Mention `@claude` in a pull request or issue comment to have Claude analyze code, implement changes, and push commits. You can also give the Claude Code GitHub Action a prompt to run automatically on any GitHub event. Use it to turn issues into pull requests, fix bugs from a comment, or automate recurring tasks. Several products share the Claude Code name. This page covers the `claude-code-action` workflow integration, which you configure with workflow files in your repository. For the related products, see: + + * [Code Review](</docs/en/code-review>): automatic review on every pull request, without writing a workflow + * [Claude Code on the web](</docs/en/claude-code-on-the-web>): Claude Code sessions from your browser or phone + * [Claude Agent SDK](</docs/en/agent-sdk/overview>): custom automation outside GitHub Actions. The Claude Code GitHub Action is built on the SDK + * [GitHub Enterprise Server](</docs/en/github-enterprise-server>): Claude Code with self-hosted GitHub ## @@ -36,106 +11,148 @@ Setup -## +You can set up the Claude Code GitHub Action in one of two ways: + + * **Quick setup** : run `/install-github-app` from Claude Code. Claude Code installs the GitHub App, adds your authentication secret, and prepares the workflow pull request for you + * **Manual setup** : install the app, add the secret, and copy the workflow file into your repository yourself. Use this path when you don’t run Claude Code locally, when the command fails, or when you want full control of the workflow files + +For either path, you need admin access to the repository. + +### ​ Quick setup -Run `/install-github-app` in the Claude Code terminal to set up the integration interactively. The command installs the Claude GitHub App on your repository and then walks you through adding the GitHub Actions workflows and the API key secret. After the GitHub App is installed, the command asks whether to continue with GitHub Actions setup. In Claude Code v2.1.187 and later you can choose **Skip for now** to stop with only the App installed and return to the workflow and secret steps by running `/install-github-app` again. Earlier versions proceed straight to workflow selection. - - * You must be a repository admin to install the GitHub app and add secrets - * The GitHub app will request read & write permissions for Contents, Issues, and Pull requests - * This quickstart method is only available for direct Claude API users. If you’re using Amazon Bedrock or Google Cloud’s Agent Platform, see the Using with Amazon Bedrock and Google Cloud section. - -## +Before you start, install the [GitHub CLI](<https://cli.github.com>) and authenticate it with `gh auth login`. Claude Code checks for it and warns you if it’s missing. Open `claude` in the repository you want to connect, run `/install-github-app`, and follow the prompts. Claude Code installs the Claude GitHub App, then sets up an authentication secret for the workflows: + + * If Claude Code already has an API key, it reuses that key, and offers to keep the repository’s existing `ANTHROPIC_API_KEY` secret if one is already set + * Otherwise, choose between creating a long-lived token with your Claude subscription and pasting in an API key + +Claude Code saves the credential as a repository secret, named `ANTHROPIC_API_KEY` for an API key or `CLAUDE_CODE_OAUTH_TOKEN` for a subscription token. Claude Code then pushes a branch with the workflow files you select, already set to use that secret, and opens GitHub in your browser with a pull request ready to create. Create and merge that pull request, and `@claude` works in the repository. After installing the GitHub App, Claude Code asks whether to continue with GitHub Actions setup. Choose **Skip for now** to stop with only the GitHub App installed. Run `/install-github-app` again later to finish the workflow and secret steps. Before v2.1.187, Claude Code proceeded straight to workflow selection. + + * When you install the GitHub App, you grant it several permissions. See GitHub App permissions for the full set + * Quick setup works with the Claude API and Claude subscriptions. If you use Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry, see [Use Claude Code GitHub Actions with cloud providers](</docs/en/github-actions-cloud-providers>) + +### ​ Manual setup -If the `/install-github-app` command fails or you prefer manual setup, please follow these manual setup instructions: - - 1. **Install the Claude GitHub app** to your repository: <https://github.com/apps/claude> The Claude GitHub app requires the following repository permissions: - * **Contents** : Read & write (to modify repository files) - * **Issues** : Read & write (to respond to issues) - * **Pull requests** : Read & write (to create PRs and push changes) -For more details on security and permissions, see the [security documentation](<https://github.com/anthropics/claude-code-action/blob/main/docs/security.md>). - 2. **Add ANTHROPIC_API_KEY** to your repository secrets ([Learn how to use secrets in GitHub Actions](<https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions>)) - 3. **Copy the workflow file** from [examples/claude.yml](<https://github.com/anthropics/claude-code-action/blob/main/examples/claude.yml>) into your repository’s `.github/workflows/` - -After completing either the quickstart or manual setup, test the action by tagging `@claude` in an issue or PR comment. - -## - -​ - -Upgrading from Beta - -Claude Code GitHub Actions v1.0 introduces breaking changes that require updating your workflow files in order to upgrade to v1.0 from the beta version. - -If you’re currently using the beta version of Claude Code GitHub Actions, we recommend that you update your workflows to use the GA version. The new version simplifies configuration while adding powerful new features like automatic mode detection. - -### - -​ - -Essential changes - -All beta users must make these changes to their workflow files in order to upgrade: - - 1. **Update the action version** : Change `@beta` to `@v1` - 2. **Remove mode configuration** : Delete `mode: "tag"` or `mode: "agent"` (now auto-detected) - 3. **Update prompt inputs** : Replace `direct_prompt` with `prompt` - 4. **Move CLI options** : Convert `max_turns`, `model`, `custom_instructions`, etc. to `claude_args` - -### - -​ - -Breaking Changes Reference - -Old Beta Input| New v1.0 Input +To configure the Claude Code GitHub Action without running `/install-github-app`, install the app, add a secret, and copy a workflow file yourself: + +1 + +Install the Claude GitHub App + +Install the [Claude GitHub App](<https://github.com/apps/claude>) to your repository. The Claude Code GitHub Action relies on three of the app’s permissions: + + * **Contents** : read and write, so Claude can modify repository files + * **Issues** : read and write, so Claude can respond to issues + * **Pull requests** : read and write, so Claude can create PRs and push changes + +During installation, you also grant permissions that other Claude features use. See GitHub App permissions for the full set. + +2 + +Add an authentication secret + +Add one of the following secrets to your repository, depending on how you authenticate. See GitHub’s guide to [using secrets in GitHub Actions](<https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions>). + + * `ANTHROPIC_API_KEY`: a Claude API key from the [Claude Console](<https://console.anthropic.com>) + * `CLAUDE_CODE_OAUTH_TOKEN`: an OAuth token that authenticates with your Claude subscription, available on Pro, Max, Team, and Enterprise plans. Generate one by running `claude setup-token` locally. See [Generate a long-lived token](</docs/en/authentication#generate-a-long-lived-token>) + +In workflow files, pass the secret to the matching input: `anthropic_api_key` for an API key, or `claude_code_oauth_token` for an OAuth token. + +3 + +Copy the workflow file + +Copy [examples/claude.yml](<https://github.com/anthropics/claude-code-action/blob/main/examples/claude.yml>) into your repository’s `.github/workflows/` directory. The file is a working workflow, not just an example. As committed, Claude responds whenever someone mentions `@claude` in an issue or pull request, authenticating with the `ANTHROPIC_API_KEY` secret. If you added `CLAUDE_CODE_OAUTH_TOKEN` instead, change the workflow’s `anthropic_api_key` line to `claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}`. + +After setup, test the Claude Code GitHub Action by tagging `@claude` in an issue or PR comment. + +### + +​ + +Set up for an organization + +With quick setup or manual setup, you configure one repository at a time. To roll the Claude Code GitHub Action out across an organization: + + * Install the [Claude GitHub App](<https://github.com/apps/claude>) once at the organization level, choosing all repositories or a selected list + * Store the authentication secret as an organization-level Actions secret so each repository doesn’t need its own copy + * Add the workflow file to each repository that should run the Claude Code GitHub Action, or define the job once as a [reusable workflow](<https://docs.github.com/en/actions/using-workflows/reusing-workflows>) that each repository calls + +For a secret shared across repositories, authenticate with an API key from the [Claude Console](<https://console.anthropic.com>) rather than an OAuth token, since an OAuth token is tied to the subscription of the person who ran `claude setup-token`. To avoid storing a long-lived secret entirely, authenticate through workload identity federation, where the Claude Code GitHub Action exchanges the workflow’s GitHub OpenID Connect (OIDC) token for Claude API access through a Claude Console service account. Set these inputs: + + * `anthropic_federation_rule_id`: the federation rule ID, `fdrl_...` + * `anthropic_organization_id`: your Anthropic organization ID + * `anthropic_service_account_id`: the service account ID, `svac_...`. Optional, since the federation rule you create in the Console already targets a service account + * `anthropic_workspace_id`: the workspace ID, `wrkspc_...`. Optional when the federation rule targets a single workspace + +Grant the workflow the `id-token: write` permission, which the Claude Code GitHub Action needs for the federation exchange even when you pass your own `github_token`. See the [Claude Code GitHub Action’s setup guide](<https://github.com/anthropics/claude-code-action/blob/main/docs/setup.md>) for the Console-side configuration. For data handling and retention questions in a security review, see [data usage](</docs/en/data-usage>) and [security](</docs/en/security>). + +### + +​ + +Uninstall + +To remove the Claude Code GitHub Action, undo each piece of the setup that applies to your installation: + + * **Workflow files** : delete the workflows that use `anthropics/claude-code-action` from `.github/workflows/`. If you used quick setup, look for `claude.yml` and, if you selected the review workflow, `claude-code-review.yml`. With the workflows deleted, the Claude Code GitHub Action no longer runs + * **Secrets** : delete the `ANTHROPIC_API_KEY` or `CLAUDE_CODE_OAUTH_TOKEN` secret from the repository, and from organization-level Actions secrets if you shared it across repositories. If you delete a secret, the credential it held stays valid. To retire an API key entirely, also delete the key in the [Claude Console](<https://console.anthropic.com>) + * **GitHub App** : uninstall the Claude GitHub App in your repository or organization settings under GitHub Apps, but only if you don’t use it for another Claude feature, such as Code Review or web auto-fix + +If you configured a [cloud provider](</docs/en/github-actions-cloud-providers>), also delete the provider secrets, such as `AWS_ROLE_TO_ASSUME`, the `GCP_*` secrets, or the `AZURE_*` secrets, and uninstall the custom GitHub App along with its `APP_ID` and `APP_PRIVATE_KEY` secrets. + +### + +​ + +GitHub App permissions + +The [Claude GitHub App](<https://github.com/apps/claude>) is shared by every Claude feature that integrates with GitHub, including the Claude Code GitHub Action, [Code Review](</docs/en/code-review>), and [auto-fix for pull requests](</docs/en/claude-code-on-the-web#auto-fix-pull-requests>) on Claude Code on the web. A GitHub App has a single permission set covering all of its features, so the set includes some permissions that the Claude Code GitHub Action doesn’t use. When you install the app, you grant the following permissions: + +Permission| Access ---|--- -`mode`| _(Removed - auto-detected)_ -`direct_prompt`| `prompt` -`override_prompt`| `prompt` with GitHub variables -`custom_instructions`| `claude_args: --append-system-prompt` -`max_turns`| `claude_args: --max-turns` -`model`| `claude_args: --model` -`allowed_tools`| `claude_args: --allowedTools` -`disallowed_tools`| `claude_args: --disallowedTools` -`claude_env`| `settings` JSON format - -### - -​ - -Before and After Example - -**Beta version:** - - - uses: anthropics/claude-code-action@beta - with: - mode: "tag" - direct_prompt: "Review this PR for security issues" - anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} - custom_instructions: "Follow our coding standards" - max_turns: "10" - model: "claude-sonnet-5" - -**GA version (v1.0):** - - - uses: anthropics/claude-code-action@v1 - with: - prompt: "Review this PR for security issues" - anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} - claude_args: | - --append-system-prompt "Follow our coding standards" - --max-turns 10 - --model claude-sonnet-5 - -The action now automatically detects whether to run in interactive mode (responds to `@claude` mentions) or automation mode (runs immediately with a prompt) based on your configuration. +Actions| Read and write +Checks| Read and write +Contents| Read and write +Discussions| Read and write +Issues| Read and write +Members| Read +Metadata| Read +Pull requests| Read and write +Repository hooks| Read and write +Statuses| Read +Workflows| Read and write + +The permission set can also change ahead of the features that use it. When the app requests a permission it didn’t have before, GitHub prompts the account owner to approve it, an organization owner for an organization install, and the installation keeps its old permissions until they do. For example, when Actions access changes from read to write, the app can re-run workflows rather than only view runs and logs, so GitHub asks the owner to approve the change. When you install the app, you accept its full permission set. GitHub doesn’t let you accept a subset. If your organization requires only the permissions the Claude Code GitHub Action uses, create a custom GitHub App with Contents, Issues, and Pull requests instead, following the [Claude Code GitHub Action’s setup guide](<https://github.com/anthropics/claude-code-action/blob/main/docs/setup.md>). A custom app covers only the Claude Code GitHub Action. Code Review and web auto-fix still require the official app. For details on how the Claude Code GitHub Action limits what Claude can do with these permissions, see the [security documentation](<https://github.com/anthropics/claude-code-action/blob/main/docs/security.md>). + +## + +​ + +Interactive and automation modes + +The Claude Code GitHub Action detects how to run from your workflow configuration: + + * **Interactive mode** : when the workflow provides no `prompt` input, Claude waits for the trigger phrase, `@claude` by default, in an issue or pull request comment, in a pull request review, or in the body or title of a newly opened issue, then responds to that request. Progress and results appear as a comment on the triggering issue or PR. + * **Automation mode** : when the workflow provides a `prompt` input, Claude runs without waiting for a mention, subject only to the access checks below. Results appear in the workflow run log rather than a comment. + +### + +​ + +Who can trigger runs + +In both modes, the Claude Code GitHub Action runs two checks on the triggering actor before Claude starts, and the run fails when either check rejects it: + + * **Write access** : on issue and pull request events, the triggering user must have write access to the repository. To allow specific users without write access, set `allowed_non_write_users` and pass your own `github_token` input. Events that no user authors, such as a `schedule` trigger, skip this check. + * **Human actor** : on every event, the Claude Code GitHub Action rejects a bot actor unless you list it in `allowed_bots`, which keeps bots from triggering Claude in a loop. This check also applies to scheduled runs, which GitHub attributes to a repository user, usually the one who last changed the workflow’s `cron` schedule. If that user is a bot, list it in `allowed_bots`. ## @@ -143,13 +160,15 @@ Example use cases -Claude Code GitHub Actions can help you with a variety of tasks. The [examples directory](<https://github.com/anthropics/claude-code-action/tree/main/examples>) contains ready-to-use workflows for different scenarios. - -### - -​ - -Basic workflow +The [examples directory](<https://github.com/anthropics/claude-code-action/tree/main/examples>) contains ready-to-use workflows for different scenarios. The examples on this page show API key authentication. If you authenticate with a Claude subscription, replace the `anthropic_api_key` line in any example with `claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}`. + +### + +​ + +Respond to @claude mentions + +This workflow runs the Claude Code GitHub Action in interactive mode, so Claude responds whenever someone mentions `@claude` in an issue or PR comment. name: Claude Code on: @@ -159,25 +178,49 @@ types: [created] jobs: claude: + if: contains(github.event.comment.body, '@claude') runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + issues: write + id-token: write + actions: read steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 1 - uses: anthropics/claude-code-action@v1 with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} - # Responds to @claude mentions in comments - -### - -​ - -Using skills + +The parts of this workflow that aren’t boilerplate: + + * `id-token: write`: required for the Claude Code GitHub Action’s default GitHub App authentication + * `actions: read`: lets Claude read CI results on PRs + * `actions/checkout`: gives Claude a local copy of the repository to work in + * `if`: keeps runners from starting on comments that don’t mention `@claude`. The Claude Code GitHub Action also checks the trigger phrase itself before responding + +Once the workflow is in place, mention `@claude` in any issue or PR comment with a request: + + @claude implement this feature based on the issue description + @claude how should I implement user authentication for this endpoint? + @claude fix the TypeError in the user dashboard component + +Claude replies in a comment on the same issue or PR and updates it as it works. + +### + +​ + +Run a skill The `prompt` input accepts a [skill](</docs/en/skills>) invocation as well as plain text: - * For a skill in your repository’s `.claude/skills/` directory, run `actions/checkout` before the action step and pass `/skill-name`. - * For a skill packaged in a plugin, install the plugin with the `plugin_marketplaces` and `plugins` inputs and pass the namespaced `/plugin-name:skill-name`. - -The following workflow installs the `code-review` plugin and runs its skill on each new or updated pull request: + * For a skill in your repository’s `.claude/skills/` directory, run `actions/checkout` before the `anthropics/claude-code-action` step so the skill files are available on the runner, then pass `/skill-name` as the `prompt`. + * For a skill packaged in a [plugin](</docs/en/plugins>), install the plugin with the `plugin_marketplaces` and `plugins` inputs, then pass the namespaced `/plugin-name:skill-name` as the `prompt`. The `plugins` input takes `plugin-name@marketplace-name`, where the marketplace name comes from the marketplace’s own manifest rather than its repository URL. + +The following workflow installs the `code-review` plugin and runs its skill on each new or updated pull request. It runs the same plugin as the review workflow from quick setup. Use a workflow like this when you want to control the prompt, model, and triggers yourself. For automatic reviews without maintaining a workflow file, see [Code Review](</docs/en/code-review>). On public repositories, GitHub withholds secrets from runs triggered by fork pull requests, so the review runs only on pull requests from branches in the same repository. name: Code Review on: @@ -186,7 +229,15 @@ jobs: review: runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + issues: read + id-token: write steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 1 - uses: anthropics/claude-code-action@v1 with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} @@ -194,11 +245,15 @@ plugins: "code-review@claude-code-plugins" prompt: "/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}" -### - -​ - -Custom automation with prompts +Claude writes its findings to the workflow run log rather than posting them on the pull request. Open the run from the repository’s Actions tab to read them. + +### + +​ + +Run on a schedule + +With a `prompt` input, the Claude Code GitHub Action runs in automation mode on any GitHub event, including a cron schedule. For a plain-text prompt, Claude has no shell or GitHub API access until you grant the tools the prompt needs, with `--allowedTools` in `claude_args` or a [`permissions.allow` rule](</docs/en/permissions#permission-rule-syntax>) in the `settings` input. If you invoke a skill instead, Claude can use the tools its [`allowed-tools` frontmatter](</docs/en/skills#pre-approve-tools-for-a-skill>) grants. GitHub runs scheduled workflows only from the default branch and, in public repositories, disables the schedule after 60 days without repository activity. This workflow generates a report in the workflow run log at 09:00 UTC each day. Its `claude_args` line passes CLI arguments that select the model and allow two GitHub MCP tools. Claude reads commits and issues through the GitHub API with those tools, so you can omit the checkout step: name: Daily Report on: @@ -207,26 +262,18 @@ jobs: report: runs-on: ubuntu-latest + permissions: + contents: read + issues: read + id-token: write steps: - uses: anthropics/claude-code-action@v1 with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} prompt: "Generate a summary of yesterday's commits and open issues" - claude_args: "--model opus" - -### - -​ - -Common use cases - -In issue or PR comments: - - @claude implement this feature based on the issue description - @claude how should I implement user authentication for this endpoint? - @claude fix the TypeError in the user dashboard component - -Claude will automatically analyze the context and respond appropriately. + claude_args: | + --model claude-opus-4-8 + --allowedTools "mcp__github__list_commits,mcp__github__list_issues" ## @@ -238,414 +285,55 @@ ​ -CLAUDE.md configuration - -Create a `CLAUDE.md` file in your repository root to define code style guidelines, review criteria, project-specific rules, and preferred patterns. This file guides Claude’s understanding of your project standards. - -### - -​ - -Security considerations - -Never commit API keys directly to your repository. - -For comprehensive security guidance including permissions, authentication, and best practices, see the [Claude Code Action security documentation](<https://github.com/anthropics/claude-code-action/blob/main/docs/security.md>). Always use GitHub Secrets for API keys: - - * Add your API key as a repository secret named `ANTHROPIC_API_KEY` - * Reference it in workflows: `anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}` - * Limit action permissions to only what’s necessary - * Review Claude’s suggestions before merging - -Always use GitHub Secrets (for example, `${{ secrets.ANTHROPIC_API_KEY }}`) rather than hardcoding API keys directly in your workflow files. - -### - -​ - -Optimizing performance - -Use issue templates to provide context, keep your `CLAUDE.md` concise and focused, and configure appropriate timeouts for your workflows. - -### - -​ - -CI costs - -When using Claude Code GitHub Actions, be aware of the associated costs: **GitHub Actions costs:** - - * Claude Code runs on GitHub-hosted runners, which consume your GitHub Actions minutes - * See [GitHub’s billing documentation](<https://docs.github.com/en/billing/managing-billing-for-your-products/managing-billing-for-github-actions/about-billing-for-github-actions>) for detailed pricing and minute limits - -**API costs:** - - * Each Claude interaction consumes API tokens based on the length of prompts and responses - * Token usage varies by task complexity and codebase size - * See [Claude’s pricing page](<https://claude.com/platform/api>) for current token rates - -**Cost optimization tips:** - - * Use specific `@claude` commands to reduce unnecessary API calls - * Configure appropriate `--max-turns` in `claude_args` to prevent excessive iterations +Define project standards in CLAUDE.md + +Create a `CLAUDE.md` file in your repository root to define code style guidelines, review criteria, project-specific rules, and preferred patterns. Claude follows these guidelines when creating PRs and responding to requests. See the [memory documentation](</docs/en/memory>) for details. + +### + +​ + +Protect your credentials + +Never commit API keys or OAuth tokens directly to your repository. Always store them as GitHub Secrets and reference them in workflows, for example `anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}`. + +Grant the workflow only the permissions it needs, and review Claude’s changes before merging. For comprehensive security guidance including permissions and authentication, see the [Claude Code Action security documentation](<https://github.com/anthropics/claude-code-action/blob/main/docs/security.md>). + +### + +​ + +Manage costs + +Each run consumes two kinds of resources: + + * **GitHub Actions minutes** : the Claude Code GitHub Action runs on GitHub-hosted runners, which consume your GitHub Actions minutes. See [GitHub’s billing documentation](<https://docs.github.com/en/billing/managing-billing-for-your-products/managing-billing-for-github-actions/about-billing-for-github-actions>) for pricing and minute limits. + * **API tokens** : each interaction consumes tokens based on the length of prompts and responses, task complexity, and codebase size. See [Claude’s pricing page](<https://claude.com/platform/api>) for current token rates. If you authenticate with an OAuth token, runs use your Claude subscription instead of API billing. + +You can lower both kinds of cost by giving Claude clearer context and by capping how much work each run can do: + + * Write specific `@claude` requests so Claude needs fewer turns to finish + * Use issue templates to provide context up front + * Keep your `CLAUDE.md` concise, since Claude reads it on every run + * Set `--max-turns` in `claude_args` to limit iterations * Set workflow-level timeouts to avoid runaway jobs - * Consider using GitHub’s concurrency controls to limit parallel runs - -## - -​ - -Configuration examples - -The Claude Code Action v1 simplifies configuration with unified parameters: - - - uses: anthropics/claude-code-action@v1 - with: - anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} - prompt: "Your instructions here" # Optional - claude_args: "--max-turns 5" # Optional CLI arguments - -Key features: - - * **Unified prompt interface** \- Use `prompt` for all instructions - * **Skills** \- Invoke installed [skills](</docs/en/skills>) directly from the prompt - * **CLI passthrough** \- Any Claude Code CLI argument via `claude_args` - * **Flexible triggers** \- Works with any GitHub event - -Visit the [examples directory](<https://github.com/anthropics/claude-code-action/tree/main/examples>) for complete workflow files. - -When responding to issue or PR comments, Claude automatically responds to @claude mentions. For other events, use the `prompt` parameter to provide instructions. - -## - -​ - -Using with Amazon Bedrock and Google Cloud - -For enterprise environments, you can use Claude Code GitHub Actions with your own cloud infrastructure. This approach gives you control over data residency and billing while maintaining the same functionality. - -### - -​ - -Prerequisites - -Before setting up Claude Code GitHub Actions with cloud providers, you need: - -#### - -​ - -For Google Cloud’s Agent Platform: - - 1. A Google Cloud Project with Google Cloud’s Agent Platform enabled - 2. Workload Identity Federation configured for GitHub Actions - 3. A service account with the required permissions - 4. A GitHub App (recommended) or use the default GITHUB_TOKEN - -#### - -​ - -For Amazon Bedrock: - - 1. An AWS account with Amazon Bedrock enabled - 2. GitHub OIDC Identity Provider configured in AWS - 3. An IAM role with Amazon Bedrock permissions - 4. A GitHub App (recommended) or use the default GITHUB_TOKEN - -1 - -Create a custom GitHub App (Recommended for 3P Providers) - -For best control and security when using 3P providers like Google Cloud’s Agent Platform or Amazon Bedrock, we recommend creating your own GitHub App: - - 1. Go to <https://github.com/settings/apps/new> - 2. Fill in the basic information: - * **GitHub App name** : Choose a unique name (e.g., “YourOrg Claude Assistant”) - * **Homepage URL** : Your organization’s website or the repository URL - 3. Configure the app settings: - * **Webhooks** : Uncheck “Active” (not needed for this integration) - 4. Set the required permissions: - * **Repository permissions** : - * Contents: Read & Write - * Issues: Read & Write - * Pull requests: Read & Write - 5. Click “Create GitHub App” - 6. After creation, click “Generate a private key” and save the downloaded `.pem` file - 7. Note your App ID from the app settings page - 8. Install the app to your repository: - * From your app’s settings page, click “Install App” in the left sidebar - * Select your account or organization - * Choose “Only select repositories” and select the specific repository - * Click “Install” - 9. Add the private key as a secret to your repository: - * Go to your repository’s Settings → Secrets and variables → Actions - * Create a new secret named `APP_PRIVATE_KEY` with the contents of the `.pem` file - 10. Add the App ID as a secret: - - * Create a new secret named `APP_ID` with your GitHub App’s ID - -This app will be used with the [actions/create-github-app-token](<https://github.com/actions/create-github-app-token>) action to generate authentication tokens in your workflows. - -**Alternative for Claude API or if you don’t want to setup your own Github app** : Use the official Anthropic app: - - 1. Install from: <https://github.com/apps/claude> - 2. No additional configuration needed for authentication - -2 - -Configure cloud provider authentication - -Choose your cloud provider and set up secure authentication: - -Amazon Bedrock - -**Configure AWS to allow GitHub Actions to authenticate securely without storing credentials.** - -> **Security Note** : Use repository-specific configurations and grant only the minimum required permissions. - -**Required Setup** : - - 1. **Enable Amazon Bedrock** : - * Request access to Claude models in Amazon Bedrock - * For cross-region models, request access in all required regions - 2. **Set up GitHub OIDC Identity Provider** : - * Provider URL: `https://token.actions.githubusercontent.com` - * Audience: `sts.amazonaws.com` - 3. **Create IAM Role for GitHub Actions** : - * Trusted entity type: Web identity - * Identity provider: `token.actions.githubusercontent.com` - * Permissions: `AmazonBedrockFullAccess` policy - * Configure trust policy for your specific repository - -**Required Values** :After setup, you’ll need: - - * **AWS_ROLE_TO_ASSUME** : The ARN of the IAM role you created - -OIDC is more secure than using static AWS access keys because credentials are temporary and automatically rotated. - -See [AWS documentation](<https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_oidc.html>) for detailed OIDC setup instructions. - -Google Cloud's Agent Platform - -**Configure Google Cloud to allow GitHub Actions to authenticate securely without storing credentials.** - -> **Security Note** : Use repository-specific configurations and grant only the minimum required permissions. - -**Required Setup** : - - 1. **Enable APIs** in your Google Cloud project: - * IAM Credentials API - * Security Token Service (STS) API - * Google Cloud’s Agent Platform API - 2. **Create Workload Identity Federation resources** : - * Create a Workload Identity Pool - * Add a GitHub OIDC provider with: - * Issuer: `https://token.actions.githubusercontent.com` - * Attribute mappings for repository and owner - * **Security recommendation** : Use repository-specific attribute conditions - 3. **Create a Service Account** : - * Grant only `Vertex AI User` role - * **Security recommendation** : Create a dedicated service account per repository - 4. **Configure IAM bindings** : - * Allow the Workload Identity Pool to impersonate the service account - * **Security recommendation** : Use repository-specific principal sets - -**Required Values** :After setup, you’ll need: - - * **GCP_WORKLOAD_IDENTITY_PROVIDER** : The full provider resource name - * **GCP_SERVICE_ACCOUNT** : The service account email address - -Workload Identity Federation eliminates the need for downloadable service account keys, improving security. - -For detailed setup instructions, consult the [Google Cloud Workload Identity Federation documentation](<https://cloud.google.com/iam/docs/workload-identity-federation>). - -3 - -Add Required Secrets - -Add the following secrets to your repository (Settings → Secrets and variables → Actions): - -#### - -​ - -For Claude API (Direct): - - 1. **For API Authentication** : - * `ANTHROPIC_API_KEY`: Your Claude API key from [console.anthropic.com](<https://console.anthropic.com>) - 2. **For GitHub App (if using your own app)** : - * `APP_ID`: Your GitHub App’s ID - * `APP_PRIVATE_KEY`: The private key (.pem) content - -#### - -​ - -For Google Cloud’s Agent Platform - - 1. **For GCP Authentication** : - * `GCP_WORKLOAD_IDENTITY_PROVIDER` - * `GCP_SERVICE_ACCOUNT` - 2. **For GitHub App (if using your own app)** : - * `APP_ID`: Your GitHub App’s ID - * `APP_PRIVATE_KEY`: The private key (.pem) content - -#### - -​ - -For Amazon Bedrock - - 1. **For AWS Authentication** : - * `AWS_ROLE_TO_ASSUME` - 2. **For GitHub App (if using your own app)** : - * `APP_ID`: Your GitHub App’s ID - * `APP_PRIVATE_KEY`: The private key (.pem) content - -4 - -Create workflow files - -Create GitHub Actions workflow files that integrate with your cloud provider. The examples below show complete configurations for both Amazon Bedrock and Google Cloud’s Agent Platform: - -Amazon Bedrock workflow - -**Prerequisites:** - - * Amazon Bedrock access enabled with Claude model permissions - * GitHub configured as an OIDC identity provider in AWS - * IAM role with Amazon Bedrock permissions that trusts GitHub Actions - -**Required GitHub secrets:** - -Secret Name| Description ----|--- -`AWS_ROLE_TO_ASSUME`| ARN of the IAM role for Amazon Bedrock access -`APP_ID`| Your GitHub App ID (from app settings) -`APP_PRIVATE_KEY`| The private key you generated for your GitHub App - - name: Claude PR Action - - permissions: - contents: write - pull-requests: write - issues: write - id-token: write - - on: - issue_comment: - types: [created] - pull_request_review_comment: - types: [created] - issues: - types: [opened, assigned] - - jobs: - claude-pr: - if: | - (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || - (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || - (github.event_name == 'issues' && contains(github.event.issue.body, '@claude')) - runs-on: ubuntu-latest - env: - AWS_REGION: us-west-2 - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Generate GitHub App token - id: app-token - uses: actions/create-github-app-token@v2 - with: - app-id: ${{ secrets.APP_ID }} - private-key: ${{ secrets.APP_PRIVATE_KEY }} - - - name: Configure AWS Credentials (OIDC) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} - aws-region: us-west-2 - - - uses: anthropics/claude-code-action@v1 - with: - github_token: ${{ steps.app-token.outputs.token }} - use_bedrock: "true" - claude_args: '--model us.anthropic.claude-sonnet-4-6 --max-turns 10' - -The model ID format for Amazon Bedrock includes a region prefix (for example, `us.anthropic.claude-sonnet-4-6`). - -Google Cloud's Agent Platform workflow - -**Prerequisites:** - - * Google Cloud’s Agent Platform API enabled in your GCP project - * Workload Identity Federation configured for GitHub - * Service account with Google Cloud’s Agent Platform permissions - -**Required GitHub secrets:** - -Secret Name| Description ----|--- -`GCP_WORKLOAD_IDENTITY_PROVIDER`| Workload identity provider resource name -`GCP_SERVICE_ACCOUNT`| Service account email with Google Cloud’s Agent Platform access -`APP_ID`| Your GitHub App ID (from app settings) -`APP_PRIVATE_KEY`| The private key you generated for your GitHub App - - name: Claude PR Action - - permissions: - contents: write - pull-requests: write - issues: write - id-token: write - - on: - issue_comment: - types: [created] - pull_request_review_comment: - types: [created] - issues: - types: [opened, assigned] - - jobs: - claude-pr: - if: | - (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || - (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || - (github.event_name == 'issues' && contains(github.event.issue.body, '@claude')) - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Generate GitHub App token - id: app-token - uses: actions/create-github-app-token@v2 - with: - app-id: ${{ secrets.APP_ID }} - private-key: ${{ secrets.APP_PRIVATE_KEY }} - - - name: Authenticate to Google Cloud - id: auth - uses: google-github-actions/auth@v2 - with: - workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} - service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} - - - uses: anthropics/claude-code-action@v1 - with: - github_token: ${{ steps.app-token.outputs.token }} - trigger_phrase: "@claude" - use_vertex: "true" - claude_args: '--model claude-sonnet-4-5@20250929 --max-turns 10' - env: - ANTHROPIC_VERTEX_PROJECT_ID: ${{ steps.auth.outputs.project_id }} - CLOUD_ML_REGION: us-east5 - VERTEX_REGION_CLAUDE_4_5_SONNET: us-east5 - -The project ID is automatically retrieved from the Google Cloud authentication step, so you don’t need to hardcode it. + * Use GitHub’s concurrency controls to limit parallel runs + +For usage tracking across your organization, see the [analytics dashboard](</docs/en/analytics>) and [monitoring](</docs/en/monitoring-usage>). For how usage is measured and billed, see [costs](</docs/en/costs>). + +## + +​ + +Use a cloud provider + +By default, the Claude Code GitHub Action calls the Claude API directly with your API key or OAuth token. To route inference through your own cloud account instead, set the input for your provider and follow [Use Claude Code GitHub Actions with cloud providers](</docs/en/github-actions-cloud-providers>): + + * **Amazon Bedrock** : `use_bedrock: "true"` + * **Google Cloud’s Agent Platform** : `use_vertex: "true"` + * **Microsoft Foundry** : `use_foundry: "true"` + +With all three providers, you authenticate through OIDC identity federation instead of a Claude API key, so you store no static cloud credentials in your repository. ## @@ -659,7 +347,11 @@ Claude not responding to @claude commands -Verify the GitHub App is installed correctly, check that workflows are enabled, ensure API key is set in repository secrets, and confirm the comment contains `@claude` (not `/claude`). + * Verify the GitHub App is installed on the repository + * Check that workflows are enabled for the repository + * Ensure your API key or OAuth token is set in repository secrets + * Confirm the comment contains `@claude` as a complete word, not `/claude` or `@claude-bot` + * Confirm the commenting user has write access to the repository. See Who can trigger runs for the exceptions ### @@ -667,7 +359,8 @@ CI not running on Claude’s commits -Ensure you’re using the GitHub App or custom app (not Actions user), check workflow triggers include the necessary events, and verify app permissions include CI triggers. + * GitHub doesn’t trigger workflows on commits made with the default `GITHUB_TOKEN`. If you pass `github_token: ${{ secrets.GITHUB_TOKEN }}` to the Claude Code GitHub Action, remove it so it authenticates as the Claude GitHub App, or pass a custom app token instead + * Check that your CI workflow’s triggers include the events Claude’s pushes produce, such as `push` or `pull_request` ### @@ -675,7 +368,10 @@ Authentication errors -Confirm API key is valid and has sufficient permissions. For Amazon Bedrock or Google Cloud’s Agent Platform, check credentials configuration and ensure secrets are named correctly in workflows. + * Confirm the API key or OAuth token is valid by testing it locally with `claude` before debugging the workflow + * For Bedrock, Agent Platform, and Foundry, see the cloud provider page’s [troubleshooting section](</docs/en/github-actions-cloud-providers#troubleshooting>) + +For more solutions, see the Claude Code GitHub Action’s [FAQ](<https://github.com/anthropics/claude-code-action/blob/main/docs/faq.md>). ## @@ -689,64 +385,65 @@ Action parameters -The Claude Code Action v1 uses a simplified configuration: +These are the most commonly used inputs. Each maps to a `with:` key in the `anthropics/claude-code-action` step. Parameter| Description| Required ---|---|--- -`prompt`| Instructions for Claude (plain text or a [skill](</docs/en/skills>) name)| No* +`prompt`| Instructions for Claude, as plain text or a [skill](</docs/en/skills>) invocation. When omitted, Claude responds to the trigger phrase instead| No `claude_args`| CLI arguments passed to Claude Code| No +`anthropic_api_key`| Claude API key| For the Claude API, unless you use `claude_code_oauth_token` or workload identity federation. Not used for Bedrock, Agent Platform, or Foundry +`claude_code_oauth_token`| OAuth token for authenticating with a Claude subscription, generated with `claude setup-token`| No +`github_token`| Token for GitHub operations. When omitted, the Claude Code GitHub Action authenticates as the Claude GitHub App| No `plugin_marketplaces`| Newline-separated list of plugin marketplace Git URLs| No `plugins`| Newline-separated list of plugin names to install before execution| No -`anthropic_api_key`| Claude API key| Yes** -`github_token`| GitHub token for API access| No -`trigger_phrase`| Custom trigger phrase (default: “@claude”)| No -`use_bedrock`| Use Amazon Bedrock instead of Claude API| No -`use_vertex`| Use Google Cloud’s Agent Platform instead of Claude API| No - -*Prompt is optional - when omitted for issue/PR comments, Claude responds to trigger phrase -**Required for direct Claude API, not for Amazon Bedrock or Google Cloud’s Agent Platform - -#### +`settings`| Claude Code settings, as a JSON string or a path to a settings JSON file| No +`trigger_phrase`| Trigger phrase Claude responds to. Default: `@claude`| No +`use_bedrock`| Use Amazon Bedrock instead of the Claude API| No +`use_vertex`| Use Google Cloud’s Agent Platform instead of the Claude API| No +`use_foundry`| Use Microsoft Foundry instead of the Claude API| No + +For the full input list, see the Claude Code GitHub Action’s [configuration reference](<https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md#inputs>). + +### ​ Pass CLI arguments -The `claude_args` parameter accepts any Claude Code CLI arguments: +The `claude_args` parameter accepts any [Claude Code CLI argument](</docs/en/cli-reference>): claude_args: "--max-turns 5 --model claude-sonnet-5 --mcp-config /path/to/config.json" Common arguments: - * `--max-turns`: Maximum conversation turns (default: 10) - * `--model`: Model to use (for example, `claude-sonnet-5`) - * `--mcp-config`: Path to MCP configuration - * `--allowedTools`: Comma-separated list of allowed tools. The `--allowed-tools` alias also works. - * `--debug`: Enable debug output - -### - -​ - -Alternative integration methods - -While the `/install-github-app` command is the recommended approach, you can also: - - * **Custom GitHub App** : For organizations needing branded usernames or custom authentication flows. Create your own GitHub App with required permissions (contents, issues, pull requests) and use the actions/create-github-app-token action to generate tokens in your workflows. - * **Manual GitHub Actions** : Direct workflow configuration for maximum flexibility - * **MCP Configuration** : Dynamic loading of Model Context Protocol servers - -See the [Claude Code Action documentation](<https://github.com/anthropics/claude-code-action/blob/main/docs>) for detailed guides on authentication, security, and advanced configuration. - -### - -​ - -Customizing Claude’s behavior - -You can configure Claude’s behavior in two ways: - - 1. **CLAUDE.md** : Define coding standards, review criteria, and project-specific rules in a `CLAUDE.md` file at the root of your repository. Claude will follow these guidelines when creating PRs and responding to requests. Check out our [Memory documentation](</docs/en/memory>) for more details. - 2. **Custom prompts** : Use the `prompt` parameter in the workflow file to provide workflow-specific instructions. This allows you to customize Claude’s behavior for different workflows or tasks. - -Claude will follow these guidelines when creating PRs and responding to requests. + * `--max-turns`: limit the number of conversation turns + * `--model`: model to use, for example `claude-sonnet-5`. Without this argument, the Claude Code GitHub Action uses the Claude Code [default model](</docs/en/model-config>) + * `--mcp-config`: path to [MCP configuration](</docs/en/mcp>) + * `--allowedTools`: comma-separated list of allowed tools. The `--allowed-tools` alias also works + * `--debug`: enable debug output + +## + +​ + +Upgrade from beta + +If your workflows still reference `anthropics/claude-code-action@beta`, update them to v1: + + 1. Change `@beta` to `@v1` in the `uses` line + 2. Remove the `mode` input, since the Claude Code GitHub Action now detects the mode automatically + 3. Replace `direct_prompt` with `prompt` + 4. Move CLI options such as `max_turns` and `model` into `claude_args`. `custom_instructions` has no same-name flag and becomes `--append-system-prompt` + +For the full input mapping and before-and-after examples, see the [migration guide](<https://github.com/anthropics/claude-code-action/blob/main/docs/migration-guide.md>). + +## + +​ + +What’s next + + * [Use Claude Code GitHub Actions with cloud providers](</docs/en/github-actions-cloud-providers>): route inference through Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry + * [Configuration reference](<https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md#inputs>): the full list of action inputs + * [Examples directory](<https://github.com/anthropics/claude-code-action/tree/main/examples>): ready-to-use workflows for more scenarios + * [Code Review](</docs/en/code-review>): automatic pull request review without maintaining a workflow file
added Use Claude Code GitHub Actions with cloud providers View current →
Show diff (319 lines)
--- a/github-actions-cloud-providers.md +++ b/github-actions-cloud-providers.md @@ -0,0 +1,316 @@ +[Claude Code GitHub Actions](</docs/en/github-actions>) calls the Claude API by default. To route inference through your own cloud account instead, set the Claude Code GitHub Action’s provider input and configure your cloud to trust the workflow’s OpenID Connect (OIDC) token. The workflow authenticates with that token, so you store no long-lived cloud credential in your repository. + +This page builds on the [GitHub Actions setup](</docs/en/github-actions#setup>). It assumes you already know the workflow file and the `anthropics/claude-code-action` step, and covers only what a cloud provider changes. + +## + +​ + +Choose your provider + +The Claude Code GitHub Action supports three providers, and the setup steps below differ only in the cloud-side configuration. Use the one where your organization already has Claude model access. You tell the Claude Code GitHub Action which provider to use with one input in the `anthropics/claude-code-action` step’s `with:` block: + + * **Amazon Bedrock** : `use_bedrock: "true"` + * **Google Cloud’s Agent Platform** : `use_vertex: "true"` + * **Microsoft Foundry** : `use_foundry: "true"` + +The following snippet shows the input in place for Amazon Bedrock. You don’t need to edit a workflow yet, because the complete workflow examples later on this page already include the input for each provider. + + - uses: anthropics/claude-code-action@v1 + with: + use_bedrock: "true" + +## + +​ + +Prerequisites + +Before you start, you need: + + * Admin access to the repository where the Claude Code GitHub Action runs, to install a GitHub App and add secrets + * Permission to create identity resources in your cloud account: IAM roles and OIDC identity providers on AWS, Workload Identity Federation resources and service accounts on Google Cloud, or Microsoft Entra applications on Azure + * Claude model access on your provider: + * **Amazon Bedrock** : access granted to Claude models. Cross-region inference profiles, such as the `us.` model IDs in this page’s examples, need access granted in every region of their region group. See [Claude Code on Amazon Bedrock](</docs/en/amazon-bedrock>) + * **Google Cloud’s Agent Platform** : a project with the Agent Platform API enabled and access to Claude models. See [Claude Code on Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) + * **Microsoft Foundry** : a Foundry resource with a Claude model deployment. See [Claude Code on Microsoft Foundry](</docs/en/microsoft-foundry>) + +## + +​ + +Set up the integration + +Beyond the prerequisites, you create four things: a GitHub identity for the Claude Code GitHub Action, the cloud-side trust configuration, the repository secrets, and the workflow file. The steps below walk through each. + +1 + +Choose a GitHub identity + +The Claude Code GitHub Action pushes commits and posts comments through a GitHub identity. The [quick setup](</docs/en/github-actions#quick-setup>) installs the official Claude GitHub App for this. With a cloud provider, you choose the identity yourself: + + * **Official[Claude GitHub App](<https://github.com/apps/claude>)**: install it on the repository, or skip to the next step if it’s already installed + * **Custom GitHub App** : create your own app, described below, when you want only the three permissions the Claude Code GitHub Action uses rather than the [official app’s full set](</docs/en/github-actions#github-app-permissions>) + * **GitHub’s automatic`GITHUB_TOKEN`**: no app to create or install, but GitHub doesn’t trigger your CI workflows on commits made with it + +The workflow examples in the fourth step authenticate with a custom app. That step also says what to change for the other two options.To create a custom app, [register a new GitHub App](<https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/registering-a-github-app>) with webhooks disabled, since this integration doesn’t use them. Grant it three repository permissions: + + * **Contents** : read and write + * **Issues** : read and write + * **Pull requests** : read and write + +After registering the app, generate a private key and keep the downloaded `.pem` file, note the App ID from the app’s settings page, and [install the app](<https://docs.github.com/en/apps/using-github-apps/installing-your-own-github-app>) on the repository where the Claude Code GitHub Action runs. You add the key and the ID as secrets in the third step. + +2 + +Configure cloud authentication + +Configure your cloud to trust the OIDC token that GitHub issues to the workflow, so each workflow run gets short-lived cloud credentials. The bullets in each tab summarize what to create, and each tab links the cloud vendor’s own guide for the console-level steps. + + * Amazon Bedrock + + * Google Cloud's Agent Platform + + * Microsoft Foundry + +Create the trust configuration in your AWS account, following the [AWS guide to creating OIDC identity providers](<https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_oidc.html>): + + * Add a GitHub OIDC identity provider with provider URL `https://token.actions.githubusercontent.com` and audience `sts.amazonaws.com` + * Create an IAM role trusted by that provider as a web identity, and attach the scoped invocation policy from [IAM configuration](</docs/en/amazon-bedrock#iam-configuration>), which grants `bedrock:InvokeModel`, `bedrock:InvokeModelWithResponseStream`, `bedrock:ListInferenceProfiles`, and `bedrock:GetInferenceProfile`, along with two `aws-marketplace` subscription actions + * Limit the role’s trust policy to your repository with a subject condition such as `repo:your-org/your-repo:*`. See [GitHub’s OIDC hardening guide](<https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect>) for the claim format + +Note the role’s ARN. You add it as a secret in the next step. + +Create the federation resources in your Google Cloud project, following the [Workload Identity Federation documentation](<https://cloud.google.com/iam/docs/workload-identity-federation>): + + * Enable three APIs: IAM Credentials, Security Token Service (STS), and the Agent Platform API, whose service name is `aiplatform.googleapis.com` + * Create a Workload Identity Pool with a GitHub OIDC provider whose issuer is `https://token.actions.githubusercontent.com`, and add an attribute condition that limits the pool to your repository + * Create a dedicated service account with only the `Vertex AI User` role, which is `roles/aiplatform.user`, and allow the pool to impersonate it + +Note the provider’s full resource name and the service account’s email address. You add them as secrets in the next step. + +Create a Microsoft Entra application with a federated credential for your repository, following [Microsoft’s guide to authenticating from GitHub Actions](<https://learn.microsoft.com/en-us/azure/developer/github/connect-from-azure-openid-connect>): + + * Register a Microsoft Entra application and add a federated identity credential that trusts tokens GitHub issues to your repository. A user-assigned managed identity works in place of an application. Both have the client ID you note below + * Assign the application the `Azure AI User` role on your Foundry resource. See [Azure RBAC configuration](</docs/en/microsoft-foundry#azure-rbac-configuration>) for a narrower custom role + +Note the application’s client ID, your tenant ID, and your subscription ID. You add them as secrets in the next step. + +3 + +Add repository secrets + +In the repository where the Claude Code GitHub Action runs, add the secrets for your provider, plus the two app secrets if you created a custom GitHub App in the first step. See GitHub’s guide to [using secrets in GitHub Actions](<https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions>). + +Secret| Needed for| Value +---|---|--- +`AWS_ROLE_TO_ASSUME`| Amazon Bedrock| The ARN of the IAM role +`GCP_WORKLOAD_IDENTITY_PROVIDER`| Google Cloud’s Agent Platform| The provider’s full resource name +`GCP_SERVICE_ACCOUNT`| Google Cloud’s Agent Platform| The service account’s email address +`AZURE_CLIENT_ID`| Microsoft Foundry| The Entra application’s client ID +`AZURE_TENANT_ID`| Microsoft Foundry| Your Microsoft Entra tenant ID +`AZURE_SUBSCRIPTION_ID`| Microsoft Foundry| Your Azure subscription ID +`APP_ID`| Custom GitHub App| The GitHub App’s ID +`APP_PRIVATE_KEY`| Custom GitHub App| The contents of the `.pem` private key file + +4 + +Create the workflow file + +Create a workflow file for your provider, such as `.github/workflows/claude.yml`. Each example responds to `@claude` mentions, authenticates to GitHub with a custom app, and includes the `id-token: write` permission, which GitHub requires to issue the OIDC token that your cloud provider exchanges for credentials.If you chose a different GitHub identity in the first step, adjust the example: + + * **Official Claude GitHub App** : delete the Generate GitHub App token step and the `github_token` line + * **GitHub’s automatic token** : delete the token-generation step and change the `github_token` line to `github_token: ${{ secrets.GITHUB_TOKEN }}` + +On public repositories, a comment containing the trigger phrase from any user starts this workflow. The credential steps run before the Claude Code GitHub Action checks the commenter’s write access, so the action rejects unauthorized users only after the workflow has generated an App token and signed in to your cloud provider, which leaves audit-log entries and consumes Actions minutes. To avoid those runs, add a step that verifies the commenter’s write access before the credential steps. + + * Amazon Bedrock + + * Google Cloud's Agent Platform + + * Microsoft Foundry + +Replace the `aws-region` value with your own. The credentials step exports it as `AWS_REGION` for the rest of the job. + + name: Claude PR Action + + permissions: + contents: write + pull-requests: write + issues: write + id-token: write + + on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + issues: + types: [opened] + + jobs: + claude-pr: + if: | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Generate GitHub App token + id: app-token + uses: actions/create-github-app-token@v2 + with: + app-id: ${{ secrets.APP_ID }} + private-key: ${{ secrets.APP_PRIVATE_KEY }} + + - name: Configure AWS Credentials (OIDC) + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} + aws-region: us-west-2 + + - uses: anthropics/claude-code-action@v1 + with: + github_token: ${{ steps.app-token.outputs.token }} + use_bedrock: "true" + claude_args: '--model us.anthropic.claude-sonnet-4-6' + +Bedrock model IDs include a cross-region inference profile prefix such as `us.`. Use the prefix for the region group where you granted model access. + +Replace the `CLOUD_ML_REGION` value with your own. You don’t need to hardcode the project ID, because the workflow reads it from the `auth` step’s output. + + name: Claude PR Action + + permissions: + contents: write + pull-requests: write + issues: write + id-token: write + + on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + issues: + types: [opened] + + jobs: + claude-pr: + if: | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Generate GitHub App token + id: app-token + uses: actions/create-github-app-token@v2 + with: + app-id: ${{ secrets.APP_ID }} + private-key: ${{ secrets.APP_PRIVATE_KEY }} + + - name: Authenticate to Google Cloud + id: auth + uses: google-github-actions/auth@v2 + with: + workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} + service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} + + - uses: anthropics/claude-code-action@v1 + with: + github_token: ${{ steps.app-token.outputs.token }} + use_vertex: "true" + claude_args: '--model claude-sonnet-5' + env: + ANTHROPIC_VERTEX_PROJECT_ID: ${{ steps.auth.outputs.project_id }} + CLOUD_ML_REGION: us-east5 + +Replace `your-resource-name` with your Foundry resource name. Claude Code builds the endpoint URL from it. The `azure/login` step signs in with the workflow’s OIDC token, and Claude Code picks up the credentials through the Azure [default credential chain](<https://learn.microsoft.com/en-us/azure/developer/javascript/sdk/authentication/credential-chains#defaultazurecredential-overview>). + + name: Claude PR Action + + permissions: + contents: write + pull-requests: write + issues: write + id-token: write + + on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + issues: + types: [opened] + + jobs: + claude-pr: + if: | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Generate GitHub App token + id: app-token + uses: actions/create-github-app-token@v2 + with: + app-id: ${{ secrets.APP_ID }} + private-key: ${{ secrets.APP_PRIVATE_KEY }} + + - name: Authenticate to Azure + uses: azure/login@v2 + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + + - uses: anthropics/claude-code-action@v1 + with: + github_token: ${{ steps.app-token.outputs.token }} + use_foundry: "true" + claude_args: '--model claude-sonnet-5' + env: + ANTHROPIC_FOUNDRY_RESOURCE: your-resource-name + +Use a model ID that matches a Claude deployment in your Foundry resource. See [Claude Code on Microsoft Foundry](</docs/en/microsoft-foundry>) for model configuration and version pinning. + +With any provider, you can bound run length and cost by adding `--max-turns` to `claude_args`. See [Manage costs](</docs/en/github-actions#manage-costs>). + +5 + +Test the setup + +Mention `@claude` in an issue or PR comment, then watch the run in the repository’s Actions tab. Claude replies in a comment on the same issue or PR. + +## + +​ + +Troubleshooting + +A failing run usually breaks in one of two places: + + * **Authentication errors** : usually an OIDC misconfiguration. Check that the workflow includes the `id-token: write` permission, that the trust configuration’s repository condition matches your repository exactly, and that the secret names in your workflow match the ones you added + * **Trigger and CI problems** : these behave the same as when the Claude Code GitHub Action calls the Claude API. See the main page’s [troubleshooting section](</docs/en/github-actions#troubleshooting>) and the Claude Code GitHub Action’s [FAQ](<https://github.com/anthropics/claude-code-action/blob/main/docs/faq.md>) + +## + +​ + +What’s next + + * [Claude Code GitHub Actions](</docs/en/github-actions>) for examples, parameters, and best practices + * [Claude Code on Amazon Bedrock](</docs/en/amazon-bedrock>) for Bedrock model IDs and regions + * [Claude Code on Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) for Agent Platform model IDs and regions + * [Claude Code on Microsoft Foundry](</docs/en/microsoft-foundry>) for Foundry model and endpoint configuration
modified Glossary View current →
--- a/glossary.md +++ b/glossary.md @@ -222,7 +222,7 @@ Managed settings -Settings enforced org-wide by IT or DevOps, delivered from Anthropic’s servers through the admin console or deployed to devices at an OS-level path outside `~/.claude`. User and project settings cannot override managed settings. Server-managed delivery applies on [eligible configurations](</docs/en/server-managed-settings#platform-availability>); see [Security considerations](</docs/en/server-managed-settings#security-considerations>). Use this for security policies, compliance requirements, or standardized tooling across a fleet. Learn more: [Server-managed settings](</docs/en/server-managed-settings>) · [Settings files](</docs/en/settings#settings-files>) +Settings enforced org-wide by IT or DevOps, delivered from Anthropic’s servers through the admin console or deployed to devices at an OS-level path outside `~/.claude`. User and project settings cannot override managed settings, apart from the exceptions listed under [Settings precedence](</docs/en/settings#settings-precedence>). Server-managed delivery applies on [eligible configurations](</docs/en/server-managed-settings#platform-availability>); see [Security considerations](</docs/en/server-managed-settings#security-considerations>). Use this for security policies, compliance requirements, or standardized tooling across a fleet. Learn more: [Server-managed settings](</docs/en/server-managed-settings>) · [Settings files](</docs/en/settings#settings-files>) ### @@ -380,7 +380,7 @@ Settings layers -The hierarchy Claude Code reads configuration from, in precedence order from highest to lowest: managed policy, command-line arguments, local settings at `.claude/settings.local.json`, project settings at `.claude/settings.json`, then user settings at `~/.claude/settings.json`. Arrays merge across layers; scalars at a higher layer override lower ones. Learn more: [Settings files](</docs/en/settings#settings-files>) +The hierarchy Claude Code reads configuration from, in precedence order from highest to lowest: managed policy, command-line arguments, local settings at `.claude/settings.local.json`, project settings at `.claude/settings.json`, then user settings at `~/.claude/settings.json`. Arrays merge across layers; scalars at a higher layer override lower ones, apart from the exceptions under [Settings precedence](</docs/en/settings#settings-precedence>). Learn more: [Settings files](</docs/en/settings#settings-files>) ###
modified Run Claude Code programmatically View current →
--- a/headless.md +++ b/headless.md @@ -1,4 +1,4 @@ -The [Agent SDK](</docs/en/agent-sdk/overview>) gives you the same tools, agent loop, and context management that power Claude Code. It’s available as a CLI for scripts and CI/CD, or as [Python](</docs/en/agent-sdk/python>) and [TypeScript](</docs/en/agent-sdk/typescript>) packages for full programmatic control. To run Claude Code in non-interactive mode, pass `-p` with your prompt and any [CLI options](</docs/en/cli-reference>): +The [Agent SDK](</docs/en/agent-sdk/overview>) gives you the same tools, agent loop, and context management that power Claude Code. It’s available as a CLI for scripts and CI/CD, or as [Python](</docs/en/agent-sdk/python>) and [TypeScript](</docs/en/agent-sdk/typescript>) packages for full programmatic control. To run Claude Code in non-interactive mode, pass `-p` with your prompt and the [CLI options](</docs/en/cli-reference>) you need: claude -p "Find and fix the bug in auth.py" --allowedTools "Read,Edit,Bash" @@ -10,7 +10,7 @@ Basic usage -Add the `-p` (or `--print`) flag to any `claude` command to run it non-interactively. All [CLI options](</docs/en/cli-reference>) work with `-p`, including: +Add the `-p` (or `--print`) flag to any `claude` command to run it non-interactively. Not every [CLI option](</docs/en/cli-reference>) combines with `-p`. Claude Code rejects `--bg` and `--cloud` with an error naming the conflict. Options you’ll combine with `-p` often include: * `--continue` for continuing conversations * `--allowedTools` for auto-approving tools @@ -198,7 +198,7 @@ `plugins`| array| plugins that loaded successfully, each with `name` and `path` `plugin_errors`| array| plugin load-time errors, each with `plugin`, `type`, and `message`. Includes unsatisfied dependency versions and `--plugin-dir` load failures such as a missing path or invalid archive. Affected plugins are demoted and absent from `plugins`. The key is omitted when there are no errors -Use the MCP server fields the same way. Claude Code validates each [`--mcp-config`](</docs/en/cli-reference#cli-flags>) entry at startup and skips entries that fail validation, for example a `url` entry with no `type`; the run continues and exits cleanly, so check these fields to catch a server that never loaded: +Use the MCP server fields the same way. When you pass [`--mcp-config`](</docs/en/cli-reference#cli-flags>) with `-p`, Claude Code waits for still-pending servers before running the first turn, up to the [`MCP_TIMEOUT`](</docs/en/env-vars>) startup timeout, 30 seconds by default. A remote server with a [cached tool list](</docs/en/agent-sdk/mcp#connection-timing>) skips the wait, shows `pending` in `system/init`, and connects on its first tool call. The wait requires Claude Code v2.1.221 or later. Claude Code validates each `--mcp-config` entry at startup and skips entries that fail validation, for example a `url` entry with no `type`. The run continues and exits cleanly, so check these fields to catch a server that never loaded: Field| Type| Description ---|---|---
modified Hooks reference View current →
--- a/hooks.md +++ b/hooks.md @@ -679,7 +679,7 @@ Exit code output -The exit code from your hook command tells Claude Code whether the action should proceed, be blocked, or be ignored. **Exit 0** means success. Claude Code parses stdout for JSON output fields. JSON output is only processed on exit 0. For most events, stdout is written to the debug log but not shown in the transcript. The exceptions are `UserPromptSubmit`, `UserPromptExpansion`, and `SessionStart`, where stdout is added as context that Claude can see and act on. **Exit 2** means a blocking error. Claude Code ignores stdout and any JSON in it. Instead, stderr text is fed back to Claude as an error message. The effect depends on the event: `PreToolUse` blocks the tool call, `UserPromptSubmit` rejects the prompt, and so on. See exit code 2 behavior for the full list. A hook that exits 2 while printing JSON that fails JSON output schema validation still blocks: Claude Code uses stderr as the blocking reason and records the validation failure in the debug log. Before v2.1.214, Claude Code treated that combination as a non-blocking error and the action proceeded. **Any other exit code** is a non-blocking error for most hook events. The action proceeds, and the transcript shows a `<hook name> hook error` notice followed by the first line of stderr, prefixed with `Failed with non-blocking status code:`. To capture the full stderr, enable debug logging. For example, a hook command script that blocks dangerous Bash commands: +The exit code from your hook command tells Claude Code whether the action should proceed, be blocked, or be ignored. **Exit 0** means success. Claude Code parses stdout for JSON output fields. JSON output is only processed on exit 0. For most events, stdout is written to the debug log but not shown in the transcript. The exceptions are `UserPromptSubmit`, `UserPromptExpansion`, and `SessionStart`, where stdout is added as context that Claude can see and act on. Stderr from a hook that exits 0 goes to the debug log only, never the transcript, and Claude never sees it. To read it yourself, enable debug logging. To surface a warning to Claude from a `PostToolUse` or `PostToolUseFailure` hook, exit 2 instead so Claude sees the stderr even though the tool already ran. **Exit 2** means a blocking error. Claude Code ignores stdout and any JSON in it. Instead, stderr text is fed back to Claude as an error message. The effect depends on the event: `PreToolUse` blocks the tool call, `UserPromptSubmit` rejects the prompt, and so on. See exit code 2 behavior for the full list. A hook that exits 2 while printing JSON that fails JSON output schema validation still blocks: Claude Code uses stderr as the blocking reason and records the validation failure in the debug log. Before v2.1.214, Claude Code treated that combination as a non-blocking error and the action proceeded. **Any other exit code** is a non-blocking error for most hook events. The action proceeds, and the transcript shows a `<hook name> hook error` notice followed by the first line of stderr, prefixed with `Failed with non-blocking status code:`. To capture the full stderr, enable debug logging. For example, a hook command script that blocks dangerous Bash commands: #!/bin/bash # Reads JSON input from stdin, checks the command @@ -1380,7 +1380,26 @@ PreToolUse input -In addition to the common input fields, PreToolUse hooks receive `tool_name`, `tool_input`, and `tool_use_id`. The `tool_input` fields depend on the tool: +In addition to the common input fields, PreToolUse hooks receive `tool_name`, `tool_input`, and `tool_use_id`. For the file tools `Write`, `Edit`, and `Read`, `tool_input.file_path` is always absolute: + + * Claude Code expands `~` and relative paths before hooks run, so a hook that matches on paths can’t be bypassed via `~` or a relative spelling of the same path + * On Windows, the path arrives with backslash separators, even when your hook runs under Git Bash where `$PWD` looks like `/c/project` + * A comparison written with forward slashes, such as a `/src/` check, never matches a backslash path, and the tool call proceeds as if the hook had nothing to block + * Normalize separators before comparing: `FILE_PATH="${FILE_PATH//\\//}"` in Bash, or `file_path.replace("\\", "/")` in Python, then match a path segment such as `/src/` rather than anchoring with `^`, since the path is absolute + +A `Write` call on Windows delivers: + + { + "hook_event_name": "PreToolUse", + "tool_name": "Write", + "tool_input": { + "file_path": "C:\\project\\src\\index.ts", + "content": "..." + }, + ... + } + +The `tool_input` fields depend on the tool: ##### Bash @@ -1703,7 +1722,7 @@ PostToolUse input -`PostToolUse` hooks fire after a tool has already executed successfully. The input includes both `tool_input`, the arguments sent to the tool, and `tool_response`, the result it returned. The exact schema for both depends on the tool. +`PostToolUse` hooks fire after a tool has already executed successfully. The input includes both `tool_input`, the arguments sent to the tool, and `tool_response`, the result it returned. The exact schema for both depends on the tool. File-tool `tool_input` paths arrive in the same format as for PreToolUse: always absolute, with the platform’s native separators, so backslashes on Windows. { "session_id": "abc123", @@ -2649,9 +2668,9 @@ * you exit a `--worktree` session and choose to remove it * a subagent with `isolation: "worktree"` finishes - * you delete a [background session](</docs/en/agent-view#organize-the-list>) whose worktree the hook created - -For git-based worktrees, Claude Code handles cleanup automatically with `git worktree remove`. If you configured a WorktreeCreate hook for a non-git version control system, pair it with a WorktreeRemove hook to handle cleanup. Without one, the worktree directory is left on disk. For a background-session delete, Claude Code verifies the stored worktree path before running the hook and refuses a path that is a symlink or passes through one below the repository root. The hook runs for a worktree that still contains files only when you confirm the delete in [agent view](</docs/en/agent-view#organize-the-list>); for such a worktree, [`claude rm`](</docs/en/agent-view#manage-sessions-from-the-shell>) keeps the session and worktree instead. Before v2.1.216, the hook ran on the stored path without these checks. Claude Code passes the path returned by WorktreeCreate as `worktree_path` in the hook input. This example reads that path and removes the directory: + * you delete a [background session](</docs/en/agent-view#what-deleting-a-session-removes>) whose worktree the hook created + +For git-based worktrees, Claude Code handles cleanup automatically with `git worktree remove`. If you configured a WorktreeCreate hook for a non-git version control system, pair it with a WorktreeRemove hook to handle cleanup. Without one, the worktree directory is left on disk. For a background-session delete, Claude Code verifies the stored worktree path before running the hook and refuses a path that is a symlink or passes through one below the repository root. The hook runs for a worktree that still contains files only when you confirm the delete in [agent view](</docs/en/agent-view#what-deleting-a-session-removes>); for such a worktree, [`claude rm`](</docs/en/agent-view#manage-sessions-from-the-shell>) keeps the session and worktree instead. Before v2.1.216, the hook ran on the stored path without these checks. Claude Code passes the path returned by WorktreeCreate as `worktree_path` in the hook input. This example reads that path and removes the directory: { "hooks": {
modified Automate actions with hooks View current →
--- a/hooks-guide.md +++ b/hooks-guide.md @@ -219,6 +219,9 @@ INPUT=$(cat) FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty') + + # Normalize Windows backslash separators so the patterns below match + FILE_PATH="${FILE_PATH//\\//}" PROTECTED_PATTERNS=(".env" "package-lock.json" ".git/")
modified Gateway protocol reference View current →
--- a/llm-gateway-protocol.md +++ b/llm-gateway-protocol.md @@ -54,7 +54,7 @@ Streaming -Inference responses must stream. Claude Code consumes server-sent events as they arrive, so a gateway that buffers complete responses before relaying them stalls the client. +Inference responses must stream. Claude Code consumes server-sent events as they arrive, so a gateway that buffers complete responses before relaying them stalls the client. Forward keep-alive pings as well. On connections through `ANTHROPIC_BASE_URL` or `ANTHROPIC_AWS_BASE_URL`, Claude Code counts every byte your gateway relays, including SSE `ping` events and comment lines, and aborts a stream that goes silent for 300 seconds by default. The upstream’s pings are the only traffic during long thinking pauses, so if your gateway strips or buffers them, Claude Code aborts the stream during those pauses; [Automatic retries](</docs/en/errors#automatic-retries>) covers what an aborted stream reports based on how far the response had progressed. Gateways reached through `ANTHROPIC_BEDROCK_BASE_URL`, `ANTHROPIC_VERTEX_BASE_URL`, or `ANTHROPIC_FOUNDRY_BASE_URL` aren’t wrapped by this byte-level watchdog, even when they relay the Anthropic Messages format; there, a [5-minute idle timeout](</docs/en/env-vars>) aborts a silent stream instead, and on `ANTHROPIC_BEDROCK_BASE_URL` connections you can add the byte watchdog with [`CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`](</docs/en/env-vars>). ###
modified Roll out an LLM gateway for your organization View current →
--- a/llm-gateway-rollout.md +++ b/llm-gateway-rollout.md @@ -27,7 +27,7 @@ Whichever product provides the gateway, it must: * **Accept a supported API format** : one of the formats in the [API formats table](</docs/en/llm-gateway-protocol#api-formats>). The rollout steps below assume the Anthropic Messages API at `POST /v1/messages`, which most gateways serve - * **Stream responses** : pass server-sent events through as they arrive instead of buffering the whole response + * **Stream responses** : pass server-sent events through as they arrive, including keep-alive pings, instead of buffering the whole response; [streaming](</docs/en/llm-gateway-protocol#streaming>) covers what buffering or stripped pings break * **Route Claude model names** : map each name developers use to an upstream model. Claude Code sends a model name such as `claude-sonnet-4-6` in each request; in most gateway products the mapping is a model list or routing table in the gateway’s own configuration * **Forward headers and body unchanged** : pass `anthropic-beta`, `anthropic-version`, and the request body through in both directions; the [feature pass-through table](</docs/en/llm-gateway-protocol#feature-pass-through>) maps each to the feature that breaks without it * **Return upstream errors unmodified** : Claude Code’s automatic recovery matches on error wording, so wrapping errors in the gateway’s own envelope breaks it
modified Connect Claude Code to tools via MCP View current →
--- a/mcp.md +++ b/mcp.md @@ -159,7 +159,7 @@ * managed settings * settings passed with `--settings` -Approvals in an untracked `.claude/settings.local.json` also apply, but only after you accept a trust dialog for that folder or one of its parent directories: Claude Code runs git to check whether the file is tracked, and it runs that check only in a trusted folder. In a folder you’ve never trusted, the file’s approvals wait for the trust dialog unless the folder is your own configuration home: your home directory, or a directory whose `.claude` you’ve set as [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>). Before v2.1.207, an untracked `.claude/settings.local.json` approved servers in a folder you’d never trusted. A `disabledMcpjsonServers` entry in any settings file still rejects the server. The `/mcp` panel shows the tool count next to each connected server and flags servers that advertise the tools capability but expose no tools. A remote server whose configuration has an empty `url` shows as `not configured` in `/mcp`, in `claude mcp list`, and in the [`/plugin`](</docs/en/plugins>) manager, and Claude Code doesn’t attempt to connect to it. A plugin can include a placeholder entry like this for a connector you configure later, so Claude Code doesn’t report it as an error or a setup issue. The server’s detail view in `/mcp` reads `No URL configured for this server`; set the entry’s `url` to connect it. Before v2.1.208, Claude Code reported an empty `url` as a configuration issue with a prompt to reconnect. If your request needs tools from a server that is still connecting in the background, Claude waits for that server before continuing. With tool search enabled, which is the default, the wait happens inside the `ToolSearch` call. In configurations without tool search, such as a custom `ANTHROPIC_BASE_URL`, `ENABLE_TOOL_SEARCH=false`, or a model earlier than the Claude 4.5 generation on Google Cloud’s Agent Platform, Claude uses the `WaitForMcpServers` tool instead. A Microsoft Foundry [deployment hosted on Azure](<https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#hosting-options>) starts on the tool-search path rather than with `WaitForMcpServers`, since Claude Code discovers the deployment’s server-side rejection only from the API; after Claude Code switches that deployment to upfront loading, tools from a server that finishes connecting become available on Claude’s next request. Some server names are reserved for Claude Code’s built-in servers: `workspace`, `claude-in-chrome`, `computer-use`, `Claude Preview`, and `Claude Browser`. If your configuration defines a server with a reserved name, Claude Code skips it at load time and shows a warning asking you to rename it. `claude mcp add` rejects a reserved name with an error. `Claude Preview` and `Claude Browser` both name the built-in server that the [Claude Code desktop app’s preview pane](</docs/en/desktop#preview-your-app>) uses. Before v2.1.205, `Claude Browser` wasn’t reserved, so a user-configured server could register under that name. +Approvals in an untracked `.claude/settings.local.json` also apply, but only after you accept a trust dialog for that folder or one of its parent directories: Claude Code runs git to check whether the file is tracked, and it runs that check only in a trusted folder. In a folder you’ve never trusted, the file’s approvals wait for the trust dialog unless the folder is your own configuration home: your home directory, or a directory whose `.claude` you’ve set as [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>). Before v2.1.207, an untracked `.claude/settings.local.json` approved servers in a folder you’d never trusted. A `disabledMcpjsonServers` entry in any settings file still rejects the server. The `/mcp` panel shows the tool count next to each connected server and flags servers that advertise the tools capability but expose no tools. In `/mcp`, a server’s menu, and the [`/plugin`](</docs/en/plugins>) manager, a remote (HTTP or SSE) server you’ve used before can show a `cached` status such as `cached 2h ago · connects on first use · 5 tools`. Claude Code loaded the server’s tool list from a previous session instead of connecting at startup, and it connects the server the first time Claude calls one of its tools. The tools are available from your first message, so you don’t need to do anything. To make every server connect at startup instead, set [`MCP_DISCOVERY_CACHE=0`](</docs/en/env-vars>). The discovery cache and its `cached` status require Claude Code v2.1.221 or later. A remote server whose configuration has an empty `url` shows as `not configured` in `/mcp`, in `claude mcp list`, and in the [`/plugin`](</docs/en/plugins>) manager, and Claude Code doesn’t attempt to connect to it. A plugin can include a placeholder entry like this for a connector you configure later, so Claude Code doesn’t report it as an error or a setup issue. The server’s detail view in `/mcp` reads `No URL configured for this server`; set the entry’s `url` to connect it. Before v2.1.208, Claude Code reported an empty `url` as a configuration issue with a prompt to reconnect. If your request needs tools from a server that is still connecting in the background, Claude waits for that server before continuing. With tool search enabled, which is the default, the wait happens inside the `ToolSearch` call. In configurations without tool search, such as a custom `ANTHROPIC_BASE_URL`, `ENABLE_TOOL_SEARCH=false`, or a model earlier than the Claude 4.5 generation on Google Cloud’s Agent Platform, Claude uses the `WaitForMcpServers` tool instead. A Microsoft Foundry [deployment hosted on Azure](<https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#hosting-options>) starts on the tool-search path rather than with `WaitForMcpServers`, since Claude Code discovers the deployment’s server-side rejection only from the API; after Claude Code switches that deployment to upfront loading, tools from a server that finishes connecting become available on Claude’s next request. Some server names are reserved for Claude Code’s built-in servers: `workspace`, `claude-in-chrome`, `computer-use`, `Claude Preview`, and `Claude Browser`. If your configuration defines a server with a reserved name, Claude Code skips it at load time and shows a warning asking you to rename it. `claude mcp add` rejects a reserved name with an error. `Claude Preview` and `Claude Browser` both name the built-in server that the [Claude Code desktop app’s preview pane](</docs/en/desktop#preview-your-app>) uses. Before v2.1.205, `Claude Browser` wasn’t reserved, so a user-configured server could register under that name. ### @@ -269,7 +269,7 @@ **Plugin MCP features** : * **Automatic lifecycle** : servers connect and disconnect at these points: - * At session startup, Claude Code connects the servers for enabled plugins automatically + * At session startup, Claude Code connects the servers for enabled plugins automatically. In `/mcp`, a remote (HTTP or SSE) plugin server you’ve used before can show the `cached` status instead; Claude Code connects it when Claude first calls one of its tools * If you enable or disable a plugin during a session, run `/reload-plugins` to connect or disconnect its MCP servers. When you reload, Claude Code keeps the live connections of plugin servers whose configuration is unchanged, and does the same when you [replace the session’s MCP server list](</docs/en/agent-sdk/typescript#mcpsetserversresult>) from the Agent SDK without naming them. Before v2.1.210, Claude Code disconnected plugin-provided MCP servers that the new SDK server list didn’t name * In [web sessions](</docs/en/claude-code-on-the-web>), an MCP call to a plugin server that isn’t connected yet, such as right after an idle session wakes, starts the server on demand and waits for it to connect. Before v2.1.211, plugin servers in a web session reconnected only when the next message started a turn, so MCP calls after an idle session woke failed until then * **Path placeholders** : `${CLAUDE_PLUGIN_ROOT}` resolves to the plugin’s installation directory, `${CLAUDE_PLUGIN_DATA}` to its [persistent state](</docs/en/plugins-reference#persistent-data-directory>) directory, and `${CLAUDE_PROJECT_DIR}` to the stable project root. Substitution applies to: @@ -498,7 +498,7 @@ Authenticate with remote MCP servers -Many cloud-based MCP servers require authentication. Claude Code supports OAuth 2.0 for secure connections. Claude Code marks a remote server as needing authentication when the server responds with `401 Unauthorized` or `403 Forbidden`. For a server you haven’t signed in to, either status code flags it in `/mcp` so you can complete the OAuth flow. When a request to an OAuth server you already signed in to returns `401 Unauthorized`, Claude Code refreshes the stored token, reconnects, and retries the request once. It flags the server in `/mcp` only if that retry also fails. Before v2.1.206, a token refresh that failed for a transient reason, such as a network error, flagged an OAuth server as needing authentication for the rest of the session even though its refresh token was still valid. As of v2.1.195, when a token refresh fails because the server rejects the stored refresh token, Claude Code immediately shows a notice pointing at `/mcp`. The connected server’s menu there offers Re-authenticate, so you can sign in again before the next tool call fails. A custom server that returns a `WWW-Authenticate` header pointing to its authorization server gets the same automatic discovery as any other remote server. Claude Code also shows a startup notice when one or more configured servers need authentication, so you don’t have to open `/mcp` to discover which servers need sign-in. The notice requires Claude Code v2.1.193 or later. It counts only servers you can sign in to from Claude Code. Before v2.1.218, it also counted claude.ai connectors that weren’t connected in claude.ai, which you can connect only from claude.ai settings. In non-interactive mode there’s no `/mcp` panel, so Claude Code can’t run the OAuth flow for you. As of v2.1.196, when a configured server needs authentication during a `claude -p` or Agent SDK run with tool search enabled, which is the default, Claude Code tells Claude that the server’s tools are unavailable until you authorize it. Claude can then name the server that needs sign-in instead of responding as if the server weren’t configured. Complete the sign-in from an interactive session with `/mcp` or `claude mcp login <name>`. If you configured `headers.Authorization` for the server and the server rejects that header, Claude Code reports the connection as failed instead of falling back to OAuth. Check that the token is valid for the MCP endpoint, or remove the header to use the OAuth flow. +Many cloud-based MCP servers require authentication. Claude Code supports OAuth 2.0 for secure connections. Claude Code marks a remote server as needing authentication when the server responds with `401 Unauthorized` or `403 Forbidden`. For a server you haven’t signed in to, either status code flags it in `/mcp` so you can complete the OAuth flow. For a claude.ai connector, a `401` caused by claude.ai rejecting your session token doesn’t flag the connector this way, because re-authorizing the connector can’t fix your login; Claude Code shows the [session-token-rejected state](</docs/en/errors#claude-ai-rejected-the-session-token>) instead. When a request to an OAuth server you already signed in to returns `401 Unauthorized`, Claude Code refreshes the stored token, reconnects, and retries the request once. It flags the server in `/mcp` only if that retry also fails. Before v2.1.206, a token refresh that failed for a transient reason, such as a network error, flagged an OAuth server as needing authentication for the rest of the session even though its refresh token was still valid. As of v2.1.195, when a token refresh fails because the server rejects the stored refresh token, Claude Code immediately shows a notice pointing at `/mcp`. The connected server’s menu there offers Re-authenticate, so you can sign in again before the next tool call fails. A custom server that returns a `WWW-Authenticate` header pointing to its authorization server gets the same automatic discovery as any other remote server. Claude Code also shows a startup notice when one or more configured servers need authentication, so you don’t have to open `/mcp` to discover which servers need sign-in. The notice requires Claude Code v2.1.193 or later. It counts only servers you can sign in to from Claude Code. Before v2.1.218, it also counted claude.ai connectors that weren’t connected in claude.ai, which you can connect only from claude.ai settings. In non-interactive mode there’s no `/mcp` panel, so Claude Code can’t run the OAuth flow for you. As of v2.1.196, when a configured server needs authentication during a `claude -p` or Agent SDK run with tool search enabled, which is the default, Claude Code tells Claude that the server’s tools are unavailable until you authorize it. Claude can then name the server that needs sign-in instead of responding as if the server weren’t configured. Complete the sign-in from an interactive session with `/mcp` or `claude mcp login <name>`. If you configured `headers.Authorization` for the server and the server rejects that header, Claude Code reports the connection as failed instead of falling back to OAuth. Check that the token is valid for the MCP endpoint, or remove the header to use the OAuth flow. 1 @@ -813,7 +813,18 @@ Servers from claude.ai appear in the list with indicators showing they come from claude.ai. -From v2.1.161, connectors you have never signed in to are collapsed behind a `Show unused connectors` row at the end of the claude.ai section, so an organization-provisioned list doesn’t fill the panel. Select the row to expand them. A connector you signed in to before stays visible even when it currently needs re-authentication. Connectors from claude.ai are fetched only when your active [authentication method](</docs/en/authentication#authentication-precedence>) is a claude.ai subscription login. They aren’t loaded when `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, `apiKeyHelper`, or a third-party provider such as Amazon Bedrock or Google Cloud’s Agent Platform is active, even if you previously ran `/login`. They also aren’t loaded when `CLAUDE_CODE_OAUTH_TOKEN` holds a token from [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>), which can only make model requests. If `/mcp` doesn’t list a connector you added, run `/status` to confirm which authentication method is active, unset that environment variable or remove the `apiKeyHelper` setting, then run `/login` to select your claude.ai account. A server you’ve added in Claude Code takes precedence over a claude.ai connector that points at the same URL. When this happens, `/mcp` lists the connector as hidden and shows how to remove the duplicate if you’d rather use the connector. Some Anthropic-hosted connectors, such as Microsoft 365, Gmail, and Google Calendar, don’t support local OAuth from Claude Code because the upstream identity provider only accepts the redirect URL that claude.ai registered. From v2.1.162, authenticating one of these hosts in `/mcp` shows a message directing you to connect it at Settings → Connectors on claude.ai instead. Once connected there, the connector appears in Claude Code automatically. +From v2.1.161, connectors you have never signed in to are collapsed behind a `Show unused connectors` row at the end of the claude.ai section, so an organization-provisioned list doesn’t fill the panel. Select the row to expand them. A connector you signed in to before stays visible even when it currently needs re-authentication. Connectors from claude.ai are fetched only when your active [authentication method](</docs/en/authentication#authentication-precedence>) is a claude.ai subscription login. They aren’t loaded, even if you previously ran `/login`, when: + + * `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, or `apiKeyHelper` is active + * A third-party provider such as Amazon Bedrock or Google Cloud’s Agent Platform is active + * `CLAUDE_CODE_OAUTH_TOKEN` holds a token from [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>), which can only make model requests + +If `/mcp` doesn’t list a connector you added, run `/status` to confirm which authentication method is active, unset that environment variable or remove the `apiKeyHelper` setting, then run `/login` to select your claude.ai account. If `/mcp` shows a connector as `connected · session token rejected`, or its detail view shows [`claude.ai rejected the session token`](</docs/en/errors#claude-ai-rejected-the-session-token>), claude.ai rejected the token from your Claude Code login, usually because the login expired and couldn’t be refreshed. Authorizing the connector again doesn’t clear this state, because the connector’s own authorization in claude.ai isn’t what was rejected. To clear it: + + 1. Run `/login` to sign in again. + 2. Reconnect the connector from `/mcp`. + +Before v2.1.222, Claude Code marked connectors as needing authentication instead, and authorizing them didn’t resolve it. A server you’ve added in Claude Code takes precedence over a claude.ai connector that points at the same URL. When this happens, `/mcp` lists the connector as hidden and shows how to remove the duplicate if you’d rather use the connector. Some Anthropic-hosted connectors, such as Microsoft 365, Gmail, and Google Calendar, don’t support local OAuth from Claude Code because the upstream identity provider only accepts the redirect URL that claude.ai registered. From v2.1.162, authenticating one of these hosts in `/mcp` shows a message directing you to connect it at Settings → Connectors on claude.ai instead. Once connected there, the connector appears in Claude Code automatically. ### @@ -1115,7 +1126,7 @@ } } -The `alwaysLoad` field is available on all server types and requires Claude Code v2.1.121 or later. An MCP server can also mark individual tools as always-loaded by including `"anthropic/alwaysLoad": true` in the tool’s `_meta` object, which has the same effect for that tool only. Setting `alwaysLoad: true` also blocks startup until the server connects, capped at the standard 5-second connect timeout. This applies even though MCP startup is otherwise [non-blocking by default](</docs/en/env-vars>), since the tools must be present when the first prompt is built. Other servers continue to connect in the background. +The `alwaysLoad` field is available on all server types and requires Claude Code v2.1.121 or later. An MCP server can also mark individual tools as always-loaded by including `"anthropic/alwaysLoad": true` in the tool’s `_meta` object, which has the same effect for that tool only. Setting `alwaysLoad: true` also makes startup wait for the server’s tools, capped at the standard 5-second connect timeout, since they must be present when the first prompt is built. A remote server with a valid `cached` entry supplies its tools from the cache without connecting, so it doesn’t hold startup. Other servers connect in the background by default; set [`MCP_CONNECTION_NONBLOCKING=0`](</docs/en/env-vars>) to make startup wait for them too. ##
modified Connect to MCP servers View current →
--- a/mcp-quickstart.md +++ b/mcp-quickstart.md @@ -299,7 +299,7 @@ Status shows Failed to connect or Connection error -Both statuses mean the server didn’t start or the URL didn’t respond. They can also appear for HTTP servers that expect a token rather than the browser sign-in covered in Connect a server that requires sign-in.As of v2.1.191, an HTTP server that returns `404 Not Found` shows `MCP endpoint not found at <url>. Check the URL in your MCP config.` when you select the server in `/mcp`, with the URL Claude Code tried. Earlier versions show a generic `Error POSTing to endpoint` message without the URL. Compare the URL to the server’s documented MCP endpoint path, then run `claude mcp remove <name>` and re-add with the correct URL.For HTTP servers, confirm the URL is reachable from your machine: +Both statuses mean the server didn’t start or the URL didn’t respond. They can also appear for HTTP servers that reject the token you configured in `headers.Authorization`; a server that wants a token you haven’t configured shows `! Needs authentication` instead, covered in Connect a server that requires sign-in.An HTTP server that returns `404 Not Found` shows `MCP endpoint not found at <url>. Check the URL in your MCP config.` when you select the server in `/mcp`. The message shows the URL’s origin, such as `https://mcp.example.com`, without its path, so run `claude mcp get <name>` to see the full URL you configured. Compare its path to the server’s documented MCP endpoint path, then run `claude mcp remove <name>` and re-add with the correct URL. Before v2.1.191, Claude Code showed a generic `Error POSTing to endpoint` message without the URL.For HTTP servers, confirm the URL is reachable from your machine: curl -I https://mcp.sentry.dev/mcp
modified How Claude remembers your project View current →
--- a/memory.md +++ b/memory.md @@ -432,7 +432,7 @@ Instructions seem lost after `/compact` -Project-root CLAUDE.md survives compaction: after `/compact`, Claude re-reads it from disk and re-injects it into the session. Nested CLAUDE.md files in subdirectories are not re-injected automatically; they reload the next time Claude reads a file in that subdirectory. If an instruction disappeared after compaction, it was either given only in conversation or lives in a nested CLAUDE.md that hasn’t reloaded yet. Add conversation-only instructions to CLAUDE.md to make them persist. See [What survives compaction](</docs/en/context-window#what-survives-compaction>) for the full breakdown. See Write effective instructions for guidance on size, structure, and specificity. +Project-root CLAUDE.md survives compaction: after `/compact`, Claude re-reads it from disk and re-injects it into the session. Nested CLAUDE.md files in subdirectories and rules with `paths:` frontmatter are not re-injected automatically; they reload the next time Claude reads a file in that subdirectory or a file matching the rule’s patterns. If an instruction disappeared after compaction, it was given only in conversation, lives in a nested CLAUDE.md that hasn’t reloaded yet, or is a path-scoped rule that hasn’t matched a file since. Add conversation-only instructions to CLAUDE.md to make them persist. See [What survives compaction](</docs/en/context-window#what-survives-compaction>) for the full breakdown. See Write effective instructions for guidance on size, structure, and specificity. ##
modified Model configuration View current →
--- a/model-config.md +++ b/model-config.md @@ -85,7 +85,7 @@ * `Enter`: switch model and save as your default * `s`: switch model for this session only -Typing `/model <name>` directly behaves like `Enter`. A model set with `/model` in [non-interactive mode](</docs/en/headless>), with the `-p` flag, applies to the current session only and isn’t saved as your default. Project and managed settings still take precedence and reapply on the next launch. An organization default model that your admin has configured to override user selection also reapplies on the next launch. In v2.1.144 through v2.1.152, `/model` applied to the current session only and `d` in the picker saved a default. The `--model` flag and `ANTHROPIC_MODEL` environment variable apply only to the session you launch with them. To run different models in different terminals at the same time, launch each one with its own `--model` flag rather than switching with `/model`. Prices in the `/model` picker appear when Claude Code talks to the Anthropic API, directly or through an [LLM gateway](</docs/en/llm-gateway>) that proxies it, and the price on a row is the price of the model that row selects. On [third-party providers](</docs/en/third-party-integrations>) such as Amazon Bedrock and on the [Claude apps gateway](</docs/en/claude-apps-gateway>), your provider or gateway determines what you pay, so picker rows show no price. The price is a display label only; it doesn’t affect which model a row selects or what your provider bills. Before v2.1.206, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) and gateway sessions showed Anthropic list prices, and a row could show the price of a different model than the one it selected. Resumed sessions started with `claude --resume`, `--continue`, or the `/resume` picker keep the model they were using when the transcript was saved, regardless of the current `model` setting. If the restored model has been retired or is excluded by `availableModels`, the session falls through to the normal precedence order. This prevents another session’s `/model` choice from changing the model on resume. On providers that use provider-specific deployment IDs rather than Anthropic model IDs, such as Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, the transcript model isn’t restored at all and the session resolves its model through the normal precedence order. A model you pick for the new launch with `--model` or `ANTHROPIC_MODEL` still takes precedence over the restored model. As of v2.1.195, so does an `ANTHROPIC_DEFAULT_OPUS_MODEL` family variable. When the active model at startup comes from project or managed settings rather than your own selection, the startup header shows which settings file set it. Run `/model` to override; the project or managed setting reapplies on the next launch. When a model switch is requested through the [Agent SDK](</docs/en/agent-sdk/overview>) `setModel()` method or by an app such as the [Desktop app](</docs/en/desktop>) that runs the Claude Code CLI for you, Claude Code checks that the string is one it recognizes before saving it. This check requires Claude Code v2.1.200 or later. On the Anthropic API, Claude Code recognizes: +Typing `/model <name>` directly behaves like `Enter`. A model set with `/model` in [non-interactive mode](</docs/en/headless>), with the `-p` flag, applies to the current session only and isn’t saved as your default. Project and managed settings still take precedence and reapply on the next launch. An organization default model that your admin has configured to override user selection also reapplies on the next launch. In v2.1.144 through v2.1.152, `/model` applied to the current session only and `d` in the picker saved a default. The `--model` flag and `ANTHROPIC_MODEL` environment variable apply only to the session you launch with them. To run different models in different terminals at the same time, launch each one with its own `--model` flag rather than switching with `/model`. Prices in the `/model` picker appear when Claude Code talks to the Anthropic API, directly or through an [LLM gateway](</docs/en/llm-gateway>) that proxies it, and the price on a row is the price of the model that row selects. On [third-party providers](</docs/en/third-party-integrations>) such as Amazon Bedrock and on the [Claude apps gateway](</docs/en/claude-apps-gateway>), your provider or gateway determines what you pay, so picker rows show no price. The price is a display label only; it doesn’t affect which model a row selects or what your provider bills. Before v2.1.206, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) and gateway sessions showed Anthropic list prices, and a row could show the price of a different model than the one it selected. Resumed sessions started with `claude --resume`, `--continue`, or the `/resume` picker keep the model they were using when the transcript was saved, regardless of the current `model` setting. If the restored model has been retired or is excluded by `availableModels`, the session falls through to the normal precedence order. This prevents another session’s `/model` choice from changing the model on resume. On providers that use provider-specific deployment IDs rather than Anthropic model IDs, such as Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, the transcript model isn’t restored at all and the session resolves its model through the normal precedence order. A model you pick for the new launch with `--model` or `ANTHROPIC_MODEL` still takes precedence over the restored model. As of v2.1.195, so does an `ANTHROPIC_DEFAULT_OPUS_MODEL` family variable. When the active model at startup comes from project or managed settings rather than your own selection, the startup header shows which settings file set it. Run `/model` to override; the project or managed setting reapplies on the next launch. On platforms that embed Claude Code and set [`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`](</docs/en/env-vars>), the host’s model configuration takes precedence over managed model settings, while a managed `availableModels` allowlist stays in force unless the host supplies its own; the key-level enumeration is under [Settings precedence](</docs/en/settings#settings-precedence>). When a model switch is requested through the [Agent SDK](</docs/en/agent-sdk/overview>) `setModel()` method or by an app such as the [Desktop app](</docs/en/desktop>) that runs the Claude Code CLI for you, Claude Code checks that the string is one it recognizes before saving it. This check requires Claude Code v2.1.200 or later. On the Anthropic API, Claude Code recognizes: * a model alias * an entry from the `/model` picker @@ -115,21 +115,22 @@ Restrict model selection -Enterprise administrators can use `availableModels` in [managed or policy settings](</docs/en/settings#settings-files>) to restrict which models users can select. Entries match a model family such as `sonnet`, a version prefix such as `claude-sonnet-4-5`, or a full model ID such as `claude-sonnet-4-5-20250929`. When `availableModels` is set, the allowlist applies everywhere a user can specify a model: +Enterprise administrators can use `availableModels` in [managed or policy settings](</docs/en/settings#settings-files>) to restrict which models users can select. Entries match a model family such as `sonnet`, a version prefix such as `claude-sonnet-4-5`, or a full model ID such as `claude-sonnet-4-5-20250929`. On platforms that embed Claude Code and set [`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`](</docs/en/env-vars>), the host’s model configuration takes precedence over managed model settings, while a managed `availableModels` allowlist stays in force unless the host supplies its own; the key-level enumeration is under [Settings precedence](</docs/en/settings#settings-precedence>). When `availableModels` is set, the allowlist applies everywhere a user can specify a model: * **Main session model** : `/model`, the `--model` flag, the `ANTHROPIC_MODEL` environment variable, the `model` setting, and the model restored when resuming a session * **Alias resolution** : the `ANTHROPIC_DEFAULT_OPUS_MODEL`, `ANTHROPIC_DEFAULT_SONNET_MODEL`, `ANTHROPIC_DEFAULT_HAIKU_MODEL`, and `ANTHROPIC_DEFAULT_FABLE_MODEL` environment variables cannot redirect an allowed alias to a model outside the list * **Fast mode** : `/fast` refuses to toggle when it would implicitly switch to an Opus model outside the list, with the message “is not in your organization’s allowed models” - * **Subagent models** : the `model` field in [subagent](</docs/en/sub-agents#choose-a-model>) frontmatter, the Agent tool’s `model` parameter, `CLAUDE_CODE_SUBAGENT_MODEL`, and, on v2.1.197 and earlier, the model picker in the `/agents` wizard + * **Subagent and teammate models** : the `model` field in [subagent](</docs/en/sub-agents#choose-a-model>) frontmatter, the Agent tool’s `model` parameter, [agent team](</docs/en/agent-teams#specify-teammates-and-models>) teammate models including the `teammateDefaultModel` setting, `CLAUDE_CODE_SUBAGENT_MODEL`, and, on v2.1.197 and earlier, the model picker in the `/agents` wizard * **Skill and command models** : the `model` frontmatter in [skills and commands](</docs/en/skills>) * **Advisor model** : the configured [`advisorModel`](</docs/en/advisor>) setting and the `--advisor` flag * **Background agent model** : the model selected in the [dispatch picker](</docs/en/agent-view>) -On the Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), a model family alias, `opus`, `sonnet`, `haiku`, or `fable`, resolves to the newest version of its family that the allowlist permits. When the allowlist pins specific versions, for example `["sonnet", "claude-opus-4-6"]`, both `/model opus` and `--model opus` select Claude Opus 4.6, the newest permitted Opus, and show a notice naming both the requested and substituted models. Before v2.1.205, an alias whose newest released version was outside the list was rejected or replaced like any other blocked selection, even when the list permitted an older version. Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and [Mantle](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) use provider-specific deployment IDs rather than Anthropic model IDs, so a blocked alias there follows the rejection and replacement behavior below. Claude Code handles any other blocked selection according to where the model was set: +On the Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), a model family alias, `opus`, `sonnet`, `haiku`, or `fable`, resolves to the newest version of its family that the allowlist permits. When the allowlist pins specific versions, for example `["sonnet", "claude-opus-4-6"]`, both `/model opus` and `--model opus` select Claude Opus 4.6, the newest permitted Opus, and show a notice naming both the requested and substituted models. Before v2.1.205, an alias whose newest released version was outside the list was rejected or replaced like any other blocked selection, even when the list permitted an older version. The substitution needs a permitted version to land on: when the allowlist permits no version of the alias’s family, the alias follows the rejection and replacement behavior below like any other blocked value. Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and [Mantle](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) use provider-specific deployment IDs rather than Anthropic model IDs, so a blocked alias there follows the same behavior below. Claude Code handles any other blocked selection according to where the model was set: * **`/model`** : the switch is rejected with an error * **`--model` flag, `ANTHROPIC_MODEL`, or the `model` setting**: the value is replaced at startup with a warning naming both the requested and substituted models, and the session starts on the default model - * **Subagent, skill, or command override** : the override falls back to the inherited or default model rather than failing the request + * **Subagent or teammate override** : the override falls back to the [subagent’s inherited model](</docs/en/sub-agents#choose-a-model>) or the [default teammate model](</docs/en/agent-teams#specify-teammates-and-models>) rather than failing the request. When the blocked value is the **Default teammate model** setting itself, Claude Code runs the teammate on your provider’s default Opus model, or on the lead’s model when the allowlist blocks that too. On the Anthropic API and Claude Platform on AWS, a blocked family alias instead follows the substitution above, so the subagent or teammate runs on the newest permitted version of its family; on the providers with provider-specific IDs, the alias falls back like any other blocked value. Before v2.1.222, a blocked family alias fell back like any other blocked value on every provider + * **Skill or command override** : Claude Code ignores the override, including a blocked family alias, and the skill or command runs on the session model * **`advisorModel` setting**: the advisor is disabled for the session * **`--advisor` flag**: Claude Code exits with an error at launch @@ -220,7 +221,7 @@ Merge behavior -When the [highest-precedence managed settings source](</docs/en/server-managed-settings#settings-precedence>) defines `availableModels`, that list alone applies: entries in user, project, or local settings cannot extend it, and admin-deployed managed sources do not merge with each other, so a list deployed in a managed settings file is ignored when server-managed settings deliver any keys. Otherwise, lists from user, project, and local settings are [concatenated and deduplicated](</docs/en/settings#settings-precedence>) like other array settings. As of Claude Code v2.1.175, the managed list replaces lower-precedence entries; earlier versions merge them. Within the effective list, an entry naming a specific model in a family, whether a version prefix or a full model ID, disables that family’s wildcard entry: `["sonnet", "claude-sonnet-4-5"]` allows only Sonnet 4.5 versions, not every Sonnet model. +When the [highest-precedence managed settings source](</docs/en/server-managed-settings#settings-precedence>) defines `availableModels`, that list alone applies, apart from a [host platform that supplies its own](</docs/en/settings#settings-precedence>): entries in user, project, or local settings cannot extend it, and admin-deployed managed sources do not merge with each other, so a list deployed in a managed settings file is ignored when server-managed settings deliver any keys. Otherwise, lists from user, project, and local settings are [concatenated and deduplicated](</docs/en/settings#settings-precedence>) like other array settings. As of Claude Code v2.1.175, the managed list replaces lower-precedence entries; earlier versions merge them. Within the effective list, an entry naming a specific model in a family, whether a version prefix or a full model ID, disables that family’s wildcard entry: `["sonnet", "claude-sonnet-4-5"]` allows only Sonnet 4.5 versions, not every Sonnet model. ### @@ -619,7 +620,7 @@ Override model IDs per version -The family-level environment variables above configure one model ID per family alias. If you need to map several versions within the same family to distinct provider IDs, use the `modelOverrides` setting instead. `modelOverrides` maps individual Anthropic model IDs to the provider-specific strings that Claude Code sends to your provider’s API. When a user selects a mapped model in the `/model` picker, Claude Code uses your configured value instead of the built-in default. This lets enterprise administrators route each model version to a specific Amazon Bedrock inference profile ARN, Google Cloud’s Agent Platform version name, or Microsoft Foundry deployment name for governance, cost allocation, or regional routing. Set `modelOverrides` in your [settings file](</docs/en/settings#settings-files>): +On platforms that embed Claude Code and set [`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`](</docs/en/env-vars>), the host’s model configuration takes precedence over managed model settings, while a managed `availableModels` allowlist stays in force unless the host supplies its own; the key-level enumeration is under [Settings precedence](</docs/en/settings#settings-precedence>). The family-level environment variables above configure one model ID per family alias. If you need to map several versions within the same family to distinct provider IDs, use the `modelOverrides` setting instead. `modelOverrides` maps individual Anthropic model IDs to the provider-specific strings that Claude Code sends to your provider’s API. When a user selects a mapped model in the `/model` picker, Claude Code uses your configured value instead of the built-in default. This lets enterprise administrators route each model version to a specific Amazon Bedrock inference profile ARN, Google Cloud’s Agent Platform version name, or Microsoft Foundry deployment name for governance, cost allocation, or regional routing. Set `modelOverrides` in your [settings file](</docs/en/settings#settings-files>): { "modelOverrides": {
modified Monitoring View current →
--- a/monitoring-usage.md +++ b/monitoring-usage.md @@ -540,8 +540,8 @@ * `skill.name`: Skill active for the request, set by the Skill tool, a `/` command, or inherited by a spawned subagent. Built-in, bundled, user-defined, and official-marketplace plugin skill names appear verbatim. Third-party plugin skill names are replaced with `"third-party"`. Absent when no skill is active. * `plugin.name`: Owning plugin when the active skill or subagent is provided by a plugin. Official-marketplace plugin names appear verbatim. Third-party plugin names are replaced with `"third-party"`. Absent when neither the skill nor the subagent has an owning plugin. * `marketplace.name`: Marketplace the owning plugin was installed from. Only emitted for official-marketplace plugins. Absent otherwise. - * `mcp_server.name`: MCP server whose tool ran in the turn that produced this request. Built-in, claude.ai-proxied, and official-registry server names appear verbatim. User-configured server names are replaced with `"custom"`. Absent when no MCP tool ran. - * `mcp_tool.name`: MCP tool that ran in the turn that produced this request, with the same redaction as `mcp_server.name`. Absent when no MCP tool ran. + * `mcp_server.name`: MCP server whose tool result this request consumed. Built-in, claude.ai-proxied, and official-registry server names appear verbatim. User-configured server names are replaced with `"custom"`. Absent when the request consumed no MCP tool result. Before v2.1.222, Claude Code set this attribute on every request after an MCP tool call, not only on requests that consumed a tool result, so dashboards that aggregate it show a step down after you upgrade. + * `mcp_tool.name`: MCP tool whose result this request consumed, with the same redaction and version behavior as `mcp_server.name`. Absent when the request consumed no MCP tool result. ####
modified Enterprise network configuration View current →
--- a/network-config.md +++ b/network-config.md @@ -153,9 +153,32 @@ ​ +Streaming idle watchdogs + +Claude Code runs three independent timers that abort a streaming model response when it goes quiet, so a dead connection fails and retries instead of hanging. Each timer watches a different signal: + +Timer| Aborts when| Runs on| Default timeout +---|---|---|--- +Event-level watchdog| No response events parse. On connections where the byte-level watchdog runs, arriving bytes, including keep-alive pings, also reset this watchdog, for up to about five minutes without a parsed event| Every provider| 300 seconds +Byte-level watchdog| No bytes arrive on the wire, including SSE keep-alive pings| Direct Anthropic API, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and [gateway](</docs/en/gateways>) connections, including a custom `ANTHROPIC_BASE_URL`. Opt-in on Amazon Bedrock `vnd.amazon.eventstream` responses with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1`; doesn’t run on Google Cloud’s Agent Platform or Microsoft Foundry| 180 seconds on the direct Anthropic API, 300 seconds elsewhere +Body idle timeout| No bytes arrive for 5 minutes| Providers other than the direct Anthropic API and Claude Platform on AWS, unless [`API_FORCE_IDLE_TIMEOUT`](</docs/en/env-vars>) changes that| 5 minutes + +Configure the timers with these variables, each detailed in the [environment variables reference](</docs/en/env-vars>): + + * `CLAUDE_ENABLE_STREAM_WATCHDOG` and `CLAUDE_ENABLE_BYTE_WATCHDOG` force the corresponding watchdog on with `1` or off with `0`, within the connections the table lists; neither variable extends a watchdog to a connection type it doesn’t cover. + * `CLAUDE_STREAM_IDLE_TIMEOUT_MS` sets both watchdogs’ timeout. Claude Code raises values below 5 minutes to 5 minutes, and caps the value at 30 minutes for the byte-level watchdog. + * `CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS` sets the byte-level watchdog’s timeout alone, clamped to between 10 seconds and 30 minutes, and takes precedence over `CLAUDE_STREAM_IDLE_TIMEOUT_MS` for that watchdog. + * `API_FORCE_IDLE_TIMEOUT` set to `0` turns the body idle timeout off, and set to `1` turns it on for every provider. The watchdogs run independently of it, so to let a stream pause longer than their thresholds, also raise or disable them. + +When a timer aborts a stalled stream, Claude Code handles it like any other mid-stream failure: it retries, keeps completed output with an [incomplete-response notice](</docs/en/errors#the-response-above-may-be-incomplete>), or ends the turn, depending on where the response stood. + +## + +​ + Network access requirements -Claude Code requires access to the following URLs. Allowlist these in your proxy configuration and firewall rules, especially in containerized or restricted network environments. +Claude Code requires access to the following URLs. Allowlist these in your proxy configuration and firewall rules, especially in containerized or restricted network environments. The first-run setup connectivity check points here when it can’t reach `api.anthropic.com` or `platform.claude.com`; see [Unable to connect to Anthropic services](</docs/en/errors#unable-to-connect-to-anthropic-services>) for the check’s messages and recovery steps. URL| Required for ---|---
modified Configure permissions View current →
--- a/permissions.md +++ b/permissions.md @@ -471,7 +471,7 @@ Managed settings -For organizations that need centralized control over Claude Code configuration, administrators can deploy managed settings that can’t be overridden by user or project settings. These policy settings follow the same format as regular settings files and can be delivered through MDM/OS-level policies, managed settings files, [server-managed settings](</docs/en/server-managed-settings>), or a self-hosted [Claude apps gateway](</docs/en/claude-apps-gateway>). See [settings files](</docs/en/settings#settings-files>) for delivery mechanisms and file locations. +For organizations that need centralized control over Claude Code configuration, administrators can deploy managed settings that can’t be overridden by user or project settings, apart from the exceptions listed in the [settings reference’s precedence section](</docs/en/settings#settings-precedence>). These policy settings follow the same format as regular settings files and can be delivered through MDM/OS-level policies, managed settings files, [server-managed settings](</docs/en/server-managed-settings>), or a self-hosted [Claude apps gateway](</docs/en/claude-apps-gateway>). See [settings files](</docs/en/settings#settings-files>) for delivery mechanisms and file locations. ### @@ -511,7 +511,7 @@ Permission rules follow the same [settings precedence](</docs/en/settings#settings-precedence>) as all other Claude Code settings: - 1. **Managed settings** : can’t be overridden by any other level, including command line arguments + 1. **Managed settings** : no other level, including command line arguments, can override a managed permission rule 2. **Command line arguments** : temporary session overrides 3. **Local project settings** (`.claude/settings.local.json`) 4. **Shared project settings** (`.claude/settings.json`)
modified Platforms and integrations View current →
--- a/platforms.md +++ b/platforms.md @@ -34,6 +34,7 @@ [GitLab CI/CD](</docs/en/gitlab-ci-cd>)| Same as GitHub Actions for GitLab| CI-driven automation on GitLab [Code Review](</docs/en/code-review>)| Reviews every PR automatically| Catching bugs before human review [Slack](</docs/en/slack>)| Responds to `@Claude` mentions in your channels| Turning bug reports into pull requests from team chat +[Claude Tag](</docs/en/claude-tag>)| Runs `@Claude` as your organization’s shared identity with admin-configured access| Shared team access on Team and Enterprise plans, instead of per-user Slack sessions For integrations not listed here, [MCP servers](</docs/en/mcp>) and [connectors](</docs/en/desktop#connect-external-tools>) let you connect almost anything: Linear, Notion, Google Drive, or your own internal APIs. @@ -86,6 +87,7 @@ * [GitLab CI/CD](</docs/en/gitlab-ci-cd>): the same for GitLab * [Code Review](</docs/en/code-review>): automatic review on every pull request * [Slack](</docs/en/slack>): send tasks from team chat, get PRs back + * [Claude Tag](</docs/en/claude-tag>): run `@Claude` as your organization’s shared identity on Team and Enterprise plans ###
modified Create and distribute a plugin marketplace View current →
--- a/plugin-marketplaces.md +++ b/plugin-marketplaces.md @@ -234,6 +234,7 @@ `repository`| string| Source code repository URL `license`| string| SPDX license identifier (for example, MIT, Apache-2.0) `keywords`| array| Tags for plugin discovery and categorization +`metadata`| object| Free-form object for your own fields, such as entitlement or catalog data. Claude Code doesn’t read it. Before v2.1.222, `claude plugin validate` reported the key as an unrecognized field. `category`| string| Plugin category for organization `tags`| array| Tags for searchability `strict`| boolean| Controls whether `plugin.json` is the authority for component definitions (default: true). See Strict mode below. @@ -1094,6 +1095,8 @@ * `Marketplace has no plugins defined`: add at least one plugin to the `plugins` array * `No marketplace description provided`: add a top-level `description` to help users understand your marketplace * `Plugin name "x" is not kebab-case`: the plugin name contains uppercase letters, spaces, or special characters. Rename to lowercase letters, digits, and hyphens only (for example, `my-plugin`). Claude Code accepts other forms, but the claude.ai marketplace sync rejects them. + * `Marketplace name "x" is reserved in Claude Desktop`: the marketplace is named `org`, `org-provisioned`, or `unknown`, in any casing. Claude Code accepts these names, but Claude Desktop’s managed marketplace sync rejects the whole marketplace. Rename the marketplace. Before v2.1.221, `claude plugin validate` didn’t run this check. + * `Marketplace name "x" is not accepted by Claude Desktop` or `Plugin name "x" is not accepted by Claude Desktop`: Claude Desktop accepts names of up to 128 characters made of letters, digits, `.`, `_`, and `-`, starting with a letter or digit. Claude Code accepts other forms, but Claude Desktop’s managed marketplace sync rejects a marketplace whose name fails the check and silently drops a plugin entry whose name does. Rename the marketplace or plugin. Before v2.1.221, `claude plugin validate` didn’t run these checks. ###
modified Plugins reference View current →
--- a/plugins-reference.md +++ b/plugins-reference.md @@ -394,6 +394,7 @@ "repository": "https://github.com/author/plugin", "license": "MIT", "keywords": ["keyword1", "keyword2"], + "metadata": { "catalogId": "cat-123", "tier": "pro" }, "skills": "./custom/skills/", "commands": ["./custom/commands/special.md"], "agents": ["./custom/agents/reviewer.md"], @@ -431,7 +432,12 @@ Unrecognized fields -Claude Code ignores top-level fields it does not recognize. You can keep metadata from another ecosystem in `plugin.json` and the plugin still loads. This makes it practical to maintain one manifest that doubles as a VS Code or Cursor extension manifest, an npm `package.json`, or an MCPB/DXT bundle manifest. `claude plugin validate` reports unrecognized fields as warnings, not errors. If a field is one or two characters off from a recognized one, the warning suggests the likely intended name. A plugin with only unrecognized-field warnings still passes validation and loads at runtime. Fields with the wrong type still fail. For example, a `keywords` value that is a string instead of an array is a load error, and `claude plugin validate` reports it as one. Pass `--strict` to treat warnings as errors. Use it in CI to catch a misspelled field name or a field left over from another tool’s manifest before publishing, even though the plugin would load at runtime. +Claude Code ignores top-level fields it does not recognize. You can keep metadata from another ecosystem in `plugin.json` and the plugin still loads. This makes it practical to maintain one manifest that doubles as a VS Code or Cursor extension manifest, an npm `package.json`, or an MCPB/DXT bundle manifest. `claude plugin validate` reports unrecognized fields as warnings, not errors. If a field is one or two characters off from a recognized one, the warning suggests the likely intended name. A plugin with only unrecognized-field warnings still passes validation and loads at runtime. How Claude Code handles a recognized field whose value has the wrong type depends on the field: + + * **Most fields** : the plugin fails to load. For example, a `keywords` value that is a string instead of an array is a load error, and `claude plugin validate` reports it as one. + * **`experimental` and `metadata`**: Claude Code ignores a non-object value, and `claude plugin validate` reports a warning. + +Pass `--strict` to treat warnings as errors. Use it in CI to catch a misspelled field name or a field left over from another tool’s manifest before publishing, even though the plugin would load at runtime. claude plugin validate ./my-plugin --strict @@ -452,6 +458,7 @@ `repository`| string| Source code URL| `"https://github.com/user/plugin"` `license`| string| License identifier| `"MIT"`, `"Apache-2.0"` `keywords`| array| Discovery tags| `["deployment", "ci-cd"]` +`metadata`| object| Free-form object for your own data, such as entitlement or catalog fields. Claude Code doesn’t read it, so the values never affect plugin behavior. Claude Code ignores a non-object value, and `claude plugin validate` reports it as a warning. Before v2.1.222, Claude Code treated the key as an unrecognized field.| `{"catalogId": "cat-123"}` `defaultEnabled`| boolean| Whether the plugin starts in an enabled state when the user has not set one. Defaults to `true`. See Default enablement. Requires Claude Code v2.1.154 or later.| `false` ### @@ -595,10 +602,14 @@ When a plugin has both a default folder and the matching manifest key, Claude Code v2.1.140 and later warns about the ignored folder in `claude plugin list` and the `/plugin` detail view. The plugin still loads using the manifest paths. Claude Code doesn’t warn when the manifest key points into the default folder, for example `"commands": ["./commands/deploy.md"]`, because that path names the folder explicitly. For all path fields: - * All paths must be relative to the plugin root and start with `./` + * All paths must be relative to the plugin root and start with `./`, except that the `skills` field also accepts `"."` + * Both `"."` and `"./"` denote the plugin root itself + * Before v2.1.221, `"."` failed manifest validation and the plugin didn’t load, so use `"./"` to support earlier versions * Components from custom paths use the same naming and namespacing rules * Multiple paths can be specified as arrays - * When a skill path points to a directory that contains a `SKILL.md` directly, for example `"skills": ["./"]` pointing to the plugin root, the frontmatter `name` field in `SKILL.md` determines the skill’s invocation name. This gives a stable name regardless of the install directory. If `name` is not set in the frontmatter, the directory basename is used as a fallback. + * A skill path can point to a directory that contains a `SKILL.md` directly, for example `"skills": ["."]` for the plugin root + * Claude Code takes the skill’s invocation name from the frontmatter `name` field in `SKILL.md`, so the name stays stable whatever the install directory is named + * If `name` isn’t set in the frontmatter, Claude Code falls back to the directory basename A plugin that has a `SKILL.md` at its root, no `skills/` subdirectory, and no `skills` manifest field is automatically loaded as a single-skill plugin in Claude Code v2.1.142 and later. You do not need to set `"skills": ["./"]` in `plugin.json` for this layout. The skill’s invocation name follows the same rule as above: the frontmatter `name` field, or the directory basename as a fallback. **Path examples** : @@ -1159,7 +1170,7 @@ Skills not appearing| Wrong directory structure| Ensure `skills/` or `commands/` is at the plugin root, not inside `.claude-plugin/` Hooks not firing| Script not executable| Run `chmod +x script.sh` MCP server fails| Missing `${CLAUDE_PLUGIN_ROOT}`| Use variable for all plugin paths -Path errors| Absolute paths used| All paths must be relative and start with `./` +Path errors| Absolute paths used| Make paths relative, starting with `./`; see Path behavior rules, which cover the `skills` field’s `"."` exception LSP `Executable not found in $PATH`| Language server not installed| Install the binary (e.g., `npm install -g typescript-language-server typescript`) ###
modified Agent SDK reference - Python View current →
--- a/python.md +++ b/python.md @@ -968,7 +968,7 @@ `plugins`| `list[SdkPluginConfig]`| `[]`| Load custom plugins from local paths. See [Plugins](</docs/en/agent-sdk/plugins>) for details `sandbox`| `SandboxSettings` ` | None`| `None`| Configure sandbox behavior programmatically. See Sandbox settings for details `setting_sources`| `list[SettingSource] | None`| `None` (CLI defaults: all sources)| Control which filesystem settings to load. Pass `[]` to disable user, project, and local settings. Endpoint-managed policy loads regardless; server-managed settings are fetched when the session authenticates with an organization credential on an [eligible configuration](</docs/en/server-managed-settings#platform-availability>). See [Use Claude Code features](</docs/en/agent-sdk/claude-code-features#what-settingsources-does-not-control>) -`skills`| `list[str] | Literal["all"] | None`| `None`| Skills available to the session. Pass `"all"` to enable every discovered skill, or a list of skill names. When set, the SDK adds the Skill tool to `allowed_tools` automatically. If you also pass `tools`, include `"Skill"` in that list. See [Skills](</docs/en/agent-sdk/skills>) +`skills`| `list[str] | Literal["all"] | None`| `None`| Skills available to the session. Pass `"all"` to enable every discovered skill, or a list of skill names. Pass exact names only. The SDK rejects malformed and wildcard-form names with a `ValueError` before starting the Claude Code process. When set, the SDK adds the Skill tool to `allowed_tools` automatically. If you also pass `tools`, include `"Skill"` in that list. See [Skills](</docs/en/agent-sdk/skills>) `max_thinking_tokens`| `int | None`| `None`| _Deprecated_ \- Maximum tokens for thinking blocks. Use `thinking` instead `thinking`| `ThinkingConfig` ` | None`| `None`| Controls extended thinking behavior. Takes precedence over `max_thinking_tokens` `effort`| `EffortLevel` ` | None`| `None`| Effort level for thinking depth. See [adjust the effort level](</docs/en/model-config#adjust-effort-level>) @@ -998,7 +998,7 @@ * `API_TIMEOUT_MS`: per-request timeout on the Anthropic client, in milliseconds. Default `600000`. Applies to the main loop and all subagents. * `CLAUDE_CODE_MAX_RETRIES`: maximum API retries. Default `10`, capped at `15`. Each retry gets its own `API_TIMEOUT_MS` window, so worst-case wall time is roughly `API_TIMEOUT_MS × (CLAUDE_CODE_MAX_RETRIES + 1)` plus backoff. For unattended runs that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG=1`: it retries capacity errors indefinitely, and as of Claude Code v2.1.199 raises the default for other transient errors to `300` and removes the cap on this variable. * `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`: stall watchdog for subagents launched with `run_in_background`. Default `600000`. Resets on each stream event; on stall it aborts the subagent, marks the task failed, and surfaces the error to the parent with any partial result. Does not apply to synchronous subagents. - * `CLAUDE_ENABLE_STREAM_WATCHDOG` with `CLAUDE_STREAM_IDLE_TIMEOUT_MS`: aborts the request when headers have arrived but the response body stops streaming. The watchdog is on by default for all providers; set `CLAUDE_ENABLE_STREAM_WATCHDOG=0` to disable it. `CLAUDE_STREAM_IDLE_TIMEOUT_MS` defaults to `300000` and is clamped to that minimum. After the abort, Claude Code retries the request at most once, and only before Claude has started a block of text or a tool call in the response; once Claude has completed a block of text or a tool call, Claude Code keeps the completed output, appends an [incomplete-response notice](</docs/en/errors#the-response-above-may-be-incomplete>) instead of retrying, and still runs any completed tool call. + * `CLAUDE_ENABLE_STREAM_WATCHDOG` with `CLAUDE_STREAM_IDLE_TIMEOUT_MS`: aborts the request when headers have arrived but the response body stops streaming. The watchdog is on by default for all providers; set `CLAUDE_ENABLE_STREAM_WATCHDOG=0` to disable it. `CLAUDE_STREAM_IDLE_TIMEOUT_MS` defaults to `300000` and is clamped to that minimum. After the abort, [Automatic retries](</docs/en/errors#automatic-retries>) covers what Claude Code does, based on how far the response had progressed. ###
modified Continue local sessions from any device with Remote Control View current →
--- a/remote-control.md +++ b/remote-control.md @@ -122,14 +122,14 @@ * **Scan the QR code** shown alongside the session URL to open it directly in the Claude app. With `claude remote-control`, press spacebar to toggle the QR code display. * **Open[claude.ai/code](<https://claude.ai/code>) or the Claude app** and find the session by name in the session list. In the Claude mobile app, tap **Code** in the navigation to reach the session list. Remote Control sessions show a computer icon with a green status dot when online. -When you connect, the device shows any subagents and workflows the session already has running in the background. Before v2.1.208, a device connecting to a session hosted in an interactive terminal didn’t show subagents and workflows that were already running until one of them started or stopped. Before v2.1.212, a device that joined mid-run didn’t show a running workflow’s agents until the next agent update. The remote session title is chosen in this order: +When you connect, the device shows any subagents and workflows the session already has running in the background. The remote session title is chosen in this order: 1. The name you passed to `--name`, `--remote-control`, or `/remote-control` 2. The title you set with `/rename` 3. The last meaningful message in existing conversation history 4. An auto-generated name like `myhost-graceful-unicorn`, where `myhost` is your machine’s hostname or the prefix you set with `--remote-control-session-name-prefix` -If you didn’t set an explicit name, Claude Code updates the title to reflect your prompt once you send one. Claude Code matches auto-generated titles to the language of your conversation, or to the [`language`](</docs/en/settings#available-settings>) setting if one is configured; the language matching requires Claude Code v2.1.176 or later. When you rename a session from claude.ai or the Claude app, Claude Code also updates the local title shown in `claude --resume`. Claude Code applies the same rename to the session name shown on the prompt bar and in `claude agents`. Before v2.1.221, renaming from claude.ai or the Claude app updated only the title, and the CLI kept its previous session name. If the environment already has an active session, you’ll be asked whether to continue it or start a new one. If you don’t have the Claude app yet, use the `/mobile` command inside Claude Code to display a download QR code for [iOS](<https://apps.apple.com/us/app/claude-by-anthropic/id6473753684>) or [Android](<https://play.google.com/store/apps/details?id=com.anthropic.claude>). +If you didn’t set an explicit name, Claude Code updates the title to reflect your prompt once you send one. Claude Code matches auto-generated titles to the language of your conversation, or to the [`language`](</docs/en/settings#available-settings>) setting if one is configured; the language matching requires Claude Code v2.1.176 or later. When you rename a session from claude.ai or the Claude app, Claude Code also updates the local title shown in `claude --resume`. Claude Code applies the same rename to the session name shown on the prompt bar, and in the `claude agents` listing when the session [runs in the background](</docs/en/agent-view>). Before v2.1.221, renaming from the session list at claude.ai or in the Claude app updated only the title, and the CLI kept its previous session name; `/rename`, which runs in the CLI itself, set the name on any version. If the environment already has an active session, you’ll be asked whether to continue it or start a new one. If you don’t have the Claude app yet, use the `/mobile` command inside Claude Code to display a download QR code for [iOS](<https://apps.apple.com/us/app/claude-by-anthropic/id6473753684>) or [Android](<https://play.google.com/store/apps/details?id=com.anthropic.claude>). ### @@ -137,7 +137,18 @@ Enable Remote Control for all sessions -Remote Control only activates when you explicitly run `claude remote-control`, `claude --remote-control`, or `/remote-control`, unless auto-connect is turned on. To enable it automatically for every interactive session, run `/config` inside Claude Code and set **Enable Remote Control for all sessions** to `true`. Set it to `false` to never auto-connect, or to `default` to clear your choice. When the setting is cleared, Remote Control follows your organization’s admin default if one is set, and otherwise Claude Code’s current default. In the Desktop app, you can also toggle this from **Settings → Claude Code → Enable remote control by default**. In the [VS Code extension](</docs/en/vs-code#use-the-prompt-box>), the same toggle appears as **Enable Remote Control for all sessions** in the command menu’s Settings section; requires Claude Code v2.1.203 or later. 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. +Remote Control only activates when you explicitly run `claude remote-control`, `claude --remote-control`, or `/remote-control`, unless auto-connect is turned on. To turn auto-connect on for every interactive session, run `/config` inside Claude Code and set **Enable Remote Control for all sessions**. The toggle takes three values: + + * **`true`** : connect automatically when an interactive session starts. + * **`false`** : turn auto-connect off, though a `true` from [managed settings](</docs/en/settings#settings-files>) 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. + +The same toggle appears outside the CLI: + + * **Desktop app** : **Settings > Claude Code > Enable remote control by default**. + * **VS Code extension** : **Enable Remote Control for all sessions** in the [command menu’s](</docs/en/vs-code#use-the-prompt-box>) Settings section. Requires Claude Code v2.1.203 or later. + +To turn auto-connect on from a settings file instead, set [`remoteControlAtStartup`](</docs/en/settings#available-settings>) to `true` in your user `~/.claude/settings.json` or in [managed settings](</docs/en/settings#settings-files>). 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. ## @@ -343,12 +354,18 @@ ”Remote Control is disabled by your organization’s policy” -This error has four distinct causes. Run `/status` first to see which login method and subscription you’re using. - - * **You’re authenticated with an API key or Console account** : Remote Control requires claude.ai OAuth. Run `/login` and choose the claude.ai option. If `ANTHROPIC_API_KEY` is set in your environment, unset it. - * **An Owner hasn’t enabled it for your organization** : Remote Control is off by default on Team and Enterprise plans. An Owner can enable it at [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>) by turning on the **Remote Control** toggle. This toggle is a server-side organization setting. - * **The admin toggle is grayed out** : your organization has a data retention or compliance configuration that is incompatible with Remote Control. This cannot be changed from the admin panel. Contact Anthropic support to discuss options. - * **The error mentions`disableRemoteControl`**: your IT administrator has disabled Remote Control on this device through [managed settings](</docs/en/settings#settings-files>), independent of the organization-wide toggle. +A policy blocks Remote Control. The message’s own text tells you which: + + * **The error mentions`disableRemoteControl`**: your IT administrator has disabled Remote Control on this device through [managed settings](</docs/en/settings#settings-files>), independent of the organization-wide toggle and of how you’re signed in. + * **Otherwise, an Owner hasn’t enabled it for your organization** : this form appears when you’re signed in with an eligible claude.ai account but Remote Control is off, the default on Team and Enterprise plans. An Owner can enable it at [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>) by turning on the **Remote Control** toggle. This toggle is a server-side organization setting. + +### + +​ + +”Remote Control isn’t available for your organization due to its compliance policy” + +Your organization has a data retention or compliance configuration that is incompatible with Remote Control; the parenthetical at the end of the message names it. In this state the admin panel’s Remote Control toggle is grayed out, so an Owner can’t change it there. Contact Anthropic support to discuss options. ###
modified Configure server-managed settings View current →
--- a/server-managed-settings.md +++ b/server-managed-settings.md @@ -122,7 +122,7 @@ Managed-only settings -Most [settings keys](</docs/en/settings#available-settings>) work in any scope. A handful of keys are only read from managed settings and have no effect when placed in user or project settings files. See [managed-only settings](</docs/en/permissions#managed-only-settings>) for the full list. Any setting not on that list can still be placed in managed settings and takes the highest precedence. +Most [settings keys](</docs/en/settings#available-settings>) work in any scope. A handful of keys are only read from managed settings and have no effect when placed in user or project settings files. See [managed-only settings](</docs/en/permissions#managed-only-settings>) for the full list. Any setting not on that list can still be placed in managed settings and takes the highest precedence, apart from the exceptions listed in the [settings reference’s precedence section](</docs/en/settings#settings-precedence>). ### @@ -148,7 +148,7 @@ Settings precedence -Server-managed settings and [endpoint-managed settings](</docs/en/settings#settings-files>) both occupy the highest tier in the Claude Code [settings hierarchy](</docs/en/settings#settings-precedence>). No other settings level can override them, including command line arguments. Within the managed tier, a configured [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) preempts every other managed source, including server-managed settings: its output becomes the only managed configuration for the run. Otherwise, Claude Code uses the first source that delivers a non-empty configuration. Server-managed settings are checked first, then endpoint-managed settings. Sources don’t merge: if server-managed settings deliver any keys at all, other endpoint-managed settings are ignored. If server-managed settings deliver nothing, endpoint-managed settings apply. A small set of [cross-source lock keys](</docs/en/settings#settings-precedence>), such as the sandbox allowlist locks, is honored when any admin-controlled managed source sets them; the user-writable HKCU registry tier is excluded, and when a [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) is configured, its output is the only source these checks read. If you clear your server-managed configuration in the admin console with the intent of falling back to an endpoint-managed plist or registry policy, be aware that cached settings persist on client machines until the next successful fetch. Run `/status` to see which managed source is active. +Server-managed settings and [endpoint-managed settings](</docs/en/settings#settings-files>) both occupy the highest tier in the Claude Code [settings hierarchy](</docs/en/settings#settings-precedence>). No other settings level can override them, including command line arguments, apart from the exceptions listed in the [settings reference’s precedence section](</docs/en/settings#settings-precedence>). Within the managed tier, a configured [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) preempts every other managed source, including server-managed settings: its output becomes the only managed configuration for the run. Otherwise, Claude Code uses the first source that delivers a non-empty configuration. Server-managed settings are checked first, then endpoint-managed settings. Sources don’t merge: if server-managed settings deliver any keys at all, other endpoint-managed settings are ignored. If server-managed settings deliver nothing, endpoint-managed settings apply. A small set of [cross-source lock keys](</docs/en/settings#settings-precedence>), such as the sandbox allowlist locks, is honored when any admin-controlled managed source sets them; the user-writable HKCU registry tier is excluded, and when a [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) is configured, its output is the only source these checks read. If you clear your server-managed configuration in the admin console with the intent of falling back to an endpoint-managed plist or registry policy, be aware that cached settings persist on client machines until the next successful fetch. Run `/status` to see which managed source is active. ###
modified Manage sessions View current →
--- a/sessions.md +++ b/sessions.md @@ -82,9 +82,9 @@ From the session picker| Highlight a session and press `Ctrl+R` On plan accept| Accepting a plan in [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) names the session from the plan content unless you’ve already set one From claude.ai or the Claude app| Rename a [Remote Control session](</docs/en/remote-control#connect-from-another-device>); Claude Code applies the same name in the CLI. Requires Claude Code v2.1.221 or later -From the desktop app| Rename a session in the [desktop app](</docs/en/desktop#work-in-parallel-with-sessions>); Claude Code applies the same name in the CLI. Requires Claude Code v2.1.221 or later - -Once a session is named, return to it with `claude --resume <name>` or `/resume <name>`. See Resume a session for how name resolution behaves across worktrees. Interactive sessions you never name still get a default display name when they start. Requires Claude Code v2.1.196 or later. The default combines the working directory’s name with a two-character suffix, for example `my-app-3f`, and identifies the session in listings of running sessions, such as [agent view](</docs/en/agent-view>) and `claude agents --json` output. The default isn’t a resume handle: `claude --resume <name>`, `/resume <name>`, and the session picker match only names you set. Naming the session replaces the default. If you don’t name a session, Claude Code generates a session title for it: a short summary of your first prompt, written by a background request to the small/fast model, normally a Haiku-class model. Naming the session with `--name` or `/rename` replaces the generated title. You see the generated title in the session picker and in the statusline [`session_name`](</docs/en/statusline>) field when no name is set; like the default display name, it isn’t a resume handle. +From the desktop app| Rename a session in the [desktop app](</docs/en/desktop#work-in-parallel-with-sessions>); that section covers where the name is visible from the CLI. Requires Claude Code v2.1.221 or later + +Once you name a session through a CLI route or from claude.ai, return to it with `claude --resume <name>` or `/resume <name>`; a desktop-app session resumes in the app, which keeps its own session history. See Resume a session for how name resolution behaves across worktrees. Interactive sessions you never name still get a default display name when they start. Requires Claude Code v2.1.196 or later. The default combines the working directory’s name with a two-character suffix, for example `my-app-3f`, and identifies the session in listings of running sessions, such as [agent view](</docs/en/agent-view>) and `claude agents --json` output. The default isn’t a resume handle: `claude --resume <name>`, `/resume <name>`, and the session picker match only names you set. Naming the session replaces the default. If you don’t name a session, Claude Code generates a session title for it: a short summary of your first prompt, written by a background request to the small/fast model, normally a Haiku-class model. Naming the session with `--name` or `/rename` replaces the generated title. You see the generated title in the session picker and in the statusline [`session_name`](</docs/en/statusline>) field when no name is set; like the default display name, it isn’t a resume handle. ##
modified Claude Code settings View current →
--- a/settings.md +++ b/settings.md @@ -59,13 +59,13 @@ When the same setting appears in multiple scopes, Claude Code applies them in priority order: - 1. **Managed** (highest): can’t be overridden by anything + 1. **Managed** (highest): can’t be overridden by any other scope, apart from the exceptions under Settings precedence 2. **Command line arguments** : temporary session overrides 3. **Local** : overrides project and user settings 4. **Project** : overrides user settings 5. **User** (lowest): applies when nothing else specifies the setting -For example, if your user settings set `spinnerTipsEnabled` to `true` and project settings set it to `false`, the project value applies. Permission rules behave differently because they merge across scopes rather than override. See Settings precedence. +For example, if your user settings set `spinnerTipsEnabled` to `true` and project settings set it to `false`, the project value applies. Permission rules behave differently because they merge across scopes rather than override, and a few security-sensitive settings honor a restrictive value from certain scopes that otherwise couldn’t override them. See Settings precedence. ### @@ -103,7 +103,7 @@ Before v2.1.211, the file always lived in the starting directory. Claude Code still reads a `.claude/settings.local.json` that an earlier version left there. When both files set the same key, the repository root’s value wins, except that permission rules from both files stay in effect. Claude Code also saves permanent “don’t ask again” [permission approvals](</docs/en/permissions#permission-system>), such as Bash command approvals, to this file. Because this file is yours rather than the repository’s, its permission `allow` rules take effect without the [workspace trust](</docs/en/permissions#project-allow-rules-and-workspace-trust>) step that `.claude/settings.json` allow rules require. If the repository supplies the file, for example by committing it, workspace trust still applies. - * **Managed settings** : For organizations that need centralized control, Claude Code supports multiple delivery mechanisms for managed settings. All use the same JSON format and cannot be overridden by user or project settings: + * **Managed settings** : For organizations that need centralized control, Claude Code supports multiple delivery mechanisms for managed settings. All use the same JSON format and cannot be overridden by user or project settings, apart from the exceptions listed under Settings precedence: * **Server-managed settings** : delivered remotely at sign-in, either from Anthropic’s servers via the claude.ai admin console or from a self-hosted [Claude apps gateway](</docs/en/claude-apps-gateway>). See [server-managed settings](</docs/en/server-managed-settings>). * **MDM/OS-level policies** : delivered through native device management on macOS and Windows: * macOS: `com.anthropic.claudecode` managed preferences domain. The plist’s top-level keys mirror `managed-settings.json`, with nested settings as dictionaries and arrays as plist arrays. Deploy via configuration profiles in Jamf, Iru (Kandji), or similar MDM tools. @@ -301,7 +301,7 @@ `processWrapper`| Corporate launcher command placed in front of the [background processes Claude Code starts](</docs/en/corporate-launcher#what-the-launcher-covers>). Honored from managed settings, a `--settings` file, and user settings only; the [`CLAUDE_CODE_PROCESS_WRAPPER`](</docs/en/env-vars>) environment variable takes precedence when both are set. See [Run Claude Code behind a corporate launcher](</docs/en/corporate-launcher>) for the launcher contract. Requires Claude Code v2.1.210 or later| `"/opt/corp/launcher --profile claude"` `prUrlTemplate`| URL template for the PR badge shown in the footer and in tool-result summaries. Substitutes `{host}`, `{owner}`, `{repo}`, `{number}`, and `{url}` from the `gh`-reported PR URL. Use to point PR links at an internal code-review tool instead of `github.com`. Does not affect `#123` autolinks in Claude’s prose| `"https://reviews.example.com/{owner}/{repo}/pull/{number}"` `remote.defaultEnvironmentId`| Default [cloud environment](</docs/en/cloud-environments>) for cloud sessions you create from the CLI, such as with `claude --cloud`. Written to user settings when you pick an environment with [`/remote-env`](</docs/en/cloud-environments#select-an-environment-from-the-cli>). Follows the standard settings precedence, so a value in a repo’s project settings overrides the user-level pick| `"env_0123abcd"` -`remoteControlAtStartup`| Connect [Remote Control](</docs/en/remote-control>) automatically when each interactive session starts, instead of waiting for `/remote-control`. Set to `true` to always auto-connect, `false` to never auto-connect, or leave unset to follow your organization’s admin default if one is set, and otherwise Claude Code’s current default. Appears in `/config` as **Enable Remote Control for all sessions**. See [Enable Remote Control for all sessions](</docs/en/remote-control#enable-remote-control-for-all-sessions>)| `false` +`remoteControlAtStartup`| Connect [Remote Control](</docs/en/remote-control>) automatically when each interactive session starts, instead of waiting for `/remote-control`. Set to `true` to turn auto-connect on, `false` to turn it off, or leave unset to follow your organization’s admin default if one is set, and otherwise Claude Code’s current default. Appears in `/config` as **Enable Remote Control for all sessions**. Claude Code ignores a `true` from project or local settings; for the full per-scope behavior, see [Enable Remote Control for all sessions](</docs/en/remote-control#enable-remote-control-for-all-sessions>) and the exceptions under Settings precedence| `false` `requiredMaximumVersion`| Managed settings only. Maximum Claude Code version allowed to start. If the running version is newer, Claude Code exits at startup and instructs the user to install an approved version through the organization’s approved method; `claude install <version>` may also work. Background auto-updates and `claude update` skip versions above the ceiling, so an in-range installation stays in range. `claude update`, `claude install`, and `claude doctor` keep working above the ceiling so users can recover. Versions that predate this setting ignore it| `"2.1.150"` `requiredMinimumVersion`| Managed settings only. Minimum Claude Code version required to start. If the running version is older, Claude Code exits at startup and instructs the user to update through the organization’s approved method. `claude update`, `claude install`, and `claude doctor` keep working below the floor so users can recover. Differs from `minimumVersion`, which prevents downgrades but never blocks startup. Versions that predate this setting ignore it| `"2.1.150"` `respectGitignore`| **Default** : `true`. Control whether the `@` file picker respects `.gitignore` patterns. When `true`, files matching `.gitignore` patterns are excluded from suggestions| `false` @@ -657,7 +657,11 @@ 1. **Managed settings** ([server-managed](</docs/en/server-managed-settings>), MDM/OS-level policies, or [managed settings](</docs/en/settings#settings-files>)) * Policies deployed by IT through server delivery, MDM configuration profiles, registry policies, or managed settings files - * Cannot be overridden by any other level, including command line arguments + * Cannot be overridden by any other level, including command line arguments, apart from the exceptions in the bullets below + * A few security-sensitive settings honor a restrictive value from scopes that otherwise couldn’t override them: + * A `true` for `disableClaudeAiConnectors` applies from any scope, even when a managed source sets `false` + * A `false` for `remoteControlAtStartup` in project or local settings (`.claude/settings.json`, `.claude/settings.local.json`) applies even when a managed source sets `true`. Claude Code ignores a `true` there; only user settings, the `--settings` flag, and managed sources can turn auto-connect on, and a user `false` doesn’t override a managed `true` + * Host platforms that embed Claude Code and set [`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`](</docs/en/env-vars>) are also an exception. The host’s model configuration takes precedence over the `model`, `fallbackModel`, and `modelOverrides` keys from every managed source, and over the model-selection environment variables in a managed `env` block, such as `ANTHROPIC_MODEL` and the `ANTHROPIC_DEFAULT_*_MODEL` family. A managed `availableModels` allowlist stays in force unless the host supplies its own * Within the managed tier, only one source is used and the others are ignored rather than merged. Precedence, highest first: * `policyHelper` output: when configured, this is the only managed source used * Remote (claude.ai [server-managed](</docs/en/server-managed-settings>) or [Claude apps gateway](</docs/en/claude-apps-gateway>)-delivered) @@ -681,12 +685,12 @@ 5. **User settings** (`~/.claude/settings.json`) * Personal global settings -This hierarchy ensures that organizational policies are always enforced while still allowing teams and individuals to customize their experience. The same precedence applies whether you run Claude Code from the CLI, the [VS Code extension](</docs/en/vs-code>), or a [JetBrains IDE](</docs/en/jetbrains>). For example, if your user settings set `permissions.defaultMode` to `acceptEdits` and a project’s shared settings set it to `default`, the project value applies. The example below covers how array-valued settings such as permission rules combine instead. +This hierarchy applies organizational policies first, apart from the exceptions under Settings precedence, while still allowing teams and individuals to customize their experience. The same precedence applies whether you run Claude Code from the CLI, the [VS Code extension](</docs/en/vs-code>), or a [JetBrains IDE](</docs/en/jetbrains>). For example, if your user settings set `permissions.defaultMode` to `acceptEdits` and a project’s shared settings set it to `default`, the project value applies. The example below covers how array-valued settings such as permission rules combine instead. **Array settings merge across scopes.** When the same array-valued setting (such as `sandbox.filesystem.allowWrite` or `permissions.allow`) appears in multiple scopes, the arrays are **concatenated and deduplicated** , not replaced. This means lower-priority scopes can add entries without overriding those set by higher-priority scopes, and vice versa. For example, if managed settings set `allowWrite` to `["/opt/company-tools"]` and a user adds `["~/.kube"]`, both paths are included in the final configuration.Two array settings do not merge this way: * `fallbackModel` is an ordered chain where position carries meaning: the highest-precedence file that defines it supplies the entire value. - * `availableModels`: when the [highest-precedence managed source](</docs/en/server-managed-settings#settings-precedence>) defines it, that list applies as-is and user, project, and local entries cannot extend it. Across non-managed scopes the arrays merge as usual. See [Merge behavior](</docs/en/model-config#merge-behavior>). + * `availableModels`: when the [highest-precedence managed source](</docs/en/server-managed-settings#settings-precedence>) defines it, that list applies as-is, apart from a host platform that supplies its own, and user, project, and local entries cannot extend it. Across non-managed scopes the arrays merge as usual. See [Merge behavior](</docs/en/model-config#merge-behavior>). ### @@ -706,8 +710,8 @@ * **Settings files (JSON)** : Configure permissions, environment variables, and tool behavior * **Skills** : Custom prompts that can be invoked with `/skill-name` or loaded by Claude automatically * **MCP servers** : Extend Claude Code with additional tools and integrations - * **Precedence** : Higher-level configurations (Managed) override lower-level ones (User/Project) - * **Inheritance** : Settings merge across scopes; scalar values from higher-priority scopes override, and arrays concatenate, with two exceptions described in the array-merge Note + * **Precedence** : Higher-level configurations (Managed) override lower-level ones (User/Project), apart from the exceptions under Settings precedence + * **Inheritance** : Settings merge across scopes; scalar values from higher-priority scopes override and arrays concatenate, each with the exceptions described under Settings precedence ###
modified Extend Claude with skills View current →
--- a/skills.md +++ b/skills.md @@ -2,7 +2,7 @@ For built-in commands like `/help` and `/compact`, and bundled skills like `/debug` and `/code-review`, see the [commands reference](</docs/en/commands>).**Custom commands have been merged into skills.** A file at `.claude/commands/deploy.md` and a skill at `.claude/skills/deploy/SKILL.md` both create `/deploy` and work the same way. Your existing `.claude/commands/` files keep working. Skills add optional features: a directory for supporting files, frontmatter to control whether you or Claude invokes them, and the ability for Claude to load them automatically when relevant. -Claude Code skills follow the [Agent Skills](<https://agentskills.io>) open standard, which works across multiple AI tools. Claude Code extends the standard with additional features like invocation control, subagent execution, and dynamic context injection. +Claude Code skills follow the [Agent Skills](<https://agentskills.io>) open standard, which works across multiple AI tools. Claude Code extends the standard with additional features like invocation control, subagent execution, and dynamic context injection. See Using skill frontmatter outside Claude Code for which frontmatter fields are part of the standard and which are Claude Code extensions. ## @@ -246,6 +246,28 @@ `hooks`| No| Hooks scoped to this skill’s lifecycle. See [Hooks in skills and agents](</docs/en/hooks#hooks-in-skills-and-agents>) for configuration format. `paths`| No| Glob patterns that limit when this skill is activated. Accepts a comma-separated string or a YAML list. When set, Claude loads the skill automatically only when working with files matching the patterns. Uses the same format as [path-specific rules](</docs/en/memory#path-specific-rules>). `shell`| No| Shell to use for `!`command`` and ````!` blocks in this skill. Accepts `bash` (default) or `powershell`. Setting `powershell` runs inline shell commands via PowerShell when the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) is enabled: it’s on by default on Windows without Git Bash, and `CLAUDE_CODE_USE_POWERSHELL_TOOL=1` enables it elsewhere. +`metadata`| No| Free-form YAML map for your own key-value data, such as entitlement or catalog fields, read by your own tooling from `SKILL.md`. Claude Code doesn’t act on its contents, and drops a value that isn’t a map. Don’t reuse frontmatter field names such as `paths` as keys. +`license`| No| License covering the skill. Part of the [Agent Skills](<https://agentskills.io>) spec; see Using skill frontmatter outside Claude Code. Claude Code accepts the field but doesn’t act on it. +`compatibility`| No| Environment requirements for the skill, such as intended products or system prerequisites, as defined by the [Agent Skills](<https://agentskills.io>) spec; see Using skill frontmatter outside Claude Code. Accepts a string of up to 500 characters. Claude Code accepts the field but doesn’t act on it. + +#### + +​ + +Using skill frontmatter outside Claude Code + +Claude Code accepts every field in the table above. Outside Claude Code, you can use only the fields in the [Agent Skills](<https://agentskills.io>) spec: + +Distribution path| Frontmatter fields you can use +---|--- +Claude Code skills at any level, including [plugin](</docs/en/plugins>) skills| Every field in the table above +claude.ai skill uploads, the Skills API, and packaging with `package_skill.py` from [anthropics/skills](<https://github.com/anthropics/skills>)| `name`, `description`, `license`, `compatibility`, `metadata`, `allowed-tools` + +When you enable a personal skill for Cowork and cloud sessions, including routines, you upload it to claude.ai, so the same rules apply. If you include any field the spec doesn’t allow, packaging or upload fails with a hard error instead of ignoring the field: + + Unexpected key(s) in SKILL.md frontmatter: argument-hint. Allowed properties are: allowed-tools, compatibility, description, license, metadata, name + +Restricting frontmatter to the spec’s six fields avoids the unexpected-key error above. The [Agent Skills spec](<https://agentskills.io>) and the [Skills API requirements](<https://docs.claude.com/en/api/skills-guide>) define everything else those paths validate. Claude Code-only body features, such as dynamic context injection, don’t function in claude.ai chat or through the API. Claude Code accepts all six fields, so frontmatter that follows the spec loads in Claude Code without changes. #### @@ -355,7 +377,7 @@ 3. Push to the deployment target 4. Verify the deployment succeeded -Here’s how the two fields affect invocation and context loading: +If Claude tries anyway, Claude Code blocks the call and instructs it not to reproduce the deploy steps another way, so expect Claude to suggest running `/deploy` yourself. Here’s how the two fields affect invocation and context loading: Frontmatter| You can invoke| Claude can invoke| When loaded into context ---|---|---|---
modified Customize your status line View current →
--- a/statusline.md +++ b/statusline.md @@ -5,7 +5,7 @@ * Work across multiple sessions and need to distinguish them * Want git branch and status always visible -The status line renders in its own row above the built-in footer badges and does not replace them. To add clickable link badges to the footer when an ID appears in the conversation, without writing a script, configure [`footerLinksRegexes`](</docs/en/settings#footer-link-badges>) instead. Here’s an example of a multi-line status line that displays git info on the first line and a color-coded context bar on the second. +The status line renders in its own row above the built-in footer badges and does not replace them. With a custom status line configured, Claude Code still shows contextual hints such as `esc to interrupt`, but stops showing two static hints: the `? for shortcuts` fallback and the `hold space to speak` [voice dictation](</docs/en/voice-dictation>) hint. To add clickable link badges to the footer when an ID appears in the conversation, without writing a script, configure [`footerLinksRegexes`](</docs/en/settings#footer-link-badges>) instead. Here’s an example of a multi-line status line that displays git info on the first line and a color-coded context bar on the second. This page walks through setting up a basic status line, explains how the data flows from Claude Code to your script, lists all the fields you can display, and provides ready-to-use examples for common patterns like git status, cost tracking, and progress bars.
modified Create custom subagents View current →
--- a/sub-agents.md +++ b/sub-agents.md @@ -211,7 +211,7 @@ You are a code reviewer. When invoked, analyze the code and provide specific, actionable feedback on quality, security, and best practices. -The frontmatter defines the subagent’s metadata and configuration. The body becomes the system prompt that guides the subagent’s behavior. Subagents receive only this system prompt plus basic environment details like the working directory, not the full Claude Code system prompt. In [non-interactive mode](</docs/en/headless>), the [`--append-subagent-system-prompt`](</docs/en/cli-reference#cli-flags>) flag appends the text you provide to the end of every subagent’s system prompt, including nested subagents. Requires Claude Code v2.1.205 or later. A subagent starts in the main conversation’s current working directory. Within a subagent, `cd` commands don’t persist between Bash or PowerShell tool calls and don’t affect the main conversation’s working directory. To give the subagent an isolated copy of the repository instead, set `isolation: worktree`. A subagent with `isolation: worktree` runs its Bash and PowerShell commands inside its worktree. A command whose working directory resolves to your main checkout instead, for example because the worktree directory was removed while the subagent was running, fails with an error. Before v2.1.203, such a command could run in the main checkout. This working-directory check covers the whole repository containing the directory you launched Claude Code from. When your session runs in a linked [worktree](</docs/en/worktrees>) of its own, the check also covers the main checkout that worktree is linked from. Before v2.1.210, the check covered only the launch directory itself. A command whose working directory resolved elsewhere in the same repository, such as the repository root when you launched Claude Code from a monorepo subdirectory, ran there instead of failing. For Bash commands, Claude Code also checks the command itself: a command that redirects git into the main checkout fails with an error, whether it uses `git -C`, `--git-dir`, a `GIT_DIR` or `GIT_WORK_TREE` variable, or a `cd` into the main checkout first. A command too complex to check also fails, with an error telling Claude to split it into separate plain commands. This check applies to Bash only; PowerShell commands get only the working-directory check. +The frontmatter defines the subagent’s metadata and configuration. The body becomes the system prompt that guides the subagent’s behavior. Subagents receive only this system prompt plus basic environment details like the working directory, not the full Claude Code system prompt. In [non-interactive mode](</docs/en/headless>), the [`--append-subagent-system-prompt`](</docs/en/cli-reference#cli-flags>) flag appends the text you provide to the end of every subagent’s system prompt, including nested subagents. Requires Claude Code v2.1.205 or later. A subagent starts in the main conversation’s current working directory. Within a subagent, `cd` commands don’t persist between Bash or PowerShell tool calls and don’t affect the main conversation’s working directory. To give the subagent an isolated copy of the repository instead, set `isolation: worktree`. A subagent with `isolation: worktree` runs its Bash and PowerShell commands inside its worktree. A command whose working directory resolves to your main checkout instead, for example because the worktree directory was removed while the subagent was running, fails with an error. Before v2.1.203, such a command could run in the main checkout. This working-directory check covers the whole repository containing the directory you launched Claude Code from. When your session runs in a linked [worktree](</docs/en/worktrees>) of its own, the check also covers the main checkout that worktree is linked from. Before v2.1.210, the check covered only the launch directory itself. A command whose working directory resolved elsewhere in the same repository, such as the repository root when you launched Claude Code from a monorepo subdirectory, ran there instead of failing. For Bash commands, Claude Code also checks the command itself and blocks one that redirects git into the main checkout; the redirect vectors and the too-complex-to-check rule are listed under [How Claude Code enforces isolation](</docs/en/worktrees#how-claude-code-enforces-isolation>). PowerShell commands get only the working-directory check. [Monitor](</docs/en/tools-reference#monitor-tool>) commands go through the same working-directory and command-content checks as Bash commands. When the main conversation itself runs isolated in a worktree, Claude Code applies the same checks to the session and to every subagent it spawns, including subagents without `isolation: worktree`; see [How Claude Code enforces isolation](</docs/en/worktrees#how-claude-code-enforces-isolation>). #### @@ -260,7 +260,7 @@ 3. The subagent definition’s `model` frontmatter 4. The main conversation’s model -As of v2.1.196, setting `CLAUDE_CODE_SUBAGENT_MODEL` to `inherit` is the same as leaving it unset: resolution continues with the per-invocation `model` parameter, then the frontmatter. In earlier versions, `inherit` forced subagents onto the main conversation’s model and ignored both of those sources. Claude Code checks the environment variable, per-invocation parameter, and frontmatter values against your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist. It skips a value that resolves to an excluded model and runs the subagent on the inherited model instead. A per-invocation `model` parameter also applies when the subagent is resumed or sent a follow-up message, so the subagent stays on that model. Before v2.1.211, resuming dropped the per-invocation value and the subagent reverted to its definition’s `model` field or, without one, the main conversation’s model. As of v2.1.198, subagents also inherit the main conversation’s [extended thinking](</docs/en/model-config#extended-thinking>) configuration: if thinking is on in your session, it’s on for the subagent, and if it’s off, it stays off. There is no per-subagent thinking setting. Before v2.1.198, subagents ran with extended thinking disabled regardless of the main conversation’s setting. +As of v2.1.196, setting `CLAUDE_CODE_SUBAGENT_MODEL` to `inherit` is the same as leaving it unset: resolution continues with the per-invocation `model` parameter, then the frontmatter. In earlier versions, `inherit` forced subagents onto the main conversation’s model and ignored both of those sources. Claude Code checks the environment variable, per-invocation parameter, and frontmatter values against your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist. When a blocked value is a family alias such as `opus`, Claude Code runs the subagent on the newest version of that family the allowlist permits, following the same [substitution rules and provider scope](</docs/en/model-config#restrict-model-selection>) as `/model`. For any other blocked value, on providers where that substitution doesn’t operate, or when the allowlist permits no version of the family, Claude Code runs the subagent on the inherited model instead. Before v2.1.222, Claude Code ran the subagent on the inherited model for a blocked family alias as well. A per-invocation `model` parameter also applies when the subagent is resumed or sent a follow-up message, so the subagent stays on that model. Before v2.1.211, resuming dropped the per-invocation value and the subagent reverted to its definition’s `model` field or, without one, the main conversation’s model. As of v2.1.198, subagents also inherit the main conversation’s [extended thinking](</docs/en/model-config#extended-thinking>) configuration: if thinking is on in your session, it’s on for the subagent, and if it’s off, it stays off. There is no per-subagent thinking setting. Before v2.1.198, subagents ran with extended thinking disabled regardless of the main conversation’s setting. ### @@ -347,7 +347,7 @@ * As a subagent, spawned through the Agent tool or an @-mention * As the main session, launched with `--agent` or the `agent` setting -When the agent is the main session, inline server definitions connect at startup alongside servers from [`.mcp.json`](</docs/en/mcp>) and settings files. +When the agent is the main session, inline server definitions connect at startup alongside servers from [`.mcp.json`](</docs/en/mcp>) and settings files. In `/mcp`, a remote (HTTP or SSE) server you’ve used before can show the [`cached` status](</docs/en/mcp#managing-your-servers>) instead; Claude Code connects it when Claude first calls one of its tools. Each entry in the list is either an inline server definition or a string referencing an MCP server already configured in your session:
modified Subagents in the SDK View current →
--- a/subagents.md +++ b/subagents.md @@ -672,14 +672,6 @@ For the file format, see [how to write subagent files](</docs/en/sub-agents#write-subagent-files>). -### - -​ - -Long prompt failures on Windows - -On Windows, subagents with very long prompts may fail due to the command line length limit of 8191 characters. Keep prompts concise or use filesystem-based agents for complex instructions. - ## ​
modified Troubleshoot installation and login View current →
--- a/troubleshoot-install.md +++ b/troubleshoot-install.md @@ -36,6 +36,7 @@ `App unavailable in region`| Claude Code is not available in your country. See [supported countries](<https://www.anthropic.com/supported-countries>). `unable to get local issuer certificate`| Configure corporate CA certificates `OAuth error` or `403 Forbidden`| Fix authentication +`Unable to connect to Anthropic services` during setup| See [Unable to connect to Anthropic services](</docs/en/errors#unable-to-connect-to-anthropic-services>) in the Error reference `Could not load the default credentials` or `Could not load credentials from any providers`| Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry credentials `ChainedTokenCredential authentication failed` or `CredentialUnavailableError`| Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry credentials `API Error: 500`, `529 Overloaded`, `429`, or other 4xx and 5xx errors not listed above| See the [Error reference](</docs/en/errors>) @@ -353,16 +354,34 @@ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 irm https://claude.ai/install.ps1 | iex - 3. **Check for proxy or firewall interference** : corporate proxies that perform TLS inspection can cause these errors, including `unable to get local issuer certificate` and `SELF_SIGNED_CERT_IN_CHAIN`. For the install step, point curl at your corporate CA bundle with `--cacert`: - - curl --cacert /path/to/corporate-ca.pem -fsSL https://claude.ai/install.sh | bash + 3. **Check for proxy or firewall interference** : corporate proxies that perform TLS inspection can cause these errors, including `unable to get local issuer certificate` and `SELF_SIGNED_CERT_IN_CHAIN`. For the install step, make the install download trust your corporate proxy’s CA: + + * macOS/Linux + + * Windows PowerShell + + curl --cacert /path/to/corporate-ca.pem -fsSL https://claude.ai/install.sh | bash + +The PowerShell installer downloads through .NET, which validates TLS against the Windows certificate store. Ask your IT team to add the proxy’s CA certificate to the Windows store if it isn’t already there, then run the installer: + + irm https://claude.ai/install.ps1 | iex For Claude Code itself once installed, set `NODE_EXTRA_CA_CERTS` so API requests trust the same bundle: - export NODE_EXTRA_CA_CERTS=/path/to/corporate-ca.pem + * macOS/Linux + + * Windows PowerShell + + export NODE_EXTRA_CA_CERTS=/path/to/corporate-ca.pem + + $env:NODE_EXTRA_CA_CERTS = 'C:\path\to\corporate-ca.pem' Ask your IT team for the certificate file if you don’t have it. You can also try on a direct connection to confirm the proxy is the cause. - 4. **On Windows, switch installers if your network blocks revocation checks**. The errors `CRYPT_E_NO_REVOCATION_CHECK (0x80092012)` and `CRYPT_E_REVOCATION_OFFLINE (0x80092013)` mean curl reached the server but your network blocks the certificate revocation lookup, which is common behind corporate firewalls. Adding curl’s `--ssl-revoke-best-effort` flag doesn’t fix this: the flag only applies to downloading `install.cmd` itself, and the script’s own downloads run without it, so the install fails with the same error. Use an install method that tolerates the blocked lookup instead. Open PowerShell and run the PowerShell installer, which downloads through .NET and doesn’t fail when the revocation server is unreachable: + 4. **On Windows, work around blocked revocation checks**. The errors `CRYPT_E_NO_REVOCATION_CHECK (0x80092012)` and `CRYPT_E_REVOCATION_OFFLINE (0x80092013)` mean curl reached the server but your network blocks the certificate revocation lookup, which is common behind corporate firewalls. If the failing command is the `curl` that downloads `install.cmd`, rerun it from a Command Prompt with `--ssl-revoke-best-effort` added: + + curl --ssl-revoke-best-effort -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd + +When the script’s own downloads hit the same errors, it retries them with best-effort revocation checking automatically, so the flag is only needed on the command you run yourself. Best-effort checking tolerates an unreachable revocation server but still rejects a certificate that is known to be revoked, matching how browsers handle revocation. You can also avoid curl’s revocation check entirely by running the PowerShell installer from PowerShell, which downloads through .NET and doesn’t fail when the revocation server is unreachable: irm https://claude.ai/install.ps1 | iex @@ -500,9 +519,7 @@ WORKDIR /tmp RUN curl -fsSL https://claude.ai/install.sh | bash - 2. **Increase Docker memory limits** if using Docker Desktop: - - docker build --memory=4g . + 2. **Give Docker more memory** if using Docker Desktop. Build containers share the memory allocated to the Docker Desktop virtual machine, so open **Settings > Resources** in Docker Desktop, raise the memory limit, and rerun the build. ###
modified Agent SDK reference - TypeScript View current →
--- a/typescript.md +++ b/typescript.md @@ -576,7 +576,7 @@ * `API_TIMEOUT_MS`: per-request timeout on the Anthropic client, in milliseconds. Default `600000`. Applies to the main loop and all subagents. * `CLAUDE_CODE_MAX_RETRIES`: maximum API retries. Default `10`, capped at `15`. Each retry gets its own `API_TIMEOUT_MS` window, so worst-case wall time is roughly `API_TIMEOUT_MS × (CLAUDE_CODE_MAX_RETRIES + 1)` plus backoff. For unattended runs that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG=1`: it retries capacity errors indefinitely, and as of Claude Code v2.1.199 raises the default for other transient errors to `300` and removes the cap on this variable. * `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`: stall watchdog for subagents launched with `run_in_background`. Default `600000`. Resets on each stream event; on stall it aborts the subagent, marks the task failed, and surfaces the error to the parent with any partial result. Does not apply to synchronous subagents. - * `CLAUDE_ENABLE_STREAM_WATCHDOG` with `CLAUDE_STREAM_IDLE_TIMEOUT_MS`: aborts the request when headers have arrived but the response body stops streaming. The watchdog is on by default for all providers; set `CLAUDE_ENABLE_STREAM_WATCHDOG=0` to disable it. `CLAUDE_STREAM_IDLE_TIMEOUT_MS` defaults to `300000` and is clamped to that minimum. After the abort, Claude Code retries the request at most once, and only before Claude has started a block of text or a tool call in the response; once Claude has completed a block of text or a tool call, Claude Code keeps the completed output, appends an [incomplete-response notice](</docs/en/errors#the-response-above-may-be-incomplete>) instead of retrying, and still runs any completed tool call. + * `CLAUDE_ENABLE_STREAM_WATCHDOG` with `CLAUDE_STREAM_IDLE_TIMEOUT_MS`: aborts the request when headers have arrived but the response body stops streaming. The watchdog is on by default for all providers; set `CLAUDE_ENABLE_STREAM_WATCHDOG=0` to disable it. `CLAUDE_STREAM_IDLE_TIMEOUT_MS` defaults to `300000` and is clamped to that minimum. After the abort, [Automatic retries](</docs/en/errors#automatic-retries>) covers what Claude Code does, based on how far the response had progressed. ###
modified Use Claude Code in VS Code View current →
--- a/vs-code.md +++ b/vs-code.md @@ -87,7 +87,7 @@ * **Plan** : Claude describes what it will do and waits for approval before making changes. VS Code automatically opens the plan as a full Markdown document where you can add inline comments to give feedback before Claude begins. * **Edit automatically** : Claude makes edits without asking. * **Command menu** : click `/` or type `/` to open the command menu. Options include attaching files, switching models, toggling extended thinking, viewing plan usage (`/usage`), and starting a [Remote Control](</docs/en/remote-control>) session (`/remote-control`). The Customize section provides access to MCP servers, hooks, memory, permissions, and plugins. Items with a terminal icon open in the integrated terminal. - * The Settings section includes **Enable Remote Control for all sessions** , which sets [`remoteControlAtStartup`](</docs/en/settings#available-settings>) so [every new interactive session connects to Remote Control automatically](</docs/en/remote-control#enable-remote-control-for-all-sessions>). Requires Claude Code v2.1.203 or later. + * The Settings section includes **Enable Remote Control for all sessions** , which sets [`remoteControlAtStartup`](</docs/en/settings#available-settings>) to control whether [new interactive sessions connect to Remote Control automatically](</docs/en/remote-control#enable-remote-control-for-all-sessions>). Requires Claude Code v2.1.203 or later. * The Settings section also includes **Focus view** , which hides tool calls, tool results, and thinking behind one expandable row per turn, leaving your prompts and Claude’s responses. While Claude works, the row shows the tool currently running. When you turn Focus view on or off, the change applies to every open session immediately, and the choice persists across sessions. You can also toggle it with `Ctrl+Option+F` (Mac) / `Ctrl+Alt+F` (Windows/Linux), or from the Command Palette with **Claude Code: Toggle Focus view**. Requires Claude Code v2.1.221 or later. * **Context indicator** : the prompt box shows how much of Claude’s context window you’re using. Claude automatically compacts when needed, or you can run `/compact` manually. * **Extended thinking** : lets Claude spend more time reasoning through complex problems. Toggle it on via the command menu (`/`). Claude’s reasoning appears in the conversation as collapsed blocks: click a block to read it, or press `Ctrl+O` to expand or collapse every thinking block in the session. See [Extended thinking](</docs/en/model-config#extended-thinking>) for details.
modified Run parallel sessions with worktrees View current →
--- a/worktrees.md +++ b/worktrees.md @@ -53,11 +53,29 @@ Resume a worktree session -When you resume a session that was inside a worktree, Claude Code returns the session to that worktree. This holds for interactive resumes, for `--continue` and `--resume` in [non-interactive mode](</docs/en/headless>) with `-p`, and for the Agent SDK. Back inside the worktree, Claude can still exit it with the [`ExitWorktree`](</docs/en/tools-reference>) tool. A resume that forks the session with `--fork-session` starts in the directory you launched Claude from and leaves the original session’s worktree untouched. If the worktree directory no longer exists, the session resumes in the directory you launched Claude from. +When you resume a session that was inside a worktree, Claude Code returns the session to that worktree. This holds for interactive resumes, for `--continue` and `--resume` in [non-interactive mode](</docs/en/headless>) with `-p`, and for the Agent SDK. Back inside the worktree, Claude can still exit it with the [`ExitWorktree`](</docs/en/tools-reference>) tool. Before returning the session to its worktree, Claude Code verifies that the worktree is still a checkout separate from the main one, and declines to re-enter a worktree that fails the check. For a git worktree, the check reads its git metadata. A worktree without git metadata, such as one a `WorktreeCreate` hook created, can pass the check; the cases Claude Code still refuses are listed with their recoveries under Claude Code refuses to use a worktree. For the messages and how to recover from each, see The session resumes outside its worktree. Where you launch from, and how you resume, change what Claude Code re-enters: + + * **Launch directory** : resume from the main checkout or another directory of the repository. Claude Code re-enters a worktree it created with git under `.claude/worktrees/` even when you launch from inside it. When you launch from inside any other worktree, Claude Code re-enters it only if it can vouch for it from there: a worktree that is its own repository, one without git metadata, or a launch from a subdirectory of a worktree you created with `git worktree add` declines, so launch those from the main checkout. + * **`--fork-session`** : the forked session starts in the directory you launched Claude from, and Claude Code leaves the original session’s worktree untouched. + * **Deleted worktree** : if the worktree directory no longer exists, Claude Code resumes the session in the directory you launched Claude from. It tells you the worktree is gone and clears the session’s worktree binding. Before v2.1.212, a non-interactive resume stayed in the starting directory and `ExitWorktree` reported that there was no active worktree session to exit. When Claude enters or exits a worktree that Claude Code created with git, the transcript follows: Claude Code records the session under the session’s new working directory, the same way [`/cd`](</docs/en/commands>) does, so `/desktop` and `--resume` find it there. Exiting moves it back the same way. A worktree created by a `WorktreeCreate` hook keeps its transcript at the launch directory. Requires Claude Code v2.1.198 or later. + +## + +​ + +How Claude Code enforces isolation + +While a session is isolated in a worktree, whether you started it with `--worktree`, Claude entered one with `EnterWorktree`, or you resumed a worktree session, Claude Code blocks the tool calls listed below when they would reach the main checkout. The same enforcement covers every subagent Claude spawns from the isolated session, and it applies whether the session is interactive or runs in the [background](</docs/en/agent-view#how-file-edits-are-isolated>). Subagents that run in their own worktree carry the same checks; their version history is under [Write subagent files](</docs/en/sub-agents#write-subagent-files>). Claude Code applies three checks: + + * **File edits** : Claude Code blocks an `Edit`, `Write`, or `NotebookEdit` that targets a path in the main checkout. + * **Command working directory** : Claude Code blocks a Bash, PowerShell, or Monitor command whose working directory resolves to the main checkout, or whose working directory it can’t verify stays outside it. + * **Git redirects** : Claude Code blocks a Bash or Monitor command that redirects git into the main checkout, whether through `git -C`, `--git-dir`, a `GIT_DIR` or `GIT_WORK_TREE` variable, or a `cd` into the main checkout before running git. Claude Code also blocks a command it can’t verify stays inside the worktree. For PowerShell commands, Claude Code applies only the working-directory check. + +The checks apply to the repository you launched Claude Code from, including the main checkout a linked worktree is linked from. Claude sees each refusal as a tool error that names the worktree and says how to proceed. ## @@ -235,7 +253,7 @@ Troubleshooting -The errors below occur when Claude Code creates a worktree or enters one at startup. +Claude Code reports the errors below when it creates a worktree, enters one at startup, or returns a resumed session to one. ### @@ -252,6 +270,45 @@ Worktree creation fails on a symlinked path Claude Code refuses to create a worktree when `.claude`, `.claude/worktrees`, or the worktree directory itself is a symlink, and the error names the symlinked path. Remove the symlink and retry. Before v2.1.212, if the repository already contained a committed symlink at one of those paths, worktree creation followed it and could create files outside the repository. + +### + +​ + +Claude Code refuses to use a worktree + +An error starting `Refusing to use <path> as an isolation worktree` means Claude Code checked the directory’s git identity before adopting it as a session’s or subagent’s isolated checkout, and declined it. The check runs whether Claude Code is creating the worktree, entering an existing one, or reusing one from an earlier run. In most cases the rest of the message says the directory’s git metadata resolves into the main checkout: for example, its `.git` file points at the main repository’s own `.git` directory, or git resolves its working tree to the main checkout through a `core.worktree` redirect. From such a directory, an ordinary git command such as `git reset --hard` would act on the main checkout instead of the worktree. Claude Code also refuses when the directory has a `.git` entry it can’t read, rather than assuming the worktree is safe. Claude Code leaves the refused directory in place, since it may hold work. Match the message to its recovery, whether it follows `Refusing to use <path>` or appears in a resume message; some endings occur only in resume messages: + + * **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`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. + +### + +​ + +The session resumes outside its worktree + +When an interactive resume can’t return the session to its worktree, Claude Code says so with one of the messages below. + +Message starts with| What happened and what to do +---|--- +`Your worktree <path> no longer exists`| The worktree directory was removed. The session continues in the current directory without isolation, and Claude Code clears the worktree binding. No action needed. +`Could not verify your worktree <path> this time`| Claude Code couldn’t verify the worktree, usually for a transient reason; the binding is kept, and the session continues in the current directory without isolation. Resume again to retry; if it keeps happening, enter the worktree in a new session and match the refusal message under Claude Code refuses to use a worktree, which can name the main checkout’s metadata rather than the worktree’s. +`Did not re-enter your worktree <path>`| Claude Code refused the worktree binding as unsafe; it clears the binding and the session continues without isolation. The message includes the specific refusal: match it under Claude Code refuses to use a worktree, since the fix is recreation for some refusals and a path change for others. +`Could not re-enter your worktree <path>`| Claude Code couldn’t vouch for the worktree from where you launched, most commonly because you launched from inside it; the binding is kept. The rest of the message names the fix; match it under Claude Code refuses to use a worktree. + +In [non-interactive mode](</docs/en/headless>) with `-p`, and on resumes the [Agent SDK](</docs/en/agent-sdk/sessions>) runs, Claude Code stops the resume with a stderr error for every refusal except a gone worktree, instead of continuing without isolation, and the messages take different shapes from the ones in the table above: + + * `Error: cannot resume into worktree <path>: ...This session was not started.` for a refusal the table shows as `Did not re-enter` + * `Error: could not verify worktree <path> for this resume, so the resume was aborted...` for `Could not verify` + * `Error: ...The worktree binding is kept.` for `Could not re-enter` + * `Notice: the worktree <path> for this session no longer exists...` for a gone worktree; Claude Code prints it and continues the session, as an interactive resume does + +The refusal ending embedded in each error is shared with the interactive notices, so it still matches its entry under Claude Code refuses to use a worktree. ##