One read of Claude Code CLIclaude-code-20261120T233701Z
26 pages moved out of 205 read.
Pages moved
26
significant first
Pages read
205
in this capture
Captured
23:37 UTC
Corpus hash
2dc11ceee6b6
corpus-hash
What this read moved
1-25 of 26, page 1 of 2This capture is too large to show at once. Changes 1-25 of 26 are below, significant first; the rest are on the following screens.
admin-setup Changed · +5 / -1 lines
from line 49
4949
5050Claude Code fetches server-managed settings at startup and refreshes them hourly during the session, with no endpoint infrastructure to deploy. 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](https://code.claude.com/docs/en/claude-apps-gateway), or use one of the file-based or OS-level mechanisms instead.
5151
52If you set your provider or gateway at claude.ai under **Organization settings > Desktop 3P**, see [which settings take priority](https://claude.com/docs/third-party/claude-desktop/admin-console-claude-code#which-settings-take-priority) in the Enterprise Admin Console guide.
53
5254If your organization mixes providers, configure [server-managed settings](https://code.claude.com/docs/en/server-managed-settings.md) for claude.ai users plus a [file-based or plist/registry fallback](https://code.claude.com/docs/en/managed-settings.md#delivery-mechanisms) so other users still receive managed policy.
5355
5456The 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.
from line 97
9597| [Customization lockdown](https://code.claude.com/docs/en/settings-reference.md#strictpluginonlycustomization) | Block skills, agents, hooks, and MCP servers from user and project sources. Locking skills also stops the [skills your developers enable on claude.ai](https://code.claude.com/docs/en/skills.md#where-synced-skills-load) from syncing | `strictPluginOnlyCustomization` |
9698| [Disable claude.ai sync](https://code.claude.com/docs/en/settings-reference.md#syncclaudeaiskills) | Stop Claude Code from loading the [skills](https://code.claude.com/docs/en/skills.md#how-synced-skills-behave) and [plugins](https://code.claude.com/docs/en/plugins/loading.md#synced-plugins) your developers enable on claude.ai. If you turn off Skills for your organization on claude.ai, Claude Code stops syncing both, and on v2.1.273 or later it also removes the ones it already synced. To stop either one without turning Skills off, set its key to `false` in managed settings | `syncClaudeAiSkills`, `syncClaudeAiPlugins` |
9799| [Hook restrictions](https://code.claude.com/docs/en/settings-reference.md#allowmanagedhooksonly) | Restrict which hooks run and restrict HTTP hook URLs; see [what runs under `allowManagedHooksOnly`](https://code.claude.com/docs/en/settings-reference#what-runs-under-allowmanagedhooksonly) for the full effect list | `allowManagedHooksOnly`, `allowedHttpHookUrls` |
98| [Login enforcement](https://code.claude.com/docs/en/settings-reference.md#forceloginmethod) | Restrict login to a specific method or Anthropic organization. The method restriction applies across the VS Code extension, Agent SDK, `claude setup-token`, and `/install-github-app`, and the terminal's interactive login screen, reached by `/login` or first-run onboarding, pre-selects the method without enforcing it; Claude Code verifies the organization for claude.ai account logins in the terminal, VS Code extension, and Agent SDK, and doesn't check it for Claude Console logins or for [gateway](https://code.claude.com/docs/en/claude-apps-gateway) sign-in. Before v2.1.212, only terminal logins applied either key. When set, sessions authenticated by `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, or `apiKeyHelper` are blocked at startup; cloud provider sessions aren't affected unless one of those credentials, or an API key saved by an earlier Claude Console login, is also present | `forceLoginMethod`, `forceLoginOrgUUID` |
100| [Login method enforcement](https://code.claude.com/docs/en/settings-reference.md#forceloginmethod) | Restrict login to a specific method. The restriction applies across the VS Code extension, Agent SDK, `claude setup-token`, and `/install-github-app`. Don't rely on a `claudeai` or `console` value to block other logins at the terminal's interactive login screen, reached by `/login` or first-run onboarding. Before v2.1.212, only terminal logins applied this key or `forceLoginOrgUUID` | `forceLoginMethod` |
101| [Login organization enforcement](https://code.claude.com/docs/en/settings-reference.md#forceloginorguuid) | Restrict claude.ai logins to your organization in the terminal, VS Code extension, and Agent SDK. Don't rely on this key to restrict the organization for Claude Console logins. Claude Code doesn't check it for [gateway](https://code.claude.com/docs/en/claude-apps-gateway) sign-in | `forceLoginOrgUUID` |
102| [Credentials the login keys block](https://code.claude.com/docs/en/authentication.md#restrict-login-to-your-organization) | With either key set, sessions authenticated by `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, or `apiKeyHelper` are blocked at startup. Cloud provider sessions aren't affected unless one of those credentials, or an API key saved by an earlier Claude Console login, is also present | `forceLoginMethod`, `forceLoginOrgUUID` |
99103| [Provider restrictions](https://code.claude.com/docs/en/settings-reference.md#allowedproviders) | Limit which API providers a machine may use. A session on a provider that isn't listed is refused at startup, at login, and when it next contacts the API. Requires Claude Code v2.1.285 or later | `allowedProviders` |
100104| [Disable agent view](https://code.claude.com/docs/en/agent-view.md#how-background-sessions-are-hosted) | Turn off `claude agents`, `--bg`, `/background`, and the on-demand supervisor | `disableAgentView` |
101105| [Configure the corporate launcher](https://code.claude.com/docs/en/corporate-launcher.md) | Prefix the [background-agent supervisor](https://code.claude.com/docs/en/agent-view.md#how-background-sessions-are-hosted), its workers, and the [other covered background processes](https://code.claude.com/docs/en/corporate-launcher.md#what-the-launcher-covers) with a required corporate launcher instead of turning agent view off | `processWrapper` |
artifacts Changed · +2 / -6 lines
from line 176
176176Read the comments on https://claude.ai/code/artifact/5fbea6f3-... and make the changes the commenters ask for.
177177```
178178
179If Claude tells you it can't read comments, confirm your version, your session, and your feature-flag setting:
179Before v2.1.326, Claude needs [feature-flag fetching](https://code.claude.com/docs/en/env-vars.md#features-that-need-feature-flag-fetching) on to read or watch comments.
180180
181* You're running Claude Code v2.1.221 or later.
182* You're not in your first session since you installed Claude Code or upgraded from a version before v2.1.221. In that [first session after an install or upgrade](https://code.claude.com/docs/en/env-vars.md#first-session-after-an-install-or-upgrade), Claude might not be able to read comments yet; start a new session and ask again.
183* You haven't turned feature-flag fetching off.
184
185181### Let Claude reply to comments on its own
186182
187183After your session publishes an artifact, Claude Code watches that artifact for comments. When someone who can edit the artifact sends a comment to Claude, it reaches your session right away, and Claude can read the thread and reply without you asking.
188184
189You need Claude Code v2.1.228 or later. If you turned [feature-flag fetching](https://code.claude.com/docs/en/env-vars.md#features-that-need-feature-flag-fetching) off, Claude Code doesn't watch for comments.
185You need Claude Code v2.1.228 or later.
190186
191187Your [permission mode](https://code.claude.com/docs/en/permission-modes.md) decides what Claude does when a sent comment arrives:
192188
authentication Changed · +14 / -7 lines
from line 22
2222* **Claude Pro, Max, or Ultra subscription**: log in with your claude.ai account. Subscribe at [claude.com/pricing](https://claude.com/pricing?utm_source=claude_code\&utm_medium=docs\&utm_content=authentication_pro_max).
2323* **Claude for Teams or Enterprise**: log in with the claude.ai account your team admin invited you to.
2424* **Claude Console**: log in with your Console credentials. Your admin must have [invited you](#claude-console-authentication) first. You can sign in with or without [creating an API key](#sign-in-without-an-api-key).
25* **Cloud providers**: if your organization uses [Amazon Bedrock](https://code.claude.com/docs/en/amazon-bedrock.md), [Google Cloud's Agent Platform](https://code.claude.com/docs/en/google-vertex-ai.md), or [Microsoft Foundry](https://code.claude.com/docs/en/microsoft-foundry.md), set the required environment variables before running `claude`, or select **3rd-party platform** at the login prompt, which launches an interactive setup wizard for Bedrock and Vertex AI. No browser login is needed.
25* **Cloud providers**: if your organization uses [Amazon Bedrock](https://code.claude.com/docs/en/amazon-bedrock.md), [Google Cloud's Agent Platform](https://code.claude.com/docs/en/google-vertex-ai.md), or [Microsoft Foundry](https://code.claude.com/docs/en/microsoft-foundry.md), set the required environment variables before running `claude`. You can also select **3rd-party platform** at the login prompt, which launches an interactive setup wizard for Bedrock and Agent Platform.
2626* **Cloud gateway**: if your organization runs a self-hosted [Claude apps gateway](https://code.claude.com/docs/en/claude-apps-gateway), sign in with corporate SSO through `/login` or [from VS Code](https://code.claude.com/docs/en/vs-code.md#sign-in-to-a-claude-apps-gateway). The gateway-issued token is the session's only credential.
27* **Enterprise Admin Console**: if an Owner [turned on this sign-in](https://claude.com/docs/third-party/claude-desktop/admin-console-claude-code#turn-on-sign-in-from-claude-code) for your organization's provider or gateway, run `claude auth login` in your shell and select your organization in the browser. To confirm, look for `Signed in to the organization` in the terminal. For the Claude Code version you need, see [Before you start](https://claude.com/docs/third-party/claude-desktop/admin-console-claude-code#before-you-start).
2728
2829Admins can direct which login method developers use and require claude.ai logins to belong to a specific organization; see [Restrict login to your organization](#restrict-login-to-your-organization).
2930
from line 121
120121
121122In practice, the profile stores an OAuth login while an API key is a static credential. Claude Code refreshes the profile's login automatically, and when refresh fails, requests fail with an [expired profile login error](https://code.claude.com/docs/en/errors.md#anthropic-profile-login-expired) until you sign in again.
122123
123You don't get the choice on every machine. Claude Code creates an API key without asking in these cases:
124You won't see the keyless option in these cases:
124125
125126* You run against a cloud provider, such as [Amazon Bedrock, Google Cloud's Agent Platform, or Microsoft Foundry](https://code.claude.com/docs/en/third-party-integrations.md) or [Claude Platform on AWS](https://code.claude.com/docs/en/claude-platform-on-aws.md)
126127* Any settings file sets [`forceLoginOrgUUID`](#restrict-login-to-your-organization), or sets `forceLoginMethod` to `"claudeai"`
from line 168
167168
168169To require that developers' claude.ai logins belong to a specific Anthropic organization, set [`forceLoginMethod`](https://code.claude.com/docs/en/settings-reference#forceloginmethod) and [`forceLoginOrgUUID`](https://code.claude.com/docs/en/settings-reference#forceloginorguuid) in [managed settings](https://code.claude.com/docs/en/managed-settings.md). Set `forceLoginOrgUUID` to your organization ID, shown in [claude.ai admin settings](https://claude.ai/admin-settings/organization) for Claude for Teams or Enterprise organizations. Claude Code reports an error for a claude.ai login to any other organization and exits at startup if the claude.ai credential in use belongs to an organization that isn't listed.
169170
170For Claude Console logins, Claude Code uses `forceLoginOrgUUID` to pre-select the organization on the Console sign-in page when you set it to a single Console organization ID, shown at [platform.claude.com/settings/organization](https://platform.claude.com/settings/organization). It doesn't check which organization the resulting Console credential belongs to, at login or at startup. A developer who logged in with a Console account before you deployed the keys stays logged in, and that saved key is blocked on a machine that also requires the [gateway](https://code.claude.com/docs/en/claude-apps-gateway) sign-in or in a session that selects a cloud provider.
171If you set `forceLoginOrgUUID` to a single Console organization ID, Claude Code pre-selects that organization on the Claude Console sign-in page. Find the ID at [platform.claude.com/settings/organization](https://platform.claude.com/settings/organization).
171172
172If you set `forceLoginOrgUUID` in any settings file, Claude Code stops offering the [keyless Console sign-in](#sign-in-without-an-api-key) in the sessions that file applies to and creates an API key instead. To direct developers to claude.ai sign-in instead, set `forceLoginMethod` to `"claudeai"`.
173> [!NOTE]
174>
175> At startup, Claude Code doesn't check which organization a saved Console credential belongs to. Don't rely on `forceLoginOrgUUID` to restrict the organization for Console logins. A developer already logged in to Console stays logged in after you deploy `forceLoginMethod` or `forceLoginOrgUUID`. However, a saved Console API key is blocked on a machine that also requires the [gateway](https://code.claude.com/docs/en/claude-apps-gateway) sign-in or in a session that selects a cloud provider.
173176
174On Claude Code v2.1.212 or later, every login path listed here applies `forceLoginMethod`. On the terminal's interactive login screen, reached by `/login` or first-run onboarding, Claude Code pre-selects a `claudeai` or `console` method without enforcing it, so even with `forceLoginMethod` set to `"claudeai"`, a developer can still complete a Console login there.
177If you set `forceLoginOrgUUID` in any settings file, Claude Code stops offering the [keyless Console sign-in](#sign-in-without-an-api-key) in the sessions that file applies to. To direct developers to claude.ai sign-in instead, set `forceLoginMethod` to `"claudeai"`.
175178
179On Claude Code v2.1.212 or later, every login path listed here applies `forceLoginMethod`. On the terminal's interactive login screen, reached by `/login` or first-run onboarding, Claude Code pre-selects a `claudeai` or `console` method. Don't rely on either value to block other logins there.
180
176181The paths differ on `forceLoginOrgUUID`:
177182
178183* **Terminal, [VS Code extension](https://code.claude.com/docs/en/vs-code.md), and Agent SDK logins**: verify `forceLoginOrgUUID` for claude.ai account logins
from line 272
2672727. Subscription OAuth credentials from `/login`. This is the default for Claude Pro, Max, Ultra, Team, and Enterprise users.
268273
269274A signed-in [Claude apps gateway](https://code.claude.com/docs/en/claude-apps-gateway) session sits outside this list: it is a provider selection like Amazon Bedrock or Google Cloud's Agent Platform, and it outranks them. When a gateway session exists, the CLI authenticates with the gateway token even if `CLAUDE_CODE_USE_BEDROCK`, `CLAUDE_CODE_USE_VERTEX`, or `CLAUDE_CODE_USE_FOUNDRY` is set, and credential sources above such as the bearer token, API key, `apiKeyHelper`, and profiles are not used.
275
276If your organization sets your provider or gateway in the Enterprise Admin Console and you [signed in to that organization](#log-in-to-claude-code), see [where your requests go](https://claude.com/docs/third-party/claude-desktop/admin-console-claude-code#how-console-settings-reach-claude-code) instead.
270277
271278If your machine's [managed settings](https://code.claude.com/docs/en/managed-settings.md) set [`forceLoginMethod`](https://code.claude.com/docs/en/settings-reference#forceloginmethod) to `"gateway"` or set [`forceLoginGatewayUrl`](https://code.claude.com/docs/en/settings-reference#forcelogingatewayurl), and you don't select a cloud provider through a variable such as `CLAUDE_CODE_USE_BEDROCK` or `CLAUDE_CODE_USE_VERTEX`, your session uses only the gateway sign-in. Claude Code skips the other credential sources and asks you to sign in with `/login`. See [Administrator policy requires a Cloud gateway sign-in](https://code.claude.com/docs/en/errors.md#administrator-policy-requires-a-cloud-gateway-sign-in) for what you see with each leftover credential. Requires Claude Code v2.1.261 or later, or v2.1.265 or later on a machine that sets only `forceLoginGatewayUrl`.
272279
code-mode Changed · +11 / -8 lines
from line 38
3838* **Resuming**: you can resume a Code Mode session only in the terminal, with Code Mode on
3939* **Auto mode**: auto mode's classifier [reviews the code, not each tool call](#permission-checks)
4040* **Long-running code**: unless [code can run in the background](#long-running-code), you wait for it to finish, and it stops after ten minutes
41* **Hooks**: you can see [tool calls refused](#tool-call-refused-by-a-hook) when a `PreToolUse` hook can't run or times out
41* **Hooks**: you can see [tool calls refused](#tool-call-refused-by-a-hook) when a `PreToolUse` hook doesn't finish, for example after a timeout
4242* **Unavailable features**: you can't use [Remote Control](https://code.claude.com/docs/en/remote-control.md), [Claude in Chrome](https://code.claude.com/docs/en/chrome.md), or [computer use](https://code.claude.com/docs/en/computer-use.md)
4343* **Moving the session**: you can't move the session to the Desktop app or turn it into a [background session](https://code.claude.com/docs/en/agent-view.md), and `/fork` can't start a background copy
4444
from line 48
4848* **Account**: a Claude subscription or Console account. You can't use Code Mode through a gateway, Amazon Bedrock, Claude Platform on AWS, Google Cloud's Agent Platform, Microsoft Foundry, or [Claude Models on Google Cloud (Anthropic managed)](https://code.claude.com/docs/en/claude-models-on-google-cloud-anthropic-managed.md)
4949* **Organization**: your organization doesn't use the [HIPAA configuration](https://code.claude.com/docs/en/hipaa-setup.md) or [zero data retention](https://code.claude.com/docs/en/zero-data-retention.md)
5050* **Model**: Claude Opus 5.5, Sonnet 5.5, Haiku 5.5, or Fable 5.2
51* **Surface**: an interactive `claude` session in a terminal. Code Mode doesn't work with `-p`, the Agent SDK, the VS Code panel, the Desktop app, or cloud sessions
51* **Surface**: an interactive `claude` session in a terminal. Code Mode doesn't work with the VS Code panel, the Desktop app, or cloud sessions
5252* **Agent teams**: to use Code Mode with [agent teams](https://code.claude.com/docs/en/agent-teams.md) on, you need v2.1.326 or later. Teammates run in Code Mode in the default [in-process display mode](https://code.claude.com/docs/en/agent-teams.md#choose-a-display-mode), and start without it in split panes
5353* **Installation**: the [native build](https://code.claude.com/docs/en/setup.md) of Claude Code
5454* **Windows**: [Git for Windows](https://git-scm.com/downloads/win) is installed
from line 320
320320
321321### Tool call refused by a hook
322322
323If Claude reports a refused tool call, ask it for the error text. These errors mean that a `PreToolUse` hook didn't give a decision, which refuses the call even when [`onFailure`](https://code.claude.com/docs/en/hooks#block-the-action-when-a-hook-fails) is unset:
323If Claude reports a refused tool call, ask it for the error text. These errors mean that your [`PreToolUse` hook](https://code.claude.com/docs/en/hooks#pretooluse) didn't give a decision:
324324
325* **`the hook failed`**: on a call from code, your hook couldn't start, was killed, exited with 126, 127, or a code above 128, or returned an HTTP error or invalid output. Fix the hook
326* **`the hook did not finish`**: your hook timed out on a call from code, or on any other tool call once Claude has run code in the session. Raise the hook's [`timeout`](https://code.claude.com/docs/en/hooks#common-fields)
325* **`the hook did not finish`**: your hook timed out, or your agent hook ended without a decision. After a timeout, raise the hook's [`timeout`](https://code.claude.com/docs/en/hooks#common-fields). For an agent hook that gives no decision, move the check to a `command` hook. You can see this error on calls from code, and on other tool calls after Claude runs code in the session
326* **`the hook failed`**: on a call from code, your hook couldn't start, was killed, exited with 126, 127, or a code above 128, or returned an HTTP error or invalid output. Fix the hook. You can see this error before v2.1.329. On later versions it's rare: one cause is [feature-flag fetching](https://code.claude.com/docs/en/env-vars.md#features-that-need-feature-flag-fetching) turning off during a session, after Claude has run code
327327
328To let calls go ahead when a `command` or `http` hook fails or times out, set `"onFailure": "continue"` on it. If a `command` hook exits with an ordinary code such as 1, the call goes ahead unless you set `"onFailure": "block"`.
328On v2.1.329 or later, expect a call from code to run by default after a hook failure other than `the hook did not finish`. To choose whether the call runs, use a `command` or `http` hook and set [`onFailure`](https://code.claude.com/docs/en/hooks#block-the-action-when-a-hook-fails) on it:
329
330* **To stop the call after a timeout or failure**: set `"onFailure": "block"`. Do this for a hook that guards calls
331* **To let the call run after a timeout or failure**: set `"onFailure": "continue"`
329332
330333### Code output withheld by a hook
331334
errors Changed · +5 / -1 lines
This page is larger than the 256 KiB this site keeps, so one side of the diff below stops where the stored text does.
from line 243
243243| `Error: bypassPermissions not supported in restricted mode` | [Restricted mode](https://code.claude.com/docs/en/permission-modes.md#restricted-mode-refuses-bypasspermissions) |
244244| `Session was started with bypass permissions, so plan mode won't ask before most edits or commands` | [Plan mode](https://code.claude.com/docs/en/permission-modes.md#analyze-before-you-edit-with-plan-mode) |
245245| `Cloud sessions cannot be created from a --restricted session` | [Command-line errors](#cloud-sessions-cannot-be-created-from-a-restricted-session) |
246| `--fork-session can't fork a cloud session, so nothing was opened or sent` | [Errors when sending to a cloud session](https://code.claude.com/docs/en/claude-code-on-the-web.md#errors-when-sending-to-a-cloud-session) |
246247| `Cloud sessions are disabled by your organization's policy` | [Command-line errors](#cloud-sessions-are-disabled-by-your-organizations-policy) |
247248| `Cloud sessions use your claude.ai login`, at the end of a policy denial that names a credential | [Command-line errors](#cloud-sessions-use-your-claude-ai-login) |
248249| `Couldn't verify your organization's policy for cloud sessions` | [Command-line errors](#couldnt-verify-your-organizations-policy-for-cloud-sessions) |
from line 464
463464| `Claude Code did not finish starting` | [Wrapper and IDE errors](#subprocess-initialization-did-not-complete-within-60000ms) |
464465| `The connection to Claude Code ended before this message completed` | [Wrapper and IDE errors](#the-connection-to-claude-code-ended-before-this-message-completed) |
465466| `Could not locate the Claude CLI on PATH` | [Wrapper and IDE errors](#could-not-locate-the-claude-cli-on-path) |
467| `Claude Code could not be started from <command>: it is the <system> build, and this computer needs the <build> build` | If you set [`claudeCode.claudeProcessWrapper`](https://code.claude.com/docs/en/vs-code#extension-settings), point it at a program built for `<build>`. Otherwise, install the VS Code extension package for `<build>`. |
466468| `The Claude Code program for this computer, the <build> build, could not be found` | [Wrapper and IDE errors](#the-claude-code-program-for-this-computer-could-not-be-found) |
467469| `Restored the code, but skipped N files` | [Rewind warnings and errors](#restored-the-code-but-skipped-files) |
468470| `No files were restored: N files failed (backup missing, or the file could not be updated)` | [Rewind warnings and errors](#no-files-were-restored) |
from line 2443
24412443* **If the server fails again**: if the message differs from this one, see [what to check when an MCP server doesn't connect](https://code.claude.com/docs/en/mcp-quickstart.md#troubleshooting). If this message comes back although your computer stayed awake and nothing changed its clock, see [Report an error](#report-an-error).
24422444
24432445Before v2.1.307, Claude Code showed a timeout message such as `MCP server "<name>" connection timed out after <N>ms` instead of this one.
2444
2445## Request errors
2446
2447These errors relate to the content of your request. Most come back from the API after it rejected the request; a few are produced locally by Claude Code before any request is sent.
2448
2449### Prompt is too long
2450
2451The conversation plus attached files exceeds the model's context window.
2452
2453```text theme={null}
2454Prompt is too long
2455```
2456
2457In an interactive session, Claude Code shows this error as:
2458
2459```text theme={null}
2460Context limit reached · /compact or /clear to continue
2461```
2462
2463The line names only `/clear` when [`DISABLE_COMPACT`](https://code.clau
hooks Changed · +4 / -4 lines
This page is larger than the 256 KiB this site keeps, so one side of the diff below stops where the stored text does.
from line 66
6666
6767> [tab] macOS/Linux
6868>
69> The `matcher` narrows to Bash tool calls and [Monitor commands](#match-monitor-commands), and the `if` condition narrows further to Bash subcommands matching `rm *`, so `block-rm.sh` only spawns when both filters match:
69> The `matcher` narrows to Bash tool calls and [Monitor commands](#match-monitor-commands), and the `if` condition narrows further to Bash subcommands matching `rm *`:
7070>
7171> ```json theme={null}
7272> {
from line 990
990990
991991> [!NOTE]
992992>
993> If you use Code Mode, failures on `PreToolUse` work differently. See [Tool call refused by a hook](https://code.claude.com/docs/en/code-mode.md#tool-call-refused-by-a-hook).
993> If you use Code Mode, timeouts on `PreToolUse` work differently. See [Tool call refused by a hook](https://code.claude.com/docs/en/code-mode.md#tool-call-refused-by-a-hook).
994994
995995#### Failed hooks on Windows without Git Bash
996996
from line 1225
12251225* `PostToolUse`: `updatedToolOutput` replaces the tool's result. In a [Cowork](https://claude.com/docs/cowork/overview) cloud session, Claude Code ignores `updatedToolOutput` when the tool is `AskUserQuestion` or `ExitPlanMode`, and Claude reads the original answer or plan. See [PostToolUse decision control](#posttooluse-decision-control)
12261226* `UserPromptSubmit`: can't replace the prompt; it only injects `additionalContext` alongside it
12271227
1228For redaction or transformation use cases, intercept at `PreToolUse` for outbound tool inputs and `PostToolUse` for the results of successful calls. `PostToolUseFailure` can't rewrite a result, so a failing command's output reaches Claude unchanged.
1228For redaction or transformation use cases, intercept at `PreToolUse` for outbound tool inputs and `PostToolUse` for the results of successful calls. `PostToolUseFailure` can't rewrite a result, so it can't redact a failing command's output.
12291229
12301230Here are examples of each pattern in action:
12311231
from line 1782
17821782
17831783### PreToolUse
17841784
1785Runs after Claude creates tool parameters and before processing the tool call. Matches on any tool name except `EndConversation`: built-in tools such as `Bash`, `PowerShell`, `Edit`, `Write`, `Read`, `Glob`, `Grep`, `Agent`, `Workflow`, `WebFetch`, `WebSearch`, `AskUserQuestion`, and `ExitPlanMode`, and any [MCP tool names](#match-mcp-tools).
1785Runs after Claude creates tool parameters and before processing the tool call. Matches on tool names other than `EndConversation`: built-in tools such as `Bash`, `PowerShell`, `Edit`, `Write`, `Read`, `Glob`, `Grep`, `Agent`, `Workflow`, `WebFetch`, `WebSearch`, `AskUserQuestion`, and `ExitPlanMode`, and any [MCP tool names](#match-mcp-tools).
17861786
17871787To run a hook when a specific file changes on disk, whatever wrote it, use [FileChanged](#filechanged) instead of matching file-editing tools by name. Unlike PreToolUse, Claude Code runs FileChanged hooks after the change, and they have no decision control, so they can't block the write.
17881788
from line 3685
36853685```json theme={null}
36863686{
36873687 "session_id": "abc123",
3688 "tran
3688 "transcript_path": "/Users/.../.claude/projects/.../00893aaf-19fa-4
mcp Changed · +15 / -3 lines
#### Choose a time to live and a poll interval
from line 500
500500
501501> [!NOTE]
502502>
503> MCP tasks are in public beta in the Claude Code CLI and require Claude Code v2.1.304 or later. [What a call needs to become an MCP task](#requirements-for-mcp-tasks) lists the sessions and servers that get them.
503> MCP tasks are in public beta and require Claude Code v2.1.304 or later. [What a call needs to become an MCP task](#requirements-for-mcp-tasks) lists the sessions and servers that get them.
504504
505505#### Stop an MCP task or get its result
506506
from line 541
541541* The server supports tasks
542542* The server is an HTTP, stdio, or claude.ai connector server connected on [protocol revision 2026-07-28](#mcp-client-runtimes). Setting [`MCP_SDK_GENERATION=v1` or `MCP_PROTOCOL_NEGOTIATION=legacy`](https://code.claude.com/docs/en/env-vars) rules that out
543543* The session [fetches feature flags](https://code.claude.com/docs/en/env-vars.md#features-that-need-feature-flag-fetching), so not on a third-party provider such as Amazon Bedrock, and not with telemetry or flag fetching turned off
544* Anthropic has turned MCP tasks on for your kind of session. On v2.1.304 or later that covers terminal CLI sessions, [Agent SDK](https://code.claude.com/docs/en/agent-sdk/overview.md) sessions, and [GitHub Actions](https://code.claude.com/docs/en/github-actions.md) runs. Other surfaces, such as the [VS Code extension](https://code.claude.com/docs/en/vs-code.md) and the [desktop app](https://code.claude.com/docs/en/desktop.md), don't have MCP tasks
544* Anthropic has turned MCP tasks on for your kind of session:
545 * Terminal CLI sessions, [Agent SDK](https://code.claude.com/docs/en/agent-sdk/overview.md) sessions, and [GitHub Actions](https://code.claude.com/docs/en/github-actions.md) runs have them on v2.1.304 or later
546 * [Cloud sessions](https://code.claude.com/docs/en/claude-code-on-the-web.md), including ones you open in the desktop app, have them only if Anthropic has turned them on for your account or organization. You can't turn them on or look up their state in a setting
547 * Some other Claude Code surfaces, such as the [VS Code extension](https://code.claude.com/docs/en/vs-code.md) and local sessions in the [desktop app](https://code.claude.com/docs/en/desktop.md), don't have them
545548* The call comes from the main conversation, not from a [subagent](https://code.claude.com/docs/en/sub-agents.md)
546549* Either the session is interactive, or an [Agent SDK](https://code.claude.com/docs/en/agent-sdk/overview.md) session or a `claude -p` run reading `--input-format stream-json` has:
547550 * [`CLAUDE_AUTO_BACKGROUND_TASKS`](https://code.claude.com/docs/en/env-vars) at `1`
from line 612
609612 "createdAt": "2026-10-22T14:03:07Z",
610613 "lastUpdatedAt": "2026-10-22T14:03:07Z",
611614 "ttlMs": null,
612 "pollIntervalMs": 5000
615 "pollIntervalMs": 10000
613616}
614617```
615618
from line 659
656659| JSON-RPC error `-32602` | Read as an unknown task ID. For a task in the background, Claude Code keeps asking for up to five minutes, then reports the outcome to Claude as unknown |
657660| `tasks/cancel` | Sent, for example, when Claude or the person stops the task while the server is connected. Not sent on exit |
658661| `tasks/result`, `tasks/list`, `notifications/tasks` | Not used, so put the outcome in your `tasks/get` responses |
662
663#### Choose a time to live and a poll interval
664
665Keep a finished task's result for at least an hour, and longer if you can. A person can exit while a remote server's task runs and [resume the session](#exit-clear-or-resume-while-an-mcp-task-runs) later. Claude then gets the result only if your server still knows the task.
666
667Set `ttlMs` and `pollIntervalMs`, both in milliseconds, in your `tools/call` answer and your `tasks/get` responses:
668
669* **`ttlMs`**: report how long your server keeps the task, counted from the task's creation. Send your longest run time plus the time you keep the result, such as `5400000` for a 30-minute job and one hour. Send `null` if your server keeps tasks with no time limit
670* **`pollIntervalMs`**: send 10000 to 30000 for a job that runs longer than a minute, so your server answers fewer status checks. For a shorter job, send 2000 so Claude gets the result sooner
659671
660672### Plugin-provided MCP servers
661673
plugins/mods/api Changed · +5 / -2 lines
from line 183
183183
184184## Run work in the background
185185
186Work that outlives one event, such as checking on something once a minute, runs on a timer you start from `session.start`. A hook itself runs for one event and has a [time limit](https://code.claude.com/docs/en/plugins/mods/reference.md#limits) on its own execution time. Time spent waiting on `next` or on a mods API call doesn't count, except a `$.clock.sleep`. `$.clock.every` and `$.clock.after` take the place of `setInterval` and `setTimeout`, with the delay in milliseconds first: `$.clock.after(5000, fn)` calls `fn` once, five seconds from now. Each returns a timer with a `cancel()` method, and `await $.clock.now()` gives the time in milliseconds.
186Work that outlives one event, such as checking on something once a minute, runs on a timer you start from `session.start`. A hook itself runs for one event and has a [time limit](https://code.claude.com/docs/en/plugins/mods/reference.md#limits) on its own execution time.
187187
188`$.clock.every` and `$.clock.after` take the place of `setInterval` and `setTimeout`, with the delay in milliseconds first: `$.clock.after(5000, fn)` calls `fn` once, five seconds from now. Each returns a timer with a `cancel()` method, and `await $.clock.now()` gives the time in milliseconds.
189
188190This hook looks up a pull request's checks once a minute and shows the result under the prompt. `summarize` is a function of your own that turns the command's JSON output into a few words:
189191
190192```javascript theme={null}
from line 419
417419| `$.settings` | `read()` resolves to all settings, merged into one object. With `{ source }` or `{ key }`, it resolves to [one source's settings or one key's value](#read-one-source-or-one-key) instead. |
418420| `$.session` | `messages()` returns the transcript as a list of `{ role, text, toolUses }`. Also the working directory, model, and more. [`usage()`](https://code.claude.com/docs/en/plugins/mods/reference#mods-api-methods) returns context window use and plan limits. |
419421| `$.mcp` | `call` a tool on a connected MCP server |
422| `$.wasm` | `compile('./engine.wasm')` turns a file of up to 64 MiB into a module you pass to `WebAssembly.instantiate`. Write the path as a string literal, relative to the calling file. Requires Claude Code v2.1.326 or later. |
420423
421424Files, processes, and requests have a few rules of their own:
422425
423* **Paths**: a relative path resolves against the working directory of the session, or of the subagent whose event the hook is handling
426* **Paths**: in `$.fs` and `$.process`, a relative path resolves against the working directory of the session, or of the subagent whose event the hook is handling
424427* **`$.fs.list`**: returns one directory's entries as `{ name, kind, size, isLink }` and isn't recursive
425428* **`$.process.run`**: takes an argument list and uses no shell. It resolves to `{ exitCode, stdout, stderr }` whatever the exit code. It rejects if the program can't start or is still running at the timeout, which is 30 seconds by default, so wrap it in `try` and `catch`.
426429* **`$.http.fetch`**: follows up to five redirects. On a redirect to a different origin, it keeps only the `accept`, `accept-language`, `content-type`, and `user-agent` request headers you set and drops the rest, so a request that depends on another header, such as `Authorization`, can fail after that redirect. The [limits](https://code.claude.com/docs/en/plugins/mods/reference.md#limits) give its timeout and body sizes.
plugins/mods/overview Changed · +5 / -4 lines
from line 39
3939* In a Claude Code session, run `/plugin install token-chart@your-org`.
4040* In your shell, run `claude plugin install token-chart@your-org`.
4141
42[Install plugins](https://code.claude.com/docs/en/plugins/install.md) covers marketplaces, scopes, the VS Code extension and the Desktop app, and [keeping plugins updated](https://code.claude.com/docs/en/plugins/install.md#keep-plugins-updated), all of which apply to a plugin that contains a mod without changes.
42[Install plugins](https://code.claude.com/docs/en/plugins/install.md) covers marketplaces, scopes, the VS Code extension and the Desktop app, and [keeping plugins updated](https://code.claude.com/docs/en/plugins/install.md#keep-plugins-updated).
4343
4444If you install or update a mod from your shell while a session is open, run `/reload-plugins` in that session to load it. Otherwise it loads the next time you start Claude Code.
4545
from line 180
180180
181181### Where mods run
182182
183A mod's hooks run in every kind of session that loads the plugin, whichever provider serves the model, including Amazon Bedrock, Google Cloud's Agent Platform, and Microsoft Foundry. Drawing is narrower: what a mod draws appears in the terminal, the Desktop app, and the VS Code extension. This table lists each place you might run Claude Code:
183A mod's hooks run whichever provider serves the model, including Amazon Bedrock, Google Cloud's Agent Platform, and Microsoft Foundry. This table lists each place you might run Claude Code:
184184
185185| Where you run Claude Code | Hooks run | What the mod draws appears |
186186| :- | :- | :- |
187187| `claude` in a terminal, including an editor's integrated terminal and the JetBrains plugin | Yes | Yes |
188| The Code tab of the Desktop app, except in a WSL session | Yes | Yes, except elements the [elements table](https://code.claude.com/docs/en/plugins/mods/reference.md#elements) marks terminal-only |
188| The Code tab of the Desktop app, except in a WSL or SSH session | Yes | Yes, except elements the [elements table](https://code.claude.com/docs/en/plugins/mods/reference.md#elements) marks terminal-only |
189189| A [WSL session](https://code.claude.com/docs/en/desktop-wsl.md) in the Desktop app | No, because plugins aren't available in WSL sessions | No |
190| An [SSH session](https://code.claude.com/docs/en/desktop.md#ssh-sessions) in the Desktop app, for a mod installed only on your computer | No, because Desktop doesn't copy its hooks to the remote machine | No |
190191| The VS Code extension's chat panel | Yes | Yes, with extension version 2.1.299 or later. A session that [doesn't fetch feature flags](https://code.claude.com/docs/en/env-vars.md#features-that-need-feature-flag-fetching), such as one on Amazon Bedrock, needs 2.1.304 or later. The [render sites](https://code.claude.com/docs/en/plugins/mods/reference.md#render-sites) and [elements](https://code.claude.com/docs/en/plugins/mods/reference.md#elements) tables mark what the panel draws. |
191192| `claude -p` and the [Agent SDK](https://code.claude.com/docs/en/agent-sdk/overview.md) | Yes | No |
192193| [Remote Control](https://code.claude.com/docs/en/remote-control.md) from claude.ai or the mobile app | Yes, in the session on your machine | In the terminal on your machine |
193| A [cloud session](https://code.claude.com/docs/en/claude-code-on-the-web.md) | Yes, for a plugin that [reaches the cloud session](https://code.claude.com/docs/en/cloud-environments.md#what-carries-over-from-your-setup) | No |
194| A [cloud session](https://code.claude.com/docs/en/claude-code-on-the-web.md) | Yes, for a plugin that [reaches the cloud session](https://code.claude.com/docs/en/cloud-environments.md#what-carries-over-from-your-setup) | Not in every session |
194195
195196A mod that draws can check which app it's running in, and fall back to a line in the transcript or a command's text reply where nothing draws.
196197
plugins/mods/reference Changed · +13 / -6 lines
from line 52
5252| :- | :- | :- |
5353| [`tool.call`](https://code.claude.com/docs/en/plugins/mods/events#guard-or-change-a-tool-call) | A tool is about to run | `next(e)`, `{ deny: reason }`, or `{ result }` |
5454| [`tool.check`](https://code.claude.com/docs/en/plugins/mods/events#where-settings-hooks-run-in-the-order) | Claude Code decides whether a tool call may run, after the `tool.call` and `PreToolUse` hooks. `next(e)` resolves to the decision the rules, the permission mode, and those hooks reached. | `next(e)` or `{ decision }`, with `decision` set to `allow`, `ask`, or `deny` and an optional `reason` |
55| `tool.judge` | [Auto mode](https://code.claude.com/docs/en/permission-modes.md#eliminate-prompts-with-auto-mode) is about to ask its classifier about a call. Requires Claude Code v2.1.326 or later. | `next(e)` or `{ decision }` |
56| `tool.run` | An allowed call is about to run. Requires Claude Code v2.1.326 or later. | `next(e)`, `{ deny: reason }`, or `{ result }` |
5557| `tool.describe` | Once for each tool, when its description is first sent to Claude. A second time for an MCP tool when Claude loads it through [tool search](https://code.claude.com/docs/en/mcp.md#scale-with-mcp-tool-search), with `e.description` set to the text Claude reads for the loaded tool. | `{ description }`, optionally with `isDeferred` set to `true` to put the tool behind tool search or `false` to load it upfront. Add [`breakPromptCache: true`](#break-prompt-cache) to send a changed description on the next turn. |
5658
5759#### Agent and organization fields on `tool.check`
from line 149
147149| `session.append` | Once for each row the conversation keeps, such as a prompt, a response block, a tool result, or a notice, before it's stored | `next({ ...e, message })` with a changed `message.content`, to rewrite the row's text blocks or the `content` of a `tool_result` block in it |
148150| `session.attach`, `session.detach` | Another app connects to or disconnects from the session | `next(e)` |
149151| `session.measure` | After each turn, and when a plan limit's percent used changes | `next(e)` |
152| `session.stop` | The user stops Claude, such as with Esc during a turn. Requires Claude Code v2.1.326 or later. | `next(e)` |
150153
151154### Subagents
152155
from line 188
185188
186189| Event | Fires when | A hook can return |
187190| :- | :- | :- |
188| [`plugin.register`](https://code.claude.com/docs/en/plugins/mods/admin#enforce-a-policy-with-a-mod-of-your-own) | A hooks module is about to load. `e.uses` lists its events, mods API calls, environment variables, and state, as `claude plugin validate` prints them. Each call is written without the `$.` prefix, such as `fs.read`. | `{ refuse: reason }` |
189| `engine.create` | The mods API is being built for this mod | A changed mods API, to add a namespace. A mod outside the `user` [tier](#the-hook-function) can also withhold one. |
191| [`plugin.register`](https://code.claude.com/docs/en/plugins/mods/admin#enforce-a-policy-with-a-mod-of-your-own) | A hooks module is about to load, or, on v2.1.326 or later, a plugin without one. `e.uses` lists the module's events, mods API calls, environment variables, and state, as `claude plugin validate` prints them. Each call is written without the `$.` prefix, such as `fs.read`. | `{ refuse: reason }`. On v2.1.326 or later, a refusal keeps out the whole plugin, and `next({ ...e, provides: { ...e.provides, modules: [] } })` keeps out only its hooks module. Earlier versions ignore `provides` and load the module. |
192| `engine.create` | The mods API is being built for this mod | A changed mods API, to add a namespace. A mod in the `prepend` or `append` [tier](#the-hook-function) can also withhold one. |
190193
191194When another mod's hook calls a method on a namespace you added in `engine.create`, your method's `$` calls run in that hook's context until every hook on that event returns. For example, a relative path resolves against that hook's working directory, and `$.prompt.submit` rejects while the turn is waiting on that hook. Calls your method makes after that run in your mod's own context.
192195
from line 239
236239| [`$.model`](https://code.claude.com/docs/en/plugins/mods/api#call-a-model) | `complete`, `fork`, `classify` |
237240| [`$.prompt`](https://code.claude.com/docs/en/plugins/mods/api#start-a-turn-from-a-background-job) | `submit`, `read`, `fill`, `suggest`, `compose`. Claude reads text from `submit({ text })` after a sentence that names your mod as the sender. `submit({ text, asUser: true })` sends the text as the user's own words, without that sentence. |
238241| `$.turn` | `abort` |
239| [`$.session`](https://code.claude.com/docs/en/plugins/mods/api#send-and-receive-messages-between-sessions) | `messages`, `cwd`, `root`, `model`, `turns`, `id`, `repo`, `surfaces`, `usage`, `version`, `compact`, `send`, `append`, `authorize`. `usage()` returns `{ startedAt, context, rateLimits, cost }`: `context` has `tokens`, `window`, and `percent`, and `rateLimits` is a list of `{ kind, percentUsed, resetsAt }`. |
242| [`$.session`](https://code.claude.com/docs/en/plugins/mods/api#send-and-receive-messages-between-sessions) | `messages`, `cwd`, `root`, `model`, `turns`, `id`, `repo`, `surfaces`, `usage`, `version`, `info`, `compact`, `send`, `append`, `authorize`. `info` requires Claude Code v2.1.326 or later. `usage()` returns `{ startedAt, context, rateLimits, cost }`: `context` has `tokens`, `window`, and `percent`, and `rateLimits` is a list of `{ kind, percentUsed, resetsAt }`. |
240243| `$.config` | `list`, `set` |
241244| [`$.settings`](https://code.claude.com/docs/en/plugins/mods/api#reach-files-processes-and-the-network) | `read` |
242245| [`$.env`](https://code.claude.com/docs/en/plugins/mods/api#reach-files-processes-and-the-network) | `get`, `set` |
from line 248
245248| [`$.state`](https://code.claude.com/docs/en/plugins/mods/interface#keep-a-value-in-\$-state) | Reactive state: `get`, `set`, with the helpers `atom`, `read`, `update`, `derive`, and `memberOf` imported from `claude-code` |
246249| [`$.clock`](https://code.claude.com/docs/en/plugins/mods/api#run-work-in-the-background) | `now`, `sleep`, `after`, `every` |
247250| [`$.http`](https://code.claude.com/docs/en/plugins/mods/api#reach-files-processes-and-the-network) | `fetch` |
248| [`$.process`](https://code.claude.com/docs/en/plugins/mods/api#reach-files-processes-and-the-network) | `run`, `spawn` |
251| [`$.process`](https://code.claude.com/docs/en/plugins/mods/api#reach-files-processes-and-the-network) | `run`, `spawn`, `hookEnv`. `hookEnv` requires Claude Code v2.1.326 or later. |
249252| [`$.mcp`](https://code.claude.com/docs/en/plugins/mods/api#reach-files-processes-and-the-network) | `call`, `connect`. `connect(server)` connects an MCP server that your own plugin's manifest lists. |
253| [`$.wasm`](https://code.claude.com/docs/en/plugins/mods/api#reach-files-processes-and-the-network) | `compile`. Requires Claude Code v2.1.326 or later. |
250254| `$.audio` | `play`, `speak` |
251255| `$.telemetry` | `log`, `mark`. A record is sent only when Claude Code or a built-in mod makes the call. |
252256
from line 278
274278| `InfoNotice` | `text`, `command` | The notice's `text` prefixed with `notice:` | Terminal |
275279| `SessionMode` | `modes` | One instance | Terminal, Desktop |
276280| `PromptHint` | `isDraft`, `isWorking`, `hint` | One instance | Terminal, Desktop |
281| `AgentRow` | The agent's [`$.agent.list()` fields](https://code.claude.com/docs/en/plugins/mods/create#get-the-types-for-your-build), plus `rowIds`, `columns`, `body`, and `isHidden` | The agent id | Terminal and VS Code's [Focus view](https://code.claude.com/docs/en/vs-code.md#extension-settings). Requires v2.1.326 or later of Claude Code or the extension. |
277282
278283`e.viewport` holds `columns`, `rows`, and `isFullscreen`. In the terminal and the Desktop app, it's absent until the app has measured its window. There, its `rows` is the height of the whole window, not of your pane. In the VS Code extension, it's always present.
279284
from line 402
397402| :- | :- |
398403| A hook's own execution time for one event, not counting time inside `next` or a mods API call other than `$.clock.sleep` | 10 seconds, or 50 milliseconds for a `prompt.edit` hook |
399404| A `.catch` handler's execution time | 1 second |
405| Time a `ui.render` or `plugin.register` hook waits on mods API calls for one event | 30 seconds for `ui.render`. 10 seconds for `plugin.register`, not counting `$.ui.ask`. The `ui.render` limit and the `$.ui.ask` exemption require Claude Code v2.1.326 or later. |
400406| All `session.end` hooks together | As long as the [SessionEnd hook budget](https://code.claude.com/docs/en/hooks.md#sessionend-input), 1.5 seconds unless you change it, counted from when your settings `SessionEnd` hooks finish |
401407| `$.process.run` timeout | 30 seconds by default, 10 minutes at most |
402408| `$.process.run` `stdout` and `stderr` | 4 MiB each. `isStdoutTruncated` or `isStderrTruncated` is `true` when one was cut. |
403409| `$.model.complete` `maxTokens` | 1024 by default, up to 64,000 or the model's output limit |
404| `$.fs.read` and `$.fs.write` | 4 MiB for one file |
410| `$.fs.read` and `$.fs.write` | 4 MiB for one file. On v2.1.326 or later, read a larger file in parts with `$.fs.read(path, { offset, length })`, both in bytes. |
405411| A `$.http.fetch` request body | 4 MiB, counted in characters. A call with a larger body rejects. |
406412| A `$.http.fetch` response body | 4 MiB. `text` holds the first 4 MiB and the rest isn't read. When the `Content-Length` header declares more, the call rejects instead, with a reason that ends `is over the 4194304-byte limit`, except when the last request after any redirects uses the `HEAD` method. The `HEAD` exemption requires Claude Code v2.1.296 or later. |
407413| One `$.http.fetch` call, redirects and body included | 30 seconds |
from line 417
411417| A `Code`'s `language` or `path`, a `Select` option's `value`, or a `Client`'s `module` | 10,000 characters. If one is longer, the `ui.render` hook that returned it [fails](https://code.claude.com/docs/en/plugins/mods/events.md#handle-a-hook-that-fails). |
412418| A `Link`'s `href` | 2,048 characters. If it's longer, the `ui.render` hook that returned it [fails](https://code.claude.com/docs/en/plugins/mods/events.md#handle-a-hook-that-fails). |
413419| Nesting depth of one tree | 32 levels below the root element |
420| Depth and size of a tree counted with its prop values | Claude Code refuses anything `nested more than 100 lists and objects deep` or with `more than 1000000 values once written out`. Requires Claude Code v2.1.326 or later. |
414421| Elements and text children in one tree | 20,000 |
415422| `Raster` cells in one tree, each `Raster`'s `columns` times its `rows` | 262,144 |
416423| The rows above the prompt, stacked | Elements, `Raster` cells, and `Image` bytes add up across the rows, against the limits for one tree |
from line 429
422429| A pane opened without the user asking | Placed from 144 terminal columns, 110 after they've opened it once |
423430| Rows from `$.ui.place` that one mod has in a conversation at one time | 500. At the limit, a call with a new `id` resolves to `{ isPlaced: false, reason: 'a plugin holds at most 500 placed rows' }`. |
424431| Nesting depth of a mods API call's arguments | 28,000 levels. Past that, the call rejects with a message ending `nesting deeper than 28000 levels is not supported`. Requires Claude Code v2.1.299 or later. |
425| Nesting depth of a changed event passed to `next`, outside [async generator hooks](#events) such as one on `turn.step` | 28,000 levels. Past that, `next` rejects with a message ending `nesting deeper than 28000 levels is not supported`. Requires Claude Code v2.1.299 or later. |
432| Nesting depth of a changed event passed to `next`, outside `ui.render` and [async generator hooks](#events) such as one on `turn.step` | 28,000 levels. Past that, `next` rejects with a message ending `nesting deeper than 28000 levels is not supported`. Requires Claude Code v2.1.299 or later. |
426433| Nesting depth of a hook's return value, outside `ui.render`, `ui.resolve`, and async generator hooks | 28,000 levels. Past that, the hook's result is refused, and [the notice that reports it](https://code.claude.com/docs/en/plugins/mods/troubleshoot.md#find-out-why-a-mod-does-nothing) includes `nesting deeper than 28000 levels is not supported`. Requires Claude Code v2.1.299 or later. |
427434| Scopes, such as functions, blocks, and loops, nested inside one another in one file of a hooks module | 2,000 |
428435| Command, tool, subagent type, and pane names, the `id` of a placed row, and the `scene` of a backdrop | Letters, digits, `_`, and `-`, up to 64 characters |
settings-reference Changed · +4 / -2 lines
This page is larger than the 256 KiB this site keeps, so one side of the diff below stops where the stored text does.
Nothing in the body moved in this read. What changed is above.
statusline Changed · +2 / -4 lines
from line 342
342342>
343343> **Fields that may be `null`**:
344344>
345> * `context_window.current_usage`: `null` before the first API call in a session, and again after `/compact` until the next API call repopulates it
345> * `context_window.current_usage`: see [context window fields](#context-window-fields)
346346> * `context_window.used_percentage`, `context_window.remaining_percentage`: may be `null` early in the session
347347>
348348> Handle missing fields with conditional access and null values with fallback defaults in your scripts.
from line 352
352352The `context_window` object describes the live context window from the most recent API response.
353353
354354* **Combined totals** (`total_input_tokens`, `total_output_tokens`): tokens currently in the context window. `total_input_tokens` is the sum of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`; `total_output_tokens` is the output tokens from the most recent response. Both are `0` before the first API response.
355* **Per-component usage** (`current_usage`): the same token counts broken out by category. Use this when you need cache hits separate from fresh input.
355* **Per-component usage** (`current_usage`): the same token counts broken out by category. Use this when you need cache hits separate from fresh input. The object is `null` before the first API call in a session, and `null` or all zeros after `/compact` until the next API call. Treat both as empty.
356356
357357The `current_usage` object contains:
358358
from line 366
366366The `used_percentage` field is calculated from input tokens only: `input_tokens + cache_creation_input_tokens + cache_read_input_tokens`. It does not include `output_tokens`.
367367
368368If you calculate context percentage manually from `current_usage`, use the same input-only formula to match `used_percentage`.
369
370The `current_usage` object is `null` before the first API call in a session, and again immediately after `/compact` until the next API call repopulates it.
371369
372370### Spend limit fields
373371
agent-view Changed · +0 / -2 lines
from line 735
735735
736736Pass `--restricted` to start every session you dispatch from the view in [restricted mode](https://code.claude.com/docs/en/cli-reference.md#cli-flags), as if each were launched with the top-level `--restricted` flag. Requires Claude Code v2.1.248 or later.
737737
738The active defaults appear in the footer below the dispatch input.
739
740738A background session started in `bypassPermissions` mode needs your [acceptance of the bypass disclaimer](https://code.claude.com/docs/en/permission-modes.md#skip-all-checks-with-bypasspermissions-mode) on record, since that mode lets a session you aren't watching act without approval. Passing `--dangerously-skip-permissions` or `--permission-mode bypassPermissions` to `claude agents` shows the same disclaimer when you haven't accepted it before, and accepting applies `bypassPermissions` to the sessions you launch from the view. Passing `--allow-dangerously-skip-permissions` shows the same disclaimer too, and accepting makes `bypassPermissions` available in the `Shift+Tab` cycle of those sessions without starting them in it.
741739
742740#### What persists across restarts
claude-code-on-the-web Changed · +1 / -0 lines
from line 471
471471| `Attaching to an existing cloud session is not enabled for your account.` | You ran `--cloud <session-id>` without `-p`. Send the message with `claude -p "your message" --cloud <session-id>`. |
472472| `Session not found: <id>` | The ID or URL doesn't match a session you can access. Check it against the session's claude.ai/code URL. |
473473| `cloud session <id> is archived and cannot accept new messages` | The session has been archived. Start a new session instead. |
474| `--fork-session can't fork a cloud session, so nothing was opened or sent.` | To message the existing cloud session, run `claude -p "your message" --cloud <session-id>` without `--fork-session`. |
474475
475476### Environment expired
476477
devcontainer Changed · +1 / -1 lines
from line 67
6767What you see at the authentication prompt depends on your provider:
6868
6969* **Anthropic**: sign in through a browser with your Claude or Anthropic Console account
70* **[Amazon Bedrock, Google Cloud's Agent Platform, or Microsoft Foundry](https://code.claude.com/docs/en/third-party-integrations.md)**: Claude Code uses your cloud provider credentials, with no browser prompt
70* **[Amazon Bedrock, Google Cloud's Agent Platform, or Microsoft Foundry](https://code.claude.com/docs/en/third-party-integrations.md)**: Claude Code uses your cloud provider credentials
7171
7272For cloud providers, pass credentials into the container as environment variables through `containerEnv`, a Codespaces secret, or your cloud's workload identity rather than mounting credential files from the host. See [Amazon Bedrock](https://code.claude.com/docs/en/amazon-bedrock.md), [Google Cloud's Agent Platform](https://code.claude.com/docs/en/google-vertex-ai.md), or [Microsoft Foundry](https://code.claude.com/docs/en/microsoft-foundry.md) for the credential chain Claude Code reads.
7373
hooks-guide Changed · +1 / -1 lines
from line 764
764764
765765#### Filter by tool name and arguments with the `if` field
766766
767The `if` field uses [permission rule syntax](https://code.claude.com/docs/en/permissions.md) to filter hooks by tool name and arguments together, so the hook process only spawns when the tool call matches. This goes beyond `matcher`, which filters at the group level by tool name only.
767The `if` field uses [permission rule syntax](https://code.claude.com/docs/en/permissions.md) to filter hooks by tool name and arguments together.
768768
769769For example, this configuration runs a hook only when Claude uses `git` commands rather than all Bash commands:
770770
managed-settings Changed · +2 / -0 lines
from line 118
118118
119119## How Claude Code combines managed sources
120120
121If you set your provider or gateway at claude.ai under **Organization settings > Desktop 3P**, first read [which settings take priority](https://claude.com/docs/third-party/claude-desktop/admin-console-claude-code#which-settings-take-priority) in the Enterprise Admin Console guide.
122
121123When your organization delivers more than one managed source to the same machine, the [`managedSourcesBehavior`](https://code.claude.com/docs/en/settings-reference#managedsourcesbehavior) key decides what Claude Code does with the others:
122124
123125* **`"first-wins"`, the default**: Claude Code uses the highest-ranked source that delivers at least one policy key and ignores the rest rather than merging them, apart from the keys in [Keys read from every admin source](#keys-read-from-every-admin-source). Claude Code shows no warning for the sources it skips; `/status` [names the source it used and the ones it skipped](#read-the-source-in-/status).
network-config Changed · +2 / -0 lines
from line 255
255255
256256When using [Amazon Bedrock](https://code.claude.com/docs/en/amazon-bedrock.md), [Google Cloud's Agent Platform](https://code.claude.com/docs/en/google-vertex-ai.md), [Microsoft Foundry](https://code.claude.com/docs/en/microsoft-foundry.md), or a signed-in [Claude apps gateway](https://code.claude.com/docs/en/claude-apps-gateway) session, model traffic and authentication go to your provider or gateway instead of `api.anthropic.com`, `claude.ai`, or `platform.claude.com`. The WebFetch tool still calls `api.anthropic.com` for its [domain safety check](https://code.claude.com/docs/en/data-usage.md#webfetch-domain-safety-check) unless you set `skipWebFetchPreflight: true` in [settings](https://code.claude.com/docs/en/settings.md).
257257
258If you set your provider or gateway in the Enterprise Admin Console, developers who sign in to your organization also need [these Anthropic hosts](https://claude.com/docs/third-party/claude-desktop/admin-console-claude-code#before-you-start).
259
258260If your developers use [fast mode](https://code.claude.com/docs/en/fast-mode.md) behind an [LLM gateway](https://code.claude.com/docs/en/llm-gateway) set with [`ANTHROPIC_BASE_URL`](https://code.claude.com/docs/en/llm-gateway-connect#set-the-base-url-and-credential), keep `api.anthropic.com` reachable through your proxy. When Claude Code sends the fast mode availability check, it goes to that host through any configured HTTP proxy, never to the gateway. For when the check isn't sent, and the variable that restores fast mode in each case, see [Use fast mode behind proxies and LLM gateways](https://code.claude.com/docs/en/fast-mode.md#use-fast-mode-behind-proxies-and-llm-gateways).
259261
260262### Organization IP allowlists and proxy egress
permissions Changed · +2 / -2 lines
from line 638
638638
639639## Extend permissions with hooks
640640
641[Claude Code hooks](https://code.claude.com/docs/en/hooks-guide.md) let you register custom shell commands that evaluate permissions at runtime. When Claude Code makes a tool call, PreToolUse hooks run before the permission prompt, for every tool except [`EndConversation`](https://code.claude.com/docs/en/tools-reference#endconversation-tool-behavior). The hook output can deny the tool call, force a prompt, or skip the prompt to let the call proceed.
641[Claude Code hooks](https://code.claude.com/docs/en/hooks-guide.md) let you register custom shell commands that evaluate permissions at runtime. PreToolUse hooks run before the permission prompt. The hook output can deny the tool call, force a prompt, or skip the prompt to let the call proceed. [`EndConversation`](https://code.claude.com/docs/en/tools-reference#endconversation-tool-behavior) calls skip PreToolUse hooks.
642642
643643### Precedence among rules, hooks, and mods
644644
from line 754
754754
755755Permissions and [sandboxing](https://code.claude.com/docs/en/sandboxing.md) are complementary security layers:
756756
757* **Permissions** control which tools Claude Code can use and which files or domains it can access. They apply to Bash, Read, Edit, WebFetch, MCP, and every other tool, except that a deny or ask rule can't block [`EndConversation`](https://code.claude.com/docs/en/tools-reference#endconversation-tool-behavior) while any other tool remains.
757* **Permissions** control which tools Claude Code can use and which files or domains it can access. They apply to Bash, Read, Edit, WebFetch, MCP, and other tools. A deny or ask rule can't block [`EndConversation`](https://code.claude.com/docs/en/tools-reference#endconversation-tool-behavior) while any other tool remains.
758758* **Sandboxing** provides OS-level enforcement that restricts shell commands' filesystem and network access. It applies to Bash, PowerShell, and [Monitor](https://code.claude.com/docs/en/tools-reference.md#monitor-tool) tool commands and their child processes.
759759
760760Use both for defense-in-depth, since sandbox restrictions still apply even if a prompt injection bypasses Claude's decision-making. Paths and domains from both sandbox settings and permission rules are [merged into the final sandbox configuration](https://code.claude.com/docs/en/sandboxing.md#permission-rules).
plugins/cli-reference Changed · +3 / -0 lines
from line 675
675675* `manifest`: the manifest's own result, or `null` for a run without a manifest
676676* `contents`: per-file results, each naming its `file` and carrying `errors`, `warnings`, and `notes` arrays. Files with no error, warning, or note get no entry, so `contents` is empty when there's nothing to report. For a [directory with `marketplace.json` and `plugin.json`](#validate-a-directory), `manifest` is the `marketplace.json` result and `plugin.json` results go in `contents`
677677 * `gatingHooks`: whether each [mod](https://code.claude.com/docs/en/plugins/mods/overview.md) hook that can refuse an action, such as a `tool.call` hook, has a [`.catch` handler](https://code.claude.com/docs/en/plugins/mods/events#handle-a-hook-that-fails). Each item gives `module`, `pattern`, `hook`, and `hasCatch`. Requires Claude Code v2.1.290 or later
678 * `modules`: one item per hooks module, with fields such as `hooks` and `uses`, or `null` when it's unknown which code loads. Requires Claude Code v2.1.326 or later
679 * `wasm`: the WebAssembly each hooks module compiles. Requires Claude Code v2.1.326 or later
680* `provides`: the plugin's components by kind, or `null` when the run can't list them. Requires Claude Code v2.1.326 or later
678681* `advice`: the [advice](#advice-on-the-readme) of the run, each entry naming the README as `file` and carrying a `message` and the `installLine` to paste. Empty when there is none. Requires Claude Code v2.1.295 or later
679682* `hosts`: `named` hosts, plus `unread` plugin parts that could reach others. `null` when the run can't list them. A plugin can reach unlisted hosts. Requires Claude Code v2.1.328 or later
680683
plugins/mods/interface Changed · +2 / -1 lines
from line 207
207207| `AskUserQuestion` | The dialog Claude opens to ask you a question |
208208| `Spinner`, `ToolProgress`, `TurnDuration` | Status lines for a turn: the line that animates while Claude works, a running tool's live progress line, and the line that closes a turn |
209209| `InfoNotice`, `SessionMode`, `PromptHint` | Status lines under the logo, the mode labels in the footer, and the hint line under the prompt |
210| `AgentRow` | A subagent's or teammate's row in the agent panel |
210211
211212`Pane`, `AskUserQuestion`, `Spinner`, `UserMessage`, `AssistantMessage`, and the tool call sites work in the terminal, the Desktop app, and the VS Code extension. The [render sites table](https://code.claude.com/docs/en/plugins/mods/reference.md#render-sites) lists where each of the others is raised.
212213
from line 528
527528
528529## Build a tree from elements
529530
530What a `ui.render` hook returns is an element tree: a description of what to draw, made of boxes, text, and controls nested inside each other. You describe the drawing, and Claude Code renders it in whichever app the user has open: the terminal, the Desktop app, or the VS Code extension.
531What a `ui.render` hook returns is an element tree: a description of what to draw, made of boxes, text, and controls nested inside each other.
531532
532533To get the elements, call `$.ui.resolve(e)` in your hook, as in `const { Box, Text, Button } = $.ui.resolve(e)`. Each element is a function. You pass it props, and you put the elements and strings that go inside it in `children`.
533534
plugins/troubleshooting Changed · +1 / -0 lines
from line 1081
10811081| `Path not found: <path>. The runtime loader will report this as a load failure.` | A component path in the manifest doesn't exist. | Fix the path or create the directory. |
10821082| `Path contains ".." which could be a path traversal attempt: <path>` | A component path escapes the plugin directory. | Use paths inside the plugin root. |
10831083| `Path is a file; skills entries must be directories containing SKILL.md` | A `skills` entry points at `SKILL.md` instead of its directory. | Point at the parent directory, or `.` for a root-level `SKILL.md`. |
1084| `differ only by letter case or Unicode form` or `Windows can open this path as another file` | The path can open a different file depending on the operating system. | Change the name or path as the message says. |
10841085| `No frontmatter block found` or `YAML frontmatter failed to parse: <error>` | A skill, agent, or command file has missing or invalid YAML frontmatter. | Add or fix the frontmatter between `---` delimiters. Reported when validating a plugin directory. |
10851086| `Plugin name "<name>" is reserved: it passes as one of Anthropic's own` | The plugin's `name` is one of the [reserved names](https://code.claude.com/docs/en/plugins/manifest-reference.md#name). | Rename the plugin for what it does. |
10861087| `Must be a version range such as ">=2.1.0"; got "<value>". It will be ignored at load time.` | Claude Code can't read the `claude-code` value under `engines` as a semver range. | Set the value to a range of Claude Code versions, such as `">=2.1.0"`. See the [`engines` field](https://code.claude.com/docs/en/plugins/manifest-reference#fields). |
sandboxing Changed · +1 / -1 lines
from line 674
674674
675675Permission rules and sandboxing control different things:
676676
677* **Permission rules** control which tools Claude Code can use and are evaluated before any tool runs. They apply to every tool: Bash, Read, Edit, WebFetch, MCP, and others, except that a deny or ask rule can't block [`EndConversation`](https://code.claude.com/docs/en/tools-reference#endconversation-tool-behavior) while any other tool remains.
677* **Permission rules** control which tools Claude Code can use and are evaluated before a tool runs. They apply to Bash, Read, Edit, WebFetch, MCP, and other tools. A deny or ask rule can't block [`EndConversation`](https://code.claude.com/docs/en/tools-reference#endconversation-tool-behavior) while any other tool remains.
678678* **Sandboxing** provides OS-level enforcement that restricts what shell commands can access at the filesystem and network level. It applies to Bash, PowerShell, and [Monitor](https://code.claude.com/docs/en/tools-reference.md#monitor-tool) tool commands and their child processes.
679679
680680The two layers also differ in how they are enforced. Claude Code evaluates permission decisions before a command runs, based on the command string and, in auto mode, a separate classifier's judgment about whether the command is safe. The operating system enforces the sandbox boundary on the running process, so it holds regardless of what the model chose to run and even if an allowed command does more than its name suggests.
server-managed-settings Changed · +3 / -1 lines
from line 7
77> [!NOTE]
88>
99> Server-managed settings are available for [Claude for Teams](https://claude.com/pricing?utm_source=claude_code\&utm_medium=docs\&utm_content=server_settings_teams#team-&-enterprise) and [Claude for Enterprise](https://anthropic.com/contact-sales?utm_source=claude_code\&utm_medium=docs\&utm_content=server_settings_enterprise) customers.
10>
11> If you set your provider or gateway at claude.ai under **Organization settings > Desktop 3P**, follow the [Enterprise Admin Console guide](https://claude.com/docs/third-party/claude-desktop/admin-console-claude-code) instead.
1012
1113## Requirements
1214
from line 396
394396* A directly configured API key
395397* A `user_oauth` [Anthropic profile](https://code.claude.com/docs/en/authentication.md#anthropic-profiles-and-federation-credentials), unless the profile sets a `base_url` other than the Anthropic API. Requires Claude Code v2.1.257 or later.
396398
397Neither keys returned by an [`apiKeyHelper`](https://code.claude.com/docs/en/settings-reference#apikeyhelper) script nor [Workload Identity Federation](https://platform.claude.com/docs/en/manage-claude/workload-identity-federation) credentials trigger the settings fetch.
399Neither keys returned by an [`apiKeyHelper`](https://code.claude.com/docs/en/settings-reference#apikeyhelper) script nor [Workload Identity Federation](https://platform.claude.com/docs/en/manage-claude/workload-identity-federation) credentials trigger the settings fetch. If you set your provider or gateway in the Enterprise Admin Console, see [when console settings apply](https://claude.com/docs/third-party/claude-desktop/admin-console-claude-code#which-settings-take-priority).
398400
399401A session receives the managed settings of the organization that owns the credential it authenticates with. An API key from the [Claude Console](https://platform.claude.com) belongs to the Console organization it was created in, which is a separate organization from your claude.ai Team or Enterprise organization. Settings you configure in claude.ai Admin Settings therefore don't reach a session that authenticates with that key, such as a CI job that uses your company's Console API key. To apply them to that job, use one of these options. The OAuth token option doesn't apply to a job that runs with [`--bare`](https://code.claude.com/docs/en/headless#start-faster-with-bare-mode), because bare mode doesn't read `CLAUDE_CODE_OAUTH_TOKEN`.
400402
troubleshoot-install Changed · +0 / -2 lines
from line 807
807807
808808### Install hangs in Docker
809809
810When installing Claude Code in a Docker container, installing as root into `/` can cause hangs.
811
812810**Solutions:**
813811
8148121. **Set a working directory** before running the installer: