SpyBara
Go Premium

Documentation 2026-05-31 06:39 UTC to 2026-06-02 06:51 UTC

40 files changed +649 −103. View all changes and history on the product overview
2026
Tue 30 07:01 Mon 29 23:02 Sat 27 01:01 Fri 26 23:00 Thu 25 23:58 Wed 24 22:02 Tue 23 22:00 Mon 22 23:59 Fri 19 22:58 Thu 18 22:00 Wed 17 17:02 Tue 16 21:57 Mon 15 23:02 Sat 13 21:59 Fri 12 22:00 Thu 11 23:01 Wed 10 23:57 Tue 9 06:34 Mon 8 06:52 Sat 6 06:24 Fri 5 06:45 Thu 4 06:52 Wed 3 06:53 Tue 2 06:51
Details

82`settingSources` covers user, project, and local settings. A few inputs are read regardless of its value:82`settingSources` covers user, project, and local settings. A few inputs are read regardless of its value:

83 83 

84| Input | Behavior | To disable |84| Input | Behavior | To disable |

85| :---------------------------------------------------- | :--------------------------------------- | :------------------------------------------------------------------------------------------ |85| :----------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------ |

86| Managed policy settings | Always loaded when present on the host | Remove the managed settings file |86| Managed policy settings | Always loaded when present on the host | Remove the managed settings file |

87| `~/.claude.json` global config | Always read | Relocate with `CLAUDE_CONFIG_DIR` in `env` |87| `~/.claude.json` global config | Always read | Relocate with `CLAUDE_CONFIG_DIR` in `env` |

88| Auto memory at `~/.claude/projects/<project>/memory/` | Loaded by default into the system prompt | Set `autoMemoryEnabled: false` in settings, or `CLAUDE_CODE_DISABLE_AUTO_MEMORY=1` in `env` |88| Auto memory at `~/.claude/projects/<project>/memory/` | Loaded by default into the system prompt | Set `autoMemoryEnabled: false` in settings, or `CLAUDE_CODE_DISABLE_AUTO_MEMORY=1` in `env` |

89| [claude.ai MCP connectors](/en/mcp#use-mcp-servers-from-claude-ai) | Loaded when the active authentication method is a claude.ai subscription. Passing `mcpServers: {}` does not suppress them | Set `strictMcpConfig: true`, or `ENABLE_CLAUDEAI_MCP_SERVERS=false` in `env` |

89 90 

90<Warning>91<Warning>

91 Do not rely on default `query()` options for multi-tenant isolation. Because the inputs above are read regardless of `settingSources`, an SDK process can pick up host-level configuration and per-directory memory. For multi-tenant deployments, run each tenant in its own filesystem and set `settingSources: []` plus `CLAUDE_CODE_DISABLE_AUTO_MEMORY=1` in `env`. See [Secure deployment](/en/agent-sdk/secure-deployment).92 Do not rely on default `query()` options for multi-tenant isolation. Because the inputs above are read regardless of `settingSources`, an SDK process can pick up host-level configuration and per-directory memory. For multi-tenant deployments, run each tenant in its own filesystem and set `settingSources: []` plus `CLAUDE_CODE_DISABLE_AUTO_MEMORY=1` in `env`. See [Secure deployment](/en/agent-sdk/secure-deployment).


119 120 

120Skills are markdown files that give your agent specialized knowledge and invocable workflows. Unlike `CLAUDE.md` (which loads every session), skills load on demand. The agent receives skill descriptions at startup and loads the full content when relevant.121Skills are markdown files that give your agent specialized knowledge and invocable workflows. Unlike `CLAUDE.md` (which loads every session), skills load on demand. The agent receives skill descriptions at startup and loads the full content when relevant.

121 122 

122Skills are discovered from the filesystem through `settingSources`. When the `skills` option on `query()` is omitted, discovered user and project skills are enabled and the Skill tool is available, matching CLI behavior. To control which skills are enabled, pass `skills` as `"all"`, a list of skill names, or `[]` to disable all. The SDK enables the Skill tool automatically when `skills` is set, so you do not need to add it to `allowedTools`.123Skills are discovered from the filesystem through `settingSources`. When the `skills` option on `query()` is omitted, discovered user and project skills are enabled and the Skill tool is available, matching CLI behavior. To control which skills are enabled, pass `skills` as `"all"`, a list of skill names, or `[]` to disable all. When `skills` is set, the SDK adds the Skill tool to `allowedTools` automatically. If you also pass an explicit `tools` list, include `"Skill"` in that list so Claude can invoke skills.

123 124 

124<CodeGroup>125<CodeGroup>

125 ```python Python theme={null}126 ```python Python theme={null}


174 175 

175Both types execute during the same hook lifecycle. If you already have hooks in your project's `.claude/settings.json` and you set `settingSources: ["project"]`, those hooks run automatically in the SDK with no extra configuration.176Both types execute during the same hook lifecycle. If you already have hooks in your project's `.claude/settings.json` and you set `settingSources: ["project"]`, those hooks run automatically in the SDK with no extra configuration.

176 177 

177Hook callbacks receive the tool input and return a decision dict. Returning `{}` (an empty dict) means allow the tool to proceed. Returning `{"decision": "block", "reason": "..."}` prevents execution and the reason is sent to Claude as the tool result. See the [hooks guide](/en/agent-sdk/hooks) for the full callback signature and return types.178Hook callbacks receive the tool input and return a decision dict. Returning `{}` means allow the tool to proceed. To block execution, return a `hookSpecificOutput` object with `permissionDecision: "deny"` and a `permissionDecisionReason`. The reason is sent to Claude as the tool result. The top-level `decision` and `reason` fields are deprecated for `PreToolUse`. See the [hooks guide](/en/agent-sdk/hooks) for the full callback signature and return types.

178 179 

179<CodeGroup>180<CodeGroup>

180 ```python Python theme={null}181 ```python Python theme={null}


188 async def audit_bash(input_data, tool_use_id, context):189 async def audit_bash(input_data, tool_use_id, context):

189 command = input_data.get("tool_input", {}).get("command", "")190 command = input_data.get("tool_input", {}).get("command", "")

190 if "rm -rf" in command:191 if "rm -rf" in command:

191 return {"decision": "block", "reason": "Destructive command blocked"}192 return {

193 "hookSpecificOutput": {

194 "hookEventName": "PreToolUse",

195 "permissionDecision": "deny",

196 "permissionDecisionReason": "Destructive command blocked",

197 }

198 }

192 return {} # Empty dict: allow the tool to proceed199 return {} # Empty dict: allow the tool to proceed

193 200 

194 201 


219 if (input.hook_event_name !== "PreToolUse") return {};226 if (input.hook_event_name !== "PreToolUse") return {};

220 const toolInput = input.tool_input as { command?: string };227 const toolInput = input.tool_input as { command?: string };

221 if (toolInput.command?.includes("rm -rf")) {228 if (toolInput.command?.includes("rm -rf")) {

222 return { decision: "block", reason: "Destructive command blocked" };229 return {

230 hookSpecificOutput: {

231 hookEventName: "PreToolUse",

232 permissionDecision: "deny",

233 permissionDecisionReason: "Destructive command blocked",

234 },

235 };

223 }236 }

224 return {}; // Empty object: allow the tool to proceed237 return {}; // Empty object: allow the tool to proceed

225 };238 };


247| Hook type | Best for |260| Hook type | Best for |

248| :---------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |261| :---------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

249| **Filesystem** (`settings.json`) | Sharing hooks between CLI and SDK sessions. Supports `"command"` (shell scripts), `"http"` (POST to an endpoint), `"mcp_tool"` (call a connected MCP server's tool), `"prompt"` (LLM evaluates a prompt), and `"agent"` (spawns a verifier agent). These fire in the main agent and any subagents it spawns. |262| **Filesystem** (`settings.json`) | Sharing hooks between CLI and SDK sessions. Supports `"command"` (shell scripts), `"http"` (POST to an endpoint), `"mcp_tool"` (call a connected MCP server's tool), `"prompt"` (LLM evaluates a prompt), and `"agent"` (spawns a verifier agent). These fire in the main agent and any subagents it spawns. |

250| **Programmatic** (callbacks in `query()`) | Application-specific logic; returning structured decisions; in-process integration. Scoped to the main session only. |263| **Programmatic** (callbacks in `query()`) | Application-specific logic, structured decisions, and in-process integration. These also fire inside subagents. The callback receives `agent_id` and `agent_type` to distinguish. |

251 264 

252<Note>265<Note>

253 The TypeScript SDK supports additional hook events beyond Python, including `SessionStart`, `SessionEnd`, `TeammateIdle`, and `TaskCompleted`. See the [hooks guide](/en/agent-sdk/hooks) for the full event compatibility table.266 The TypeScript SDK supports additional hook events beyond Python, including `SessionStart`, `SessionEnd`, `TeammateIdle`, and `TaskCompleted`. See the [hooks guide](/en/agent-sdk/hooks) for the full event compatibility table.

Details

237Your callback returns an object with two categories of fields:237Your callback returns an object with two categories of fields:

238 238 

239* **Top-level fields** work the same on every event: `systemMessage` shows a message to the user, and `continue` (`continue_` in Python) determines whether the agent keeps running after this hook.239* **Top-level fields** work the same on every event: `systemMessage` shows a message to the user, and `continue` (`continue_` in Python) determines whether the agent keeps running after this hook.

240* **`hookSpecificOutput`** controls the current operation. The fields inside depend on the hook event type. For `PreToolUse` hooks, this is where you set `permissionDecision` (`"allow"`, `"deny"`, `"ask"`, or `"defer"`), `permissionDecisionReason`, and `updatedInput`. Returning `"defer"` ends the query so you can [resume it later](/en/hooks#defer-a-tool-call-for-later). For `PostToolUse` hooks, you can set `additionalContext` to append information to the tool result, or `updatedToolOutput` to replace the tool's output entirely before Claude sees it.240* **`hookSpecificOutput`** controls the current operation. The fields inside depend on the hook event type. For `PreToolUse` hooks, this is where you set `permissionDecision` (`"allow"`, `"deny"`, `"ask"`, or `"defer"`), `permissionDecisionReason`, and `updatedInput`. Returning `"defer"` ends the query so you can [resume it later](/en/hooks#defer-a-tool-call-for-later). For `PostToolUse` hooks, you can set `additionalContext` to append information to the tool result. To replace the tool's output before Claude sees it, set `updatedToolOutput`, which works for any tool in both SDKs. The older `updatedMCPToolOutput` field replaces MCP tool output only and is deprecated.

241 241 

242Return `{}` to allow the operation without changes. SDK callback hooks use the same JSON output format as [Claude Code shell command hooks](/en/hooks#json-output), which documents every field and event-specific option. For the SDK type definitions, see the [TypeScript](/en/agent-sdk/typescript#synchookjsonoutput) and [Python](/en/agent-sdk/python#synchookjsonoutput) SDK references.242Return `{}` to allow the operation without changes. SDK callback hooks use the same JSON output format as [Claude Code shell command hooks](/en/hooks#json-output), which documents every field and event-specific option. For the SDK type definitions, see the [TypeScript](/en/agent-sdk/typescript#synchookjsonoutput) and [Python](/en/agent-sdk/python#synchookjsonoutput) SDK references.

243 243 


626 626 

627### Forward notifications to Slack627### Forward notifications to Slack

628 628 

629Use `Notification` hooks to receive system notifications from the agent and forward them to external services. Notifications fire for specific event types: `permission_prompt` (Claude needs permission), `idle_prompt` (Claude is waiting for input), `auth_success` (authentication completed), `elicitation_dialog` (Claude is prompting the user), `elicitation_response` (the user answered an elicitation), and `elicitation_complete` (an elicitation closed). Each notification includes a `message` field with a human-readable description and optionally a `title`.629Use `Notification` hooks to receive system notifications from the agent and forward them to external services. Notifications fire for event types such as:

630 

631* `permission_prompt` when Claude needs permission

632* `idle_prompt` when Claude is waiting for input

633* `auth_success` when authentication completes

634* `elicitation_dialog`, `elicitation_complete`, and `elicitation_response` for user-prompt elicitation flows

635 

636Each notification includes a `message` field with a human-readable description and optionally a `title`.

630 637 

631This example forwards every notification to a Slack channel. It requires a [Slack incoming webhook URL](https://api.slack.com/messaging/webhooks), which you create by adding an app to your Slack workspace and enabling incoming webhooks:638This example forwards every notification to a Slack channel. It requires a [Slack incoming webhook URL](https://api.slack.com/messaging/webhooks), which you create by adding an app to your Slack workspace and enabling incoming webhooks:

632 639 


774 };781 };

775 ```782 ```

776 783 

777* You must also return `permissionDecision: 'allow'` or `'ask'` for the input modification to take effect784* Return `permissionDecision: 'allow'` to auto-approve the modified input, or `'ask'` to show it to the user for approval

778 785 

779* Include `hookEventName` in `hookSpecificOutput` to identify which hook type the output is for786* Include `hookEventName` in `hookSpecificOutput` to identify which hook type the output is for

780 787 

Details

79 </Step>79 </Step>

80 80 

81 <Step title="Set your API key">81 <Step title="Set your API key">

82 Get an API key from the [Console](../../../../platform.claude.com/index.txt), then set it as an environment variable:82 Get an API key from the [Console](https://platform.claude.com/), then set it as an environment variable:

83 83 

84 ```bash theme={null}84 ```bash theme={null}

85 export ANTHROPIC_API_KEY=your-api-key85 export ANTHROPIC_API_KEY=your-api-key

Details

75* **Absolute paths**: Full file system paths (for example, `"/home/user/plugins/my-plugin"`)75* **Absolute paths**: Full file system paths (for example, `"/home/user/plugins/my-plugin"`)

76 76 

77<Note>77<Note>

78 The path should point to the plugin's root directory (the directory containing `.claude-plugin/plugin.json`).78 The path should point to the plugin's root directory: the parent of `skills/`, `agents/`, `hooks/`, `commands/` (legacy), or `.claude-plugin/`, not a subdirectory.

79</Note>79</Note>

80 80 

81## Verifying plugin installation81## Verifying plugin installation


271 271 

272## Plugin structure reference272## Plugin structure reference

273 273 

274A plugin directory must contain a `.claude-plugin/plugin.json` manifest file. It can optionally include:274A plugin directory typically contains a `.claude-plugin/plugin.json` manifest file. The manifest is optional. When omitted, Claude Code auto-discovers components from the directory layout. The directory can include:

275 275 

276```text theme={null}276```text theme={null}

277my-plugin/277my-plugin/

278├── .claude-plugin/278├── .claude-plugin/

279│ └── plugin.json # Required: plugin manifest279│ └── plugin.json # Plugin manifest (optional, components auto-discovered without it)

280├── skills/ # Agent Skills (invoked autonomously or via /skill-name)280├── skills/ # Agent Skills (invoked autonomously or via /skill-name)

281│ └── my-skill/281│ └── my-skill/

282│ └── SKILL.md282│ └── SKILL.md


329 329 

330If your plugin doesn't appear in the init message:330If your plugin doesn't appear in the init message:

331 331 

3321. **Check the path**: Ensure the path points to the plugin root directory (containing `.claude-plugin/`)3321. **Check the path**: ensure the path points to the plugin root directory, the parent of `skills/`, `agents/`, `hooks/`, `commands/` (legacy), or `.claude-plugin/`

3332. **Validate plugin.json**: Ensure your manifest file has valid JSON syntax3332. **Validate plugin.json**: if your plugin includes a manifest, ensure it has valid JSON syntax

3343. **Check file permissions**: Ensure the plugin directory is readable3343. **Check file permissions**: ensure the plugin directory is readable

335 335 

336### Skills not appearing336### Skills not appearing

337 337 

Details

802| `allowed_tools` | `list[str]` | `[]` | Tools to auto-approve without prompting. This does not restrict Claude to only these tools; unlisted tools fall through to `permission_mode` and `can_use_tool`. Use `disallowed_tools` to block tools. See [Permissions](/en/agent-sdk/permissions#allow-and-deny-rules) |802| `allowed_tools` | `list[str]` | `[]` | Tools to auto-approve without prompting. This does not restrict Claude to only these tools; unlisted tools fall through to `permission_mode` and `can_use_tool`. Use `disallowed_tools` to block tools. See [Permissions](/en/agent-sdk/permissions#allow-and-deny-rules) |

803| `system_prompt` | `str \| SystemPromptPreset \| None` | `None` | System prompt configuration. Pass a string for custom prompt, or use `{"type": "preset", "preset": "claude_code"}` for Claude Code's system prompt. Add `"append"` to extend the preset |803| `system_prompt` | `str \| SystemPromptPreset \| None` | `None` | System prompt configuration. Pass a string for custom prompt, or use `{"type": "preset", "preset": "claude_code"}` for Claude Code's system prompt. Add `"append"` to extend the preset |

804| `mcp_servers` | `dict[str, McpServerConfig] \| str \| Path` | `{}` | MCP server configurations or path to config file |804| `mcp_servers` | `dict[str, McpServerConfig] \| str \| Path` | `{}` | MCP server configurations or path to config file |

805| `strict_mcp_config` | `bool` | `False` | When `True`, use only the servers passed in `mcp_servers` and ignore project `.mcp.json`, user settings, and plugin-provided MCP servers. Maps to the CLI `--strict-mcp-config` flag |805| `strict_mcp_config` | `bool` | `False` | When `True`, use only the servers passed in `mcp_servers` and ignore project `.mcp.json`, user settings, plugin-provided MCP servers, and [claude.ai connectors](/en/mcp#use-mcp-servers-from-claude-ai). Maps to the CLI `--strict-mcp-config` flag |

806| `permission_mode` | `PermissionMode \| None` | `None` | Permission mode for tool usage |806| `permission_mode` | `PermissionMode \| None` | `None` | Permission mode for tool usage |

807| `continue_conversation` | `bool` | `False` | Continue the most recent conversation |807| `continue_conversation` | `bool` | `False` | Continue the most recent conversation |

808| `resume` | `str \| None` | `None` | Session ID to resume |808| `resume` | `str \| None` | `None` | Session ID to resume |


834| `plugins` | `list[SdkPluginConfig]` | `[]` | Load custom plugins from local paths. See [Plugins](/en/agent-sdk/plugins) for details |834| `plugins` | `list[SdkPluginConfig]` | `[]` | Load custom plugins from local paths. See [Plugins](/en/agent-sdk/plugins) for details |

835| `sandbox` | [`SandboxSettings`](#sandboxsettings) ` \| None` | `None` | Configure sandbox behavior programmatically. See [Sandbox settings](#sandboxsettings) for details |835| `sandbox` | [`SandboxSettings`](#sandboxsettings) ` \| None` | `None` | Configure sandbox behavior programmatically. See [Sandbox settings](#sandboxsettings) for details |

836| `setting_sources` | `list[SettingSource] \| None` | `None` (CLI defaults: all sources) | Control which filesystem settings to load. Pass `[]` to disable user, project, and local settings. Managed policy settings load regardless. See [Use Claude Code features](/en/agent-sdk/claude-code-features#what-settingsources-does-not-control) |836| `setting_sources` | `list[SettingSource] \| None` | `None` (CLI defaults: all sources) | Control which filesystem settings to load. Pass `[]` to disable user, project, and local settings. Managed policy settings load regardless. See [Use Claude Code features](/en/agent-sdk/claude-code-features#what-settingsources-does-not-control) |

837| `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 enables the Skill tool automatically without listing it in `allowed_tools`. See [Skills](/en/agent-sdk/skills) |837| `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](/en/agent-sdk/skills) |

838| `max_thinking_tokens` | `int \| None` | `None` | *Deprecated* - Maximum tokens for thinking blocks. Use `thinking` instead |838| `max_thinking_tokens` | `int \| None` | `None` | *Deprecated* - Maximum tokens for thinking blocks. Use `thinking` instead |

839| `thinking` | [`ThinkingConfig`](#thinkingconfig) ` \| None` | `None` | Controls extended thinking behavior. Takes precedence over `max_thinking_tokens` |839| `thinking` | [`ThinkingConfig`](#thinkingconfig) ` \| None` | `None` | Controls extended thinking behavior. Takes precedence over `max_thinking_tokens` |

840| `effort` | [`EffortLevel`](#effortlevel) ` \| None` | `None` | Effort level for thinking depth |840| `effort` | [`EffortLevel`](#effortlevel) ` \| None` | `None` | Effort level for thinking depth |


2868 2868 

2869### ListMcpResources2869### ListMcpResources

2870 2870 

2871**Tool name:** `ListMcpResources`2871**Tool name:** `ListMcpResourcesTool`

2872 2872 

2873**Input:**2873**Input:**

2874 2874 


2897 2897 

2898### ReadMcpResource2898### ReadMcpResource

2899 2899 

2900**Tool name:** `ReadMcpResource`2900**Tool name:** `ReadMcpResourceTool`

2901 2901 

2902**Input:**2902**Input:**

2903 2903 


3327 3327 

3328### `SandboxNetworkConfig`3328### `SandboxNetworkConfig`

3329 3329 

3330Network-specific configuration for sandbox mode.3330Network-specific configuration for sandbox mode. These settings apply to sandboxed Bash commands when `enabled` is `True` in the parent [`SandboxSettings`](#sandboxsettings). They do not restrict the WebFetch tool, which uses [permission rules](/en/permissions#webfetch) instead.

3331 3331 

3332```python theme={null}3332```python theme={null}

3333class SandboxNetworkConfig(TypedDict, total=False):3333class SandboxNetworkConfig(TypedDict, total=False):

Details

17## Prerequisites17## Prerequisites

18 18 

19* **Node.js 18+** or **Python 3.10+**19* **Node.js 18+** or **Python 3.10+**

20* An **Anthropic account** ([sign up here](../../../../platform.claude.com/index.txt))20* An **Anthropic account** ([sign up here](https://platform.claude.com/))

21 21 

22## Setup22## Setup

23 23 


81 </Step>81 </Step>

82 82 

83 <Step title="Set your API key">83 <Step title="Set your API key">

84 Get an API key from the [Claude Console](../../../../platform.claude.com/index.txt), then create a `.env` file in your project directory:84 Get an API key from the [Claude Console](https://platform.claude.com/), then create a `.env` file in your project directory:

85 85 

86 ```bash theme={null}86 ```bash theme={null}

87 ANTHROPIC_API_KEY=your-api-key87 ANTHROPIC_API_KEY=your-api-key

Details

46 46 

47### Python: `ClaudeSDKClient`47### Python: `ClaudeSDKClient`

48 48 

49[`ClaudeSDKClient`](/en/agent-sdk/python#claudesdkclient) handles session IDs internally. Each call to `client.query()` automatically continues the same session. Call [`client.receive_response()`](/en/agent-sdk/python#claudesdkclient) to iterate over the messages for the current query. The client is typically used as an async context manager.49[`ClaudeSDKClient`](/en/agent-sdk/python#claudesdkclient) handles session IDs internally. Each call to `client.query()` automatically continues the same session. Call [`client.receive_response()`](/en/agent-sdk/python#claudesdkclient) to iterate over the messages for the current query. Use the client as an async context manager so connection setup and teardown are handled for you, or call `connect()` and `disconnect()` manually.

50 50 

51This example runs two queries against the same `client`. The first asks the agent to analyze a module; the second asks it to refactor that module. Because both calls go through the same client instance, the second query has full context from the first without any explicit `resume` or session ID:51This example runs two queries against the same `client`. The first asks the agent to analyze a module; the second asks it to refactor that module. Because both calls go through the same client instance, the second query has full context from the first without any explicit `resume` or session ID:

52 52 


319## Related resources319## Related resources

320 320 

321* [How the agent loop works](/en/agent-sdk/agent-loop): Understand turns, messages, and context accumulation within a session321* [How the agent loop works](/en/agent-sdk/agent-loop): Understand turns, messages, and context accumulation within a session

322* [File checkpointing](/en/agent-sdk/file-checkpointing): Track and revert file changes across sessions322* [File checkpointing](/en/agent-sdk/file-checkpointing): Snapshot and revert file changes the agent made within a session

323* [Python `ClaudeAgentOptions`](/en/agent-sdk/python#claudeagentoptions): Full session option reference for Python323* [Python `ClaudeAgentOptions`](/en/agent-sdk/python#claudeagentoptions): Full session option reference for Python

324* [TypeScript `Options`](/en/agent-sdk/typescript#options): Full session option reference for TypeScript324* [TypeScript `Options`](/en/agent-sdk/typescript#options): Full session option reference for TypeScript

Details

30 30 

31## Using Skills with the SDK31## Using Skills with the SDK

32 32 

33Set the `skills` option on `query()` to control which Skills are available to the session. When omitted, discovered Skills are enabled and the Skill tool is available, matching CLI behavior. Pass `"all"` to enable every discovered Skill, a list of Skill names to enable only those, or `[]` to disable all. When you set `skills`, the SDK enables the Skill tool automatically, so you do not need to list it in `allowedTools`.33Set the `skills` option on `query()` to control which Skills are available to the session. When omitted, discovered Skills are enabled and the Skill tool is available, matching CLI behavior. Pass `"all"` to enable every discovered Skill, a list of Skill names to enable only those, or `[]` to disable all. When you set `skills`, the SDK adds the Skill tool to `allowedTools` automatically. If you also pass an explicit `tools` list, include `"Skill"` in that list so Claude can invoke skills.

34 34 

35Once configured, Claude automatically discovers Skills from the filesystem and invokes them when relevant to the user's request.35Once configured, Claude automatically discovers Skills from the filesystem and invokes them when relevant to the user's request.

36 36 

Details

251description: Fix a GitHub issue251description: Fix a GitHub issue

252---252---

253 253 

254Fix issue #$1 with priority $2.254Fix issue #$0 with priority $1.

255Check the issue description and implement the necessary changes.255Check the issue description and implement the necessary changes.

256```256```

257 257 


266 prompt: "/fix-issue 123 high",266 prompt: "/fix-issue 123 high",

267 options: { maxTurns: 5 }267 options: { maxTurns: 5 }

268 })) {268 })) {

269 // Command will process with $1="123" and $2="high"269 // Command will process with $0="123" and $1="high"

270 if (message.type === "result" && message.subtype === "success") {270 if (message.type === "result" && message.subtype === "success") {

271 console.log("Issue fixed:", message.result);271 console.log("Issue fixed:", message.result);

272 }272 }


281 async def main():281 async def main():

282 # Pass arguments to custom command282 # Pass arguments to custom command

283 async for message in query(prompt="/fix-issue 123 high", options=ClaudeAgentOptions(max_turns=5)):283 async for message in query(prompt="/fix-issue 123 high", options=ClaudeAgentOptions(max_turns=5)):

284 # Command will process with $1="123" and $2="high"284 # Command will process with $0="123" and $1="high"

285 if isinstance(message, ResultMessage):285 if isinstance(message, ResultMessage):

286 print("Issue fixed:", message.result)286 print("Issue fixed:", message.result)

287 287 

Details

382 382 

383## Known limitations383## Known limitations

384 384 

385Some SDK features are incompatible with streaming:

386 

387* **Extended thinking**: when you explicitly set `max_thinking_tokens` (Python) or `maxThinkingTokens` (TypeScript), `StreamEvent` messages are not emitted. You'll only receive complete messages after each turn. Note that thinking is disabled by default in the SDK, so streaming works unless you enable it.

388* **Structured output**: the JSON result appears only in the final `ResultMessage.structured_output`, not as streaming deltas. See [structured outputs](/en/agent-sdk/structured-outputs) for details.385* **Structured output**: the JSON result appears only in the final `ResultMessage.structured_output`, not as streaming deltas. See [structured outputs](/en/agent-sdk/structured-outputs) for details.

389 386 

390## Next steps387## Next steps

Details

74 Full access to all tools and custom MCP servers during the session74 Full access to all tools and custom MCP servers during the session

75 </Card>75 </Card>

76 76 

77 <Card title="Hooks Support" icon="link">

78 Use lifecycle hooks to customize behavior at various points

79 </Card>

80 

81 <Card title="Real-time Feedback" icon="lightning">77 <Card title="Real-time Feedback" icon="lightning">

82 See responses as they're generated, not just final results78 See responses as they're generated, not just final results

83 </Card>79 </Card>


221Use single message input when:217Use single message input when:

222 218 

223* You need a one-shot response219* You need a one-shot response

224* You do not need image attachments, hooks, etc.220* You do not need image attachments or mid-session control methods

225* You need to operate in a stateless environment, such as a lambda function221* You need to operate in a stateless environment, such as a lambda function

226 222 

227### Limitations223### Limitations


232 * Direct image attachments in messages228 * Direct image attachments in messages

233 * Dynamic message queueing229 * Dynamic message queueing

234 * Real-time interruption230 * Real-time interruption

235 * Hook integration

236 * Natural multi-turn conversations231 * Natural multi-turn conversations

237</Warning>232</Warning>

238 233 

Details

448| `sessionStoreFlush` | `'batched' \| 'eager'` | `'batched'` | *Alpha.* Flush mode for `sessionStore`. Ignored when `sessionStore` is not set |448| `sessionStoreFlush` | `'batched' \| 'eager'` | `'batched'` | *Alpha.* Flush mode for `sessionStore`. Ignored when `sessionStore` is not set |

449| `settings` | `string \| Settings` | `undefined` | Inline [settings](/en/settings) object or path to a settings file. Populates the flag-settings layer in the [precedence order](/en/settings#settings-precedence). Change at runtime with [`applyFlagSettings()`](#applyflagsettings) |449| `settings` | `string \| Settings` | `undefined` | Inline [settings](/en/settings) object or path to a settings file. Populates the flag-settings layer in the [precedence order](/en/settings#settings-precedence). Change at runtime with [`applyFlagSettings()`](#applyflagsettings) |

450| `settingSources` | [`SettingSource`](#settingsource)`[]` | CLI defaults (all sources) | Control which filesystem settings to load. Pass `[]` to disable user, project, and local settings. Managed policy settings load regardless. See [Use Claude Code features](/en/agent-sdk/claude-code-features#what-settingsources-does-not-control) |450| `settingSources` | [`SettingSource`](#settingsource)`[]` | CLI defaults (all sources) | Control which filesystem settings to load. Pass `[]` to disable user, project, and local settings. Managed policy settings load regardless. See [Use Claude Code features](/en/agent-sdk/claude-code-features#what-settingsources-does-not-control) |

451| `skills` | `string[] \| 'all'` | `undefined` | Skills available to the session. Pass `'all'` to enable every discovered skill, or a list of skill names. When set, the SDK enables the Skill tool automatically without listing it in `allowedTools`. See [Skills](/en/agent-sdk/skills) |451| `skills` | `string[] \| 'all'` | `undefined` | Skills available to the session. Pass `'all'` to enable every discovered skill, or a list of skill names. When set, the SDK adds the Skill tool to `allowedTools` automatically. If you also pass `tools`, include `'Skill'` in that list. See [Skills](/en/agent-sdk/skills) |

452| `spawnClaudeCodeProcess` | `(options: SpawnOptions) => SpawnedProcess` | `undefined` | Custom function to spawn the Claude Code process. Use to run Claude Code in VMs, containers, or remote environments |452| `spawnClaudeCodeProcess` | `(options: SpawnOptions) => SpawnedProcess` | `undefined` | Custom function to spawn the Claude Code process. Use to run Claude Code in VMs, containers, or remote environments |

453| `stderr` | `(data: string) => void` | `undefined` | Callback for stderr output |453| `stderr` | `(data: string) => void` | `undefined` | Callback for stderr output |

454| `strictMcpConfig` | `boolean` | `false` | Use only the servers passed in `mcpServers` and ignore project `.mcp.json`, user settings, and plugin-provided MCP servers |454| `strictMcpConfig` | `boolean` | `false` | Use only the servers passed in `mcpServers` and ignore project `.mcp.json`, user settings, plugin-provided MCP servers, and [claude.ai connectors](/en/mcp#use-mcp-servers-from-claude-ai) |

455| `systemPrompt` | `string \| { type: 'preset'; preset: 'claude_code'; append?: string; excludeDynamicSections?: boolean }` | `undefined` (minimal prompt) | System prompt configuration. Pass a string for custom prompt, or `{ type: 'preset', preset: 'claude_code' }` to use Claude Code's system prompt. When using the preset object form, add `append` to extend it with additional instructions, and set `excludeDynamicSections: true` to move per-session context into the first user message for [better prompt-cache reuse across machines](/en/agent-sdk/modifying-system-prompts#improve-prompt-caching-across-users-and-machines) |455| `systemPrompt` | `string \| { type: 'preset'; preset: 'claude_code'; append?: string; excludeDynamicSections?: boolean }` | `undefined` (minimal prompt) | System prompt configuration. Pass a string for custom prompt, or `{ type: 'preset', preset: 'claude_code' }` to use Claude Code's system prompt. When using the preset object form, add `append` to extend it with additional instructions, and set `excludeDynamicSections: true` to move per-session context into the first user message for [better prompt-cache reuse across machines](/en/agent-sdk/modifying-system-prompts#improve-prompt-caching-across-users-and-machines) |

456| `taskBudget` | `{ total: number }` | `undefined` | *Alpha.* API-side task budget in tokens. When set, the model is told its remaining token budget so it can pace tool use and wrap up before the limit |456| `taskBudget` | `{ total: number }` | `undefined` | *Alpha.* API-side task budget in tokens. When set, the model is told its remaining token budget so it can pace tool use and wrap up before the limit |

457| `thinking` | [`ThinkingConfig`](#thinkingconfig) | `{ type: 'adaptive' }` for supported models | Controls Claude's thinking/reasoning behavior. See [`ThinkingConfig`](#thinkingconfig) for options |457| `thinking` | [`ThinkingConfig`](#thinkingconfig) | `{ type: 'adaptive' }` for supported models | Controls Claude's thinking/reasoning behavior. See [`ThinkingConfig`](#thinkingconfig) for options |


2051 2051 

2052### ListMcpResources2052### ListMcpResources

2053 2053 

2054**Tool name:** `ListMcpResources`2054**Tool name:** `ListMcpResourcesTool`

2055 2055 

2056```typescript theme={null}2056```typescript theme={null}

2057type ListMcpResourcesInput = {2057type ListMcpResourcesInput = {


2063 2063 

2064### ReadMcpResource2064### ReadMcpResource

2065 2065 

2066**Tool name:** `ReadMcpResource`2066**Tool name:** `ReadMcpResourceTool`

2067 2067 

2068```typescript theme={null}2068```typescript theme={null}

2069type ReadMcpResourceInput = {2069type ReadMcpResourceInput = {


2594 2594 

2595### ListMcpResources2595### ListMcpResources

2596 2596 

2597**Tool name:** `ListMcpResources`2597**Tool name:** `ListMcpResourcesTool`

2598 2598 

2599```typescript theme={null}2599```typescript theme={null}

2600type ListMcpResourcesOutput = Array<{2600type ListMcpResourcesOutput = Array<{


2610 2610 

2611### ReadMcpResource2611### ReadMcpResource

2612 2612 

2613**Tool name:** `ReadMcpResource`2613**Tool name:** `ReadMcpResourceTool`

2614 2614 

2615```typescript theme={null}2615```typescript theme={null}

2616type ReadMcpResourceOutput = {2616type ReadMcpResourceOutput = {


3330 3330 

3331### `SandboxNetworkConfig`3331### `SandboxNetworkConfig`

3332 3332 

3333Network-specific configuration for sandbox mode.3333Network-specific configuration for sandbox mode. These settings apply to sandboxed Bash commands when `enabled` is `true` in the parent [`SandboxSettings`](#sandboxsettings). They do not restrict the WebFetch tool, which uses [permission rules](/en/permissions#webfetch) instead.

3334 3334 

3335```typescript theme={null}3335```typescript theme={null}

3336type SandboxNetworkConfig = {3336type SandboxNetworkConfig = {

en/agent-view.md +32 −4

Details

135 135 

136The one-line summary in each row is generated by a [Haiku-class model](/en/model-config) so the row can tell you what the session is doing, what it needs, or what it produced without opening the transcript. While a session is actively working, the summary refreshes at most once every 15 seconds, plus once when each turn ends.136The one-line summary in each row is generated by a [Haiku-class model](/en/model-config) so the row can tell you what the session is doing, what it needs, or what it produced without opening the transcript. While a session is actively working, the summary refreshes at most once every 15 seconds, plus once when each turn ends.

137 137 

138Each refresh is one short Haiku-class request through your normal provider, billed and handled under the same [data usage terms](/en/data-usage) as the session itself.138Each refresh is one short Haiku-class request through your normal provider, billed and handled under the same [data usage terms](/en/data-usage) as the session itself. On third-party providers such as Bedrock, Vertex AI, Microsoft Foundry, and custom gateways, the request falls back to the session's main model when no Haiku model is configured. Set [`ANTHROPIC_DEFAULT_HAIKU_MODEL`](/en/model-config#environment-variables) to choose the model for these summaries on those providers.

139 139 

140### Pull request status140### Pull request status

141 141 


160 160 

161Type a reply in the peek panel and press `Enter` to send it to that session. When the session is asking a multiple-choice question, the peek panel shows the options and you can press a number key to pick one. For other blocked sessions, press `Tab` to fill the input with a suggested reply you can edit before sending. Prefix a reply with `!` to send a Bash command instead.161Type a reply in the peek panel and press `Enter` to send it to that session. When the session is asking a multiple-choice question, the peek panel shows the options and you can press a number key to pick one. For other blocked sessions, press `Tab` to fill the input with a suggested reply you can edit before sending. Prefix a reply with `!` to send a Bash command instead.

162 162 

163With [voice dictation](/en/voice-dictation) enabled, hold or tap your push-to-talk key while the reply input is focused to dictate a reply instead of typing it. The same works in the dispatch input at the bottom of agent view.

164 

163Use `↑` and `↓` to peek at adjacent sessions without closing the panel, or `→` to attach.165Use `↑` and `↓` to peek at adjacent sessions without closing the panel, or `→` to attach.

164 166 

165### Attach to a session167### Attach to a session


248| `#<number>` or a pull request URL | If a session is already working on that PR, select it instead of dispatching |250| `#<number>` or a pull request URL | If a session is already working on that PR, select it instead of dispatching |

249| `Shift+Enter` | Dispatch and immediately attach to the new session |251| `Shift+Enter` | Dispatch and immediately attach to the new session |

250 252 

253A small set of commands run in agent view itself instead of dispatching: `/exit` and `/quit` close agent view, and `/logout` signs you out. Every other command and skill is sent to a new background session as its first prompt.

254 

251Packaging a recurring task as a [skill](/en/skills) lets you start the same workflow from agent view repeatedly without retyping the prompt.255Packaging a recurring task as a [skill](/en/skills) lets you start the same workflow from agent view repeatedly without retyping the prompt.

252 256 

253When the same `@name` matches both a subagent and a sibling repository, the subagent takes precedence. The bare first-word match also applies, so a prompt that happens to begin with one of your subagent names dispatches that subagent rather than treating the word as plain text. Use the `@` form when you want to be explicit, or start the prompt with a different word to avoid the match.257When the same `@name` matches both a subagent and a sibling repository, the subagent takes precedence. The bare first-word match also applies, so a prompt that happens to begin with one of your subagent names dispatches that subagent rather than treating the word as plain text. Use the `@` form when you want to be explicit, or start the prompt with a different word to avoid the match.


359 363 

360To find a session's worktree path, peek the session or attach and check its working directory.364To find a session's worktree path, peek the session or attach and check its working directory.

361 365 

362To make a subagent always run in its own worktree regardless of how it was started, set [`isolation: worktree`](/en/sub-agents#supported-frontmatter-fields) in its frontmatter.366A [subagent](/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`](/en/sub-agents#supported-frontmatter-fields) in its frontmatter or pass `isolation: "worktree"` when spawning it.

363 367 

364### Set the model368### Set the model

365 369 


377 381 

378The [permission mode](/en/permissions) depends on how you started the session. Backgrounding an existing session with `/bg` or `←` keeps the current permission mode, so a session you switched to `acceptEdits` or `auto` stays in that mode after detaching. Dispatching from the agent view input or running `claude --bg` from your shell uses the `defaultMode` from that directory's settings, or the `permissionMode` from the dispatched [subagent's frontmatter](/en/sub-agents#supported-frontmatter-fields).382The [permission mode](/en/permissions) depends on how you started the session. Backgrounding an existing session with `/bg` or `←` keeps the current permission mode, so a session you switched to `acceptEdits` or `auto` stays in that mode after detaching. Dispatching from the agent view input or running `claude --bg` from your shell uses the `defaultMode` from that directory's settings, or the `permissionMode` from the dispatched [subagent's frontmatter](/en/sub-agents#supported-frontmatter-fields).

379 383 

380The permission mode you start a background session with persists when the supervisor later [stops and restarts](#the-supervisor-process) the session's process. A session you launched with `claude --bg --dangerously-skip-permissions` or `claude --bg --permission-mode bypassPermissions` stays in `bypassPermissions` after that restart instead of falling back to the directory's `defaultMode`.384The permission mode, model, and effort a background session was started with, along with the [configuration flags it carries](#from-inside-a-session), all persist when the supervisor later [stops and restarts](#the-supervisor-process) its process. A session you launched with `claude --bg --dangerously-skip-permissions` or `claude --bg --permission-mode bypassPermissions` stays in `bypassPermissions` after that restart instead of falling back to the directory's `defaultMode`, and a model or effort you changed mid-session with `/model` or `/effort` is kept.

381 385 

382To set defaults for every session you dispatch from agent view, pass any of `--permission-mode`, `--model`, `--effort`, or `--agent` when opening it:386To set defaults for every session you dispatch from agent view, pass any of `--permission-mode`, `--model`, `--effort`, or `--agent` when opening it:

383 387 


441| `claude respawn --all` | Restart every running session, e.g. to move all sessions onto an updated Claude Code binary at once |445| `claude respawn --all` | Restart every running session, e.g. to move all sessions onto an updated Claude Code binary at once |

442| `claude rm <id>` | Remove a session from the list. Removes a worktree Claude created for the session if it has no uncommitted changes; otherwise prints the worktree path so you can clean it up. Leaves a worktree you created yourself in place. The conversation transcript stays on your local machine and remains available through `claude --resume` |446| `claude rm <id>` | Remove a session from the list. Removes a worktree Claude created for the session if it has no uncommitted changes; otherwise prints the worktree path so you can clean it up. Leaves a worktree you created yourself in place. The conversation transcript stays on your local machine and remains available through `claude --resume` |

443| `claude daemon status` | Print the [supervisor's](#the-supervisor-process) state, version, socket directory, and worker count |447| `claude daemon status` | Print the [supervisor's](#the-supervisor-process) state, version, socket directory, and worker count |

448| `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 |

444 449 

445## How background sessions are hosted450## How background sessions are hosted

446 451 


456 461 

457Once a session finishes and sits unattached for about an hour, the supervisor stops its process to free resources. A session you have [pinned](#organize-the-list) with `Ctrl+T` is exempt and keeps its process running while idle. The transcript and state stay on disk either way, and the next time you attach, peek, or reply to a stopped session, the supervisor starts a fresh process from where it left off. When every session has finished and no terminal is connected, the supervisor itself exits and starts again the next time you need it.462Once a session finishes and sits unattached for about an hour, the supervisor stops its process to free resources. A session you have [pinned](#organize-the-list) with `Ctrl+T` is exempt and keeps its process running while idle. The transcript and state stay on disk either way, and the next time you attach, peek, or reply to a stopped session, the supervisor starts a fresh process from where it left off. When every session has finished and no terminal is connected, the supervisor itself exits and starts again the next time you need it.

458 463 

464An empty row left over from pressing `←` that was never given a prompt is removed entirely after about five minutes so the list clears on its own. Sessions started with `claude --bg` and sessions waiting on a setup prompt such as a trust dialog are not removed this way.

465 

459When the host runs low on memory, the supervisor stops idle non-pinned sessions first and stops idle pinned ones only if that freed nothing.466When the host runs low on memory, the supervisor stops idle non-pinned sessions first and stops idle pinned ones only if that freed nothing.

460 467 

461The supervisor watches the installed Claude Code binary on disk and restarts into the new version after the regular [auto-updater](/en/setup#auto-updates) replaces it. This is a local file watch, not a network check. Background sessions are detached processes, so they keep running through the restart and the new supervisor reconnects to them. An idle pinned session is also restarted in place onto the new version so it picks up the update without you reattaching.468The supervisor watches the installed Claude Code binary on disk and restarts into the new version after the regular [auto-updater](/en/setup#auto-updates) replaces it. This is a local file watch, not a network check. Background sessions are detached processes, so they keep running through the restart and the new supervisor reconnects to them. An idle pinned session is also restarted in place onto the new version so it picks up the update without you reattaching.


465Session state is stored under your Claude Code config directory. If you set [`CLAUDE_CONFIG_DIR`](/en/env-vars), the supervisor uses that directory instead of `~/.claude` and runs as a separate instance with its own sessions.472Session state is stored under your Claude Code config directory. If you set [`CLAUDE_CONFIG_DIR`](/en/env-vars), the supervisor uses that directory instead of `~/.claude` and runs as a separate instance with its own sessions.

466 473 

467| Path | Contents |474| Path | Contents |

468| :------------------------------- | :--------------------------------------------------------------------- |475| :------------------------------- | :---------------------------------------------------------------------------------------------------------- |

469| `~/.claude/daemon.log` | Supervisor log |476| `~/.claude/daemon.log` | Supervisor log |

470| `~/.claude/daemon/roster.json` | List of running background sessions, used to reconnect after a restart |477| `~/.claude/daemon/roster.json` | List of running background sessions, used to reconnect after a restart |

471| `~/.claude/jobs/<id>/state.json` | Per-session state shown in agent view |478| `~/.claude/jobs/<id>/state.json` | Per-session state shown in agent view |

479| `~/.claude/jobs/<id>/tmp/` | Per-session scratch directory. Writes here don't prompt for permission. Removed when the session is deleted |

480 

481Each background session has the `CLAUDE_JOB_DIR` environment variable set to its `~/.claude/jobs/<id>` directory, so shell commands the session runs can write temporary files to `$CLAUDE_JOB_DIR/tmp` without colliding with parallel sessions.

472 482 

473To inspect this state without reading the files directly, run `claude daemon status`. It reports whether the supervisor is reachable, its process ID and version, the socket directory, and how many background sessions are live. `/doctor` includes a summary of the same check. On Windows, `claude daemon status` surfaces the underlying file error when the daemon's pipe-key file is locked or unreadable instead of reporting a generic connection failure.483To inspect this state without reading the files directly, run `claude daemon status`. It reports whether the supervisor is reachable, its process ID and version, the socket directory, and how many background sessions are live. `/doctor` includes a summary of the same check. On Windows, `claude daemon status` surfaces the underlying file error when the daemon's pipe-key file is locked or unreadable instead of reporting a generic connection failure.

474 484 


502 512 

503Sleep alone does not cause this. Sessions are preserved across sleep and the supervisor reconnects to them on wake.513Sleep alone does not cause this. Sessions are preserved across sleep and the supervisor reconnects to them on wake.

504 514 

515### Agent view says the background service did not respond

516 

517If attaching, peeking, or `claude logs` reports that the background service did not respond, the supervisor process has likely stalled. Stop it and let the next `claude agents` start a fresh one. To keep your background sessions running through the restart, pass `--keep-workers`:

518 

519```bash theme={null}

520claude daemon stop --any --keep-workers

521```

522 

523The new supervisor reconnects to the running sessions. Without `--keep-workers`, the command ends the background sessions too. The `--any` flag confirms you want to stop a supervisor that started on demand rather than as an installed service, which is the default.

524 

525On Windows, if the supervisor does not respond to the stop request, the command prints its process ID. End that process with `taskkill /PID <pid>` to finish the recovery. Background sessions are still preserved when you passed `--keep-workers`.

526 

527### Background sessions cannot read Desktop, Documents, or Downloads on macOS

528 

529On macOS, the background session host runs as its own process and requests access to protected folders separately from your terminal. If a background session reports `Operation not permitted` when reading `~/Desktop`, `~/Documents`, `~/Downloads`, or another protected location, grant access in System Settings under Privacy & Security > Files and Folders, or enable Full Disk Access for the entry.

530 

531With the native installer, the entry appears as Claude Code and the grant persists across updates. With other install methods such as Homebrew or npm, the entry shows the binary path and may need to be granted again after updating.

532 

505### A session is slow to respond after attaching533### A session is slow to respond after attaching

506 534 

507Once a session has finished and sat unattached for about an hour, the supervisor stops its process to free resources. Attaching starts a fresh process from where it left off, which takes a moment. Sessions that are working, waiting on you, or [pinned](#organize-the-list) are not stopped this way, so pin a session with `Ctrl+T` to keep it responsive.535Once a session has finished and sat unattached for about an hour, the supervisor stops its process to free resources. Attaching starts a fresh process from where it left off, which takes a moment. Sessions that are working, waiting on you, or [pinned](#organize-the-list) are not stopped this way, so pin a session with `Ctrl+T` to keep it responsive.

Details

494* [Bedrock inference profiles](https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-support.html)494* [Bedrock inference profiles](https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-support.html)

495* [Bedrock token burndown and quotas](https://docs.aws.amazon.com/bedrock/latest/userguide/quotas-token-burndown.html)495* [Bedrock token burndown and quotas](https://docs.aws.amazon.com/bedrock/latest/userguide/quotas-token-burndown.html)

496* [Claude Code on Amazon Bedrock: Quick Setup Guide](https://community.aws/content/2tXkZKrZzlrlu0KfH8gST5Dkppq/claude-code-on-amazon-bedrock-quick-setup-guide)496* [Claude Code on Amazon Bedrock: Quick Setup Guide](https://community.aws/content/2tXkZKrZzlrlu0KfH8gST5Dkppq/claude-code-on-amazon-bedrock-quick-setup-guide)

497* [Claude Code Monitoring Implementation (Bedrock)](../../../raw.githubusercontent.com/aws-solutions-library-samples/guidance-for-claude-code-with-amazon-bedrock/main/assets/docs/MONITORING.md)497* [Claude Code Monitoring Implementation (Bedrock)](../../../raw.githubusercontent.com/aws-solutions-library-samples/guidance-for-claude-code-with-amazon-bedrock/refs/heads/main/assets/docs/MONITORING.md)

Details

28| `claude attach <id>` | Attach to a [background session](/en/agent-view#manage-sessions-from-the-shell) in this terminal | `claude attach 7c5dcf5d` |28| `claude attach <id>` | Attach to a [background session](/en/agent-view#manage-sessions-from-the-shell) in this terminal | `claude attach 7c5dcf5d` |

29| `claude auto-mode defaults` | Print the built-in [auto mode](/en/permission-modes#eliminate-prompts-with-auto-mode) classifier rules as JSON. Use `claude auto-mode config` to see your effective config with settings applied | `claude auto-mode defaults > rules.json` |29| `claude auto-mode defaults` | Print the built-in [auto mode](/en/permission-modes#eliminate-prompts-with-auto-mode) classifier rules as JSON. Use `claude auto-mode config` to see your effective config with settings applied | `claude auto-mode defaults > rules.json` |

30| `claude daemon status` | Print the background-session [supervisor's](/en/agent-view#the-supervisor-process) state, version, socket directory, and worker count for diagnostics. Exits 1 if the supervisor isn't running | `claude daemon status` |30| `claude daemon status` | Print the background-session [supervisor's](/en/agent-view#the-supervisor-process) state, version, socket directory, and worker count for diagnostics. Exits 1 if the supervisor isn't running | `claude daemon status` |

31| `claude daemon stop --any` | Stop the background-session [supervisor](/en/agent-view#the-supervisor-process) and the sessions it hosts. Pass `--keep-workers` to leave background sessions running so the next supervisor reconnects to them. `--any` confirms stopping an on-demand supervisor, which is the default. Use this to recover from an [unresponsive supervisor](/en/agent-view#agent-view-says-the-background-service-did-not-respond) | `claude daemon stop --any --keep-workers` |

31| `claude logs <id>` | Print recent output from a [background session](/en/agent-view#manage-sessions-from-the-shell) | `claude logs 7c5dcf5d` |32| `claude logs <id>` | Print recent output from a [background session](/en/agent-view#manage-sessions-from-the-shell) | `claude logs 7c5dcf5d` |

32| `claude mcp` | Configure Model Context Protocol (MCP) servers | See the [Claude Code MCP documentation](/en/mcp). |33| `claude mcp` | Configure Model Context Protocol (MCP) servers | See the [Claude Code MCP documentation](/en/mcp). |

33| `claude plugin` | Manage Claude Code [plugins](/en/plugins). Alias: `claude plugins`. See [plugin reference](/en/plugins-reference#cli-commands-reference) for subcommands | `claude plugin install code-review@claude-plugins-official` |34| `claude plugin` | Manage Claude Code [plugins](/en/plugins). Alias: `claude plugins`. See [plugin reference](/en/plugins-reference#cli-commands-reference) for subcommands | `claude plugin install code-review@claude-plugins-official` |

en/desktop.md +3 −1

Details

676* **Models**: Sonnet, Opus, and Haiku are available in both. In Desktop, select the model from the dropdown next to the send button. You can change the model mid-session from the same dropdown.676* **Models**: Sonnet, Opus, and Haiku are available in both. In Desktop, select the model from the dropdown next to the send button. You can change the model mid-session from the same dropdown.

677 677 

678<Note>678<Note>

679 **MCP servers: desktop chat app vs Claude Code**: MCP servers configured for the Claude Desktop chat app in `claude_desktop_config.json` are separate from Claude Code and will not appear in the Code tab. To use MCP servers in Claude Code, configure them in `~/.claude.json` or your project's `.mcp.json` file. See [MCP configuration](/en/mcp#installing-mcp-servers) for details.679 **MCP servers from the Claude Desktop chat app**: the Desktop app loads MCP servers from `claude_desktop_config.json` into Code tab sessions, alongside servers from `~/.claude.json` and `.mcp.json`. A server defined in `claude_desktop_config.json` is available in both the Desktop chat surface and the Code tab.

680 

681 The standalone CLI does not read `claude_desktop_config.json`. On macOS and WSL, run `claude mcp add-from-claude-desktop` to copy those servers into `~/.claude.json`. See [Import MCP servers from Claude Desktop](/en/mcp#import-mcp-servers-from-claude-desktop) for the import flow and scope options.

680</Note>682</Note>

681 683 

682### Feature comparison684### Feature comparison

Details

333 333 

334Claude Code reloads all active plugins and shows counts for plugins, skills, agents, hooks, plugin MCP servers, and plugin LSP servers.334Claude Code reloads all active plugins and shows counts for plugins, skills, agents, hooks, plugin MCP servers, and plugin LSP servers.

335 335 

336Reloading has a token cost on the next request: newly loaded components announce themselves in content appended to the conversation, while the existing history still reads from the prompt cache. A plugin that provides MCP servers costs more when its tools aren't deferred by [tool search](/en/mcp#scale-with-mcp-tool-search): the change invalidates the cache and the next request re-reads the entire conversation. See [enabling or disabling a plugin](/en/prompt-caching#enabling-or-disabling-a-plugin) for details.

337 

336## Manage marketplaces338## Manage marketplaces

337 339 

338You can manage marketplaces through the interactive `/plugin` interface or with CLI commands.340You can manage marketplaces through the interactive `/plugin` interface or with CLI commands.

en/errors.md +3 −3

Details

26| `<model> is temporarily unavailable, so auto mode cannot determine the safety of...` | [Server errors](#auto-mode-cannot-determine-the-safety-of-an-action) |26| `<model> is temporarily unavailable, so auto mode cannot determine the safety of...` | [Server errors](#auto-mode-cannot-determine-the-safety-of-an-action) |

27| `Auto mode could not evaluate this action and is blocking it for safety` | [Server errors](#auto-mode-cannot-determine-the-safety-of-an-action) |27| `Auto mode could not evaluate this action and is blocking it for safety` | [Server errors](#auto-mode-cannot-determine-the-safety-of-an-action) |

28| `Auto mode classifier transcript exceeded context window` | [Server errors](#auto-mode-cannot-determine-the-safety-of-an-action) |28| `Auto mode classifier transcript exceeded context window` | [Server errors](#auto-mode-cannot-determine-the-safety-of-an-action) |

29| `You've hit your session limit` / `You've hit your weekly limit` | [Usage limits](#youve-hit-your-session-limit) |29| `You've hit your session limit` / `You've hit your weekly limit` | [Usage limits](#you%E2%80%99ve-hit-your-session-limit) |

30| `Server is temporarily limiting requests` | [Usage limits](#server-is-temporarily-limiting-requests) |30| `Server is temporarily limiting requests` | [Usage limits](#server-is-temporarily-limiting-requests) |

31| `Request rejected (429)` | [Usage limits](#request-rejected-429) |31| `Request rejected (429)` | [Usage limits](#request-rejected-429) |

32| `Credit balance is too low` | [Usage limits](#credit-balance-is-too-low) |32| `Credit balance is too low` | [Usage limits](#credit-balance-is-too-low) |


34| `Invalid API key` | [Authentication](#invalid-api-key) |34| `Invalid API key` | [Authentication](#invalid-api-key) |

35| `This organization has been disabled` | [Authentication](#this-organization-has-been-disabled) |35| `This organization has been disabled` | [Authentication](#this-organization-has-been-disabled) |

36| `Your organization has disabled Claude subscription access` | [Authentication](#your-organization-has-disabled-claude-subscription-access) |36| `Your organization has disabled Claude subscription access` | [Authentication](#your-organization-has-disabled-claude-subscription-access) |

37| `Routines are disabled by your organization's policy` | [Authentication](#routines-are-disabled-by-your-organizations-policy) |37| `Routines are disabled by your organization's policy` | [Authentication](#routines-are-disabled-by-your-organization%E2%80%99s-policy) |

38| `OAuth token revoked` / `OAuth token has expired` | [Authentication](#oauth-token-revoked-or-expired) |38| `OAuth token revoked` / `OAuth token has expired` | [Authentication](#oauth-token-revoked-or-expired) |

39| `does not meet scope requirement user:profile` | [Authentication](#oauth-scope-requirement) |39| `does not meet scope requirement user:profile` | [Authentication](#oauth-scope-requirement) |

40| `Unable to connect to API` | [Network](#unable-to-connect-to-api) |40| `Unable to connect to API` | [Network](#unable-to-connect-to-api) |


47| `Unable to resize image` | [Request errors](#unable-to-resize-image) |47| `Unable to resize image` | [Request errors](#unable-to-resize-image) |

48| `PDF too large` / `PDF is password protected` | [Request errors](#pdf-errors) |48| `PDF too large` / `PDF is password protected` | [Request errors](#pdf-errors) |

49| `Extra inputs are not permitted` | [Request errors](#extra-inputs-are-not-permitted) |49| `Extra inputs are not permitted` | [Request errors](#extra-inputs-are-not-permitted) |

50| `There's an issue with the selected model` | [Request errors](#theres-an-issue-with-the-selected-model) |50| `There's an issue with the selected model` | [Request errors](#there%E2%80%99s-an-issue-with-the-selected-model) |

51| `Claude Opus is not available with the Claude Pro plan` | [Request errors](#claude-opus-is-not-available-with-the-claude-pro-plan) |51| `Claude Opus is not available with the Claude Pro plan` | [Request errors](#claude-opus-is-not-available-with-the-claude-pro-plan) |

52| `thinking.type.enabled is not supported for this model` | [Request errors](#thinking-type-enabled-is-not-supported-for-this-model) |52| `thinking.type.enabled is not supported for this model` | [Request errors](#thinking-type-enabled-is-not-supported-for-this-model) |

53| `max_tokens must be greater than thinking.budget_tokens` | [Request errors](#thinking-budget-exceeds-output-limit) |53| `max_tokens must be greater than thinking.budget_tokens` | [Request errors](#thinking-budget-exceeds-output-limit) |

Details

330 </Card>330 </Card>

331 331 

332 <Card title="Hooks" icon="bolt" href="/en/hooks-guide">332 <Card title="Hooks" icon="bolt" href="/en/hooks-guide">

333 Automate workflows with hooks333 Automate actions with hooks

334 </Card>334 </Card>

335 335 

336 <Card title="Plugins" icon="puzzle-piece" href="/en/plugins">336 <Card title="Plugins" icon="puzzle-piece" href="/en/plugins">

en/glossary.md +2 −2

Details

82 82 

83### CLAUDE.md83### CLAUDE.md

84 84 

85A markdown file of persistent instructions you write for Claude, loaded at the start of every session as a user message after the system prompt. Put project conventions, architecture notes, and "always do X" rules here. CLAUDE.md survives [compaction](#compaction) and is re-read fresh from disk afterward.85A markdown file of persistent instructions you write for Claude, loaded at the start of every session as a user message after the system prompt. Put project conventions, architecture notes, and "always do X" rules here. Project-root CLAUDE.md survives [compaction](#compaction) and is re-read fresh from disk afterward.

86 86 

87You can place CLAUDE.md at project scope in `./CLAUDE.md` or `./.claude/CLAUDE.md`, at user scope in `~/.claude/CLAUDE.md`, or as [managed policy](#managed-settings) for your organization. More specific locations take precedence.87You can place CLAUDE.md at project scope in `./CLAUDE.md` or `./.claude/CLAUDE.md`, at user scope in `~/.claude/CLAUDE.md`, or as [managed policy](#managed-settings) for your organization. All discovered files are concatenated into context rather than overriding each other, ordered from broadest scope to most specific.

88 88 

89Learn more: [CLAUDE.md files](/en/memory#claude-md-files)89Learn more: [CLAUDE.md files](/en/memory#claude-md-files)

90 90 

en/goal.md +2 −2

Details

21 21 

22This page covers how to:22This page covers how to:

23 23 

24* [Compare autonomous workflow approaches](#compare-to-other-autonomous-workflows): `/loop`, Stop hooks, and auto mode24* [Compare ways to keep a session running](#compare-ways-to-keep-a-session-running): `/loop`, Stop hooks, and auto mode

25* [Set a goal](#set-a-goal) and [write an effective condition](#write-an-effective-condition)25* [Set a goal](#set-a-goal) and [write an effective condition](#write-an-effective-condition)

26* [Check status](#check-status), [clear early](#clear-a-goal), and [run non-interactively](#run-non-interactively)26* [Check status](#check-status), [clear early](#clear-a-goal), and [run non-interactively](#run-non-interactively)

27* See [how evaluation works](#how-evaluation-works) and [requirements](#requirements)27* See [how evaluation works](#how-evaluation-works) and [requirements](#requirements)

28 28 

29## Compare to other autonomous workflows29## Compare ways to keep a session running

30 30 

31Three approaches keep the current session running between prompts. Pick based on what should start the next turn:31Three approaches keep the current session running between prompts. Pick based on what should start the next turn:

32 32 

en/hooks.md +95 −5

Details

7> Reference for Claude Code hook events, configuration schema, JSON input/output formats, exit codes, async hooks, HTTP hooks, prompt hooks, and MCP tool hooks.7> Reference for Claude Code hook events, configuration schema, JSON input/output formats, exit codes, async hooks, HTTP hooks, prompt hooks, and MCP tool hooks.

8 8 

9<Tip>9<Tip>

10 For a quickstart guide with examples, see [Automate workflows with hooks](/en/hooks-guide).10 For a quickstart guide with examples, see [Automate actions with hooks](/en/hooks-guide).

11</Tip>11</Tip>

12 12 

13Hooks are user-defined shell commands, HTTP endpoints, or LLM prompts that execute automatically at specific points in Claude Code's lifecycle. Use this reference to look up event schemas, configuration options, JSON input/output formats, and advanced features like async hooks, HTTP hooks, and MCP tool hooks. If you're setting up hooks for the first time, start with the [guide](/en/hooks-guide) instead.13Hooks are user-defined shell commands, HTTP endpoints, or LLM prompts that execute automatically at specific points in Claude Code's lifecycle. Use this reference to look up event schemas, configuration options, JSON input/output formats, and advanced features like async hooks, HTTP hooks, and MCP tool hooks. If you're setting up hooks for the first time, start with the [guide](/en/hooks-guide) instead.


298| :-------------- | :------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |298| :-------------- | :------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

299| `type` | yes | `"command"`, `"http"`, `"mcp_tool"`, `"prompt"`, or `"agent"` |299| `type` | yes | `"command"`, `"http"`, `"mcp_tool"`, `"prompt"`, or `"agent"` |

300| `if` | no | Permission rule syntax to filter when this hook runs, such as `"Bash(git *)"` or `"Edit(*.ts)"`. The hook only spawns if the tool call matches the pattern, or if a Bash command is too complex to parse. Only evaluated on tool events: `PreToolUse`, `PostToolUse`, `PostToolUseFailure`, `PermissionRequest`, and `PermissionDenied`. On other events, a hook with `if` set never runs. Uses the same syntax as [permission rules](/en/permissions) |300| `if` | no | Permission rule syntax to filter when this hook runs, such as `"Bash(git *)"` or `"Edit(*.ts)"`. The hook only spawns if the tool call matches the pattern, or if a Bash command is too complex to parse. Only evaluated on tool events: `PreToolUse`, `PostToolUse`, `PostToolUseFailure`, `PermissionRequest`, and `PermissionDenied`. On other events, a hook with `if` set never runs. Uses the same syntax as [permission rules](/en/permissions) |

301| `timeout` | no | Seconds before canceling. Defaults: 600 for `command`, `http`, and `mcp_tool`; 30 for `prompt`; 60 for `agent`. [`UserPromptSubmit`](#userpromptsubmit) lowers the `command`, `http`, and `mcp_tool` default to 30 |301| `timeout` | no | Seconds before canceling. Defaults: 600 for `command`, `http`, and `mcp_tool`; 30 for `prompt`; 60 for `agent`. [`UserPromptSubmit`](#userpromptsubmit) lowers the `command`, `http`, and `mcp_tool` default to 30, and [`MessageDisplay`](#messagedisplay) lowers it to 10 |

302| `statusMessage` | no | Custom spinner message displayed while the hook runs |302| `statusMessage` | no | Custom spinner message displayed while the hook runs |

303| `once` | no | If `true`, runs once per session then is removed. Only honored for hooks declared in [skill frontmatter](#hooks-in-skills-and-agents); ignored in settings files and agent frontmatter |303| `once` | no | If `true`, runs once per session then is removed. Only honored for hooks declared in [skill frontmatter](#hooks-in-skills-and-agents); ignored in settings files and agent frontmatter |

304 304 


1048to add additional context based on the prompt/conversation, validate prompts, or1048to add additional context based on the prompt/conversation, validate prompts, or

1049block certain types of prompts.1049block certain types of prompts.

1050 1050 

1051`UserPromptSubmit` hooks have a default timeout of 30 seconds for `command`, `http`, and `mcp_tool` types, shorter than the 600-second default for those types on other events. Because this hook runs before every prompt and blocks model processing until it completes, a stuck hook stalls the session. If your hook needs more time, set the `timeout` field in the hook entry.1051`UserPromptSubmit` hooks have a default timeout of 30 seconds for `command`, `http`, and `mcp_tool` types, shorter than the 600-second default for those types on most other events. Because this hook runs before every prompt and blocks model processing until it completes, a stuck hook stalls the session. If your hook needs more time, set the `timeout` field in the hook entry.

1052 1052 

1053#### UserPromptSubmit input1053#### UserPromptSubmit input

1054 1054 


1153 1153 

1154### MessageDisplay1154### MessageDisplay

1155 1155 

1156Runs while an assistant message streams to the screen. Claude Code displays the message in increments: each time a batch of newly completed lines is ready to render, the hook runs once with those lines and Claude Code renders the hook's replacement text in their place. A long message produces several calls; a short message may produce only one. Use this to reformat, redact, or condense Claude's responses as they appear on screen.1156Runs while an assistant message streams to the screen. Claude Code displays the message in increments: each time a batch of newly completed lines is ready to render, the hook runs once with those lines and Claude Code renders the hook's replacement text in their place. A long message produces several calls; a short message may produce only one.

1157 1157 

1158MessageDisplay is display-only: the replacement text changes only what is rendered on screen. The transcript and what Claude sees keep the original text, so Claude never sees the replacement, and verbose mode shows the original. MessageDisplay does not support matchers and fires for every assistant message that streams text; messages with no text, such as tool-call-only responses, do not trigger it.1158Use MessageDisplay to:

1159 

1160* strip markdown for a minimal display

1161* transform the text an Agent SDK application shows its users

1162* redact API keys or internal hostnames from Claude's responses

1163 

1164Claude Code holds each batch until your hook returns, so keep the hook fast. If the hook fails or times out, Claude Code displays the original text. The default timeout for this event is 10 seconds; if your hook needs more time, set the `timeout` field in the hook entry.

1165 

1166MessageDisplay is display-only: the replacement text changes only what is rendered on screen. The transcript and what Claude sees keep the original text, so Claude never sees the replacement, and verbose mode shows the original. The hook receives assistant message text only, so tool results and the text you type render unchanged.

1167 

1168MessageDisplay does not support matchers and fires for every assistant message that streams text; messages with no text, such as tool-call-only responses, do not trigger it.

1159 1169 

1160In non-interactive runs, including Agent SDK queries and `claude -p`, MessageDisplay runs once per assistant message instead of once per batch of lines. The single call arrives after the message completes and carries the full message text: `index` is `0`, `final` is `true`, and `delta` holds the entire message. A hook that collects the `delta` text for each message receives the same total text in both modes.1170In non-interactive runs, including Agent SDK queries and `claude -p`, MessageDisplay runs once per assistant message instead of once per batch of lines. The single call arrives after the message completes and carries the full message text: `index` is `0`, `final` is `true`, and `delta` holds the entire message. A hook that collects the `delta` text for each message receives the same total text in both modes.

1161 1171 


1195 1205 

1196MessageDisplay hooks have no decision control. They cannot block the message or change what is stored in the transcript or sent to Claude.1206MessageDisplay hooks have no decision control. They cannot block the message or change what is stored in the transcript or sent to Claude.

1197 1207 

1208This example strips markdown formatting from Claude's responses for a plain-text display. The script reads each batch from stdin, removes bold markers and inline code backticks from `delta`, and returns the result as `displayContent`.

1209 

1210<Tabs>

1211 <Tab title="macOS/Linux">

1212 Register a command hook for the event in your settings file:

1213 

1214 ```json theme={null}

1215 {

1216 "hooks": {

1217 "MessageDisplay": [

1218 {

1219 "hooks": [

1220 {

1221 "type": "command",

1222 "command": "${CLAUDE_PROJECT_DIR}/.claude/hooks/plain-display.sh",

1223 "args": []

1224 }

1225 ]

1226 }

1227 ]

1228 }

1229 }

1230 ```

1231 

1232 Save this script to `.claude/hooks/plain-display.sh` in your project and make it executable with `chmod +x`:

1233 

1234 ```bash theme={null}

1235 #!/bin/bash

1236 jq '{hookSpecificOutput: {hookEventName: "MessageDisplay", displayContent: (.delta | gsub("\\*\\*"; "") | gsub("`"; ""))}}'

1237 ```

1238 

1239 The script needs `jq` on your `PATH`.

1240 </Tab>

1241 

1242 <Tab title="Windows (PowerShell)">

1243 Register a command hook that runs the script through PowerShell:

1244 

1245 ```json theme={null}

1246 {

1247 "hooks": {

1248 "MessageDisplay": [

1249 {

1250 "hooks": [

1251 {

1252 "type": "command",

1253 "command": "powershell.exe",

1254 "args": [

1255 "-NoProfile",

1256 "-ExecutionPolicy",

1257 "Bypass",

1258 "-File",

1259 "${CLAUDE_PROJECT_DIR}/.claude/hooks/plain-display.ps1"

1260 ]

1261 }

1262 ]

1263 }

1264 ]

1265 }

1266 }

1267 ```

1268 

1269 The `-NoProfile` flag skips loading your PowerShell profile so the hook starts fast, and `-ExecutionPolicy Bypass` lets PowerShell run the local script file.

1270 

1271 Save this script to `.claude/hooks/plain-display.ps1` in your project:

1272 

1273 ```powershell theme={null}

1274 $batch = [Console]::In.ReadToEnd() | ConvertFrom-Json

1275 $text = $batch.delta -replace '\*\*', '' -replace '`', ''

1276 @{

1277 hookSpecificOutput = @{

1278 hookEventName = "MessageDisplay"

1279 displayContent = $text

1280 }

1281 } | ConvertTo-Json

1282 ```

1283 </Tab>

1284</Tabs>

1285 

1286Batches with no markdown pass through unchanged. If the script fails, for example because `jq` is missing, Claude Code displays the original text and notes the failure only in [debug output](#debug-hooks), not in the session.

1287 

1198### PreToolUse1288### PreToolUse

1199 1289 

1200Runs after Claude creates tool parameters and before processing the tool call. Matches on tool name: `Bash`, `Edit`, `Write`, `Read`, `Glob`, `Grep`, `Agent`, `WebFetch`, `WebSearch`, `AskUserQuestion`, `ExitPlanMode`, and any [MCP tool names](#match-mcp-tools).1290Runs after Claude creates tool parameters and before processing the tool call. Matches on tool name: `Bash`, `Edit`, `Write`, `Read`, `Glob`, `Grep`, `Agent`, `WebFetch`, `WebSearch`, `AskUserQuestion`, `ExitPlanMode`, and any [MCP tool names](#match-mcp-tools).

Details

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.3> Use this file to discover all available pages before exploring further.

4 4 

5# Automate workflows with hooks5# Automate actions with hooks

6 6 

7> Run shell commands automatically when Claude Code edits files, finishes tasks, or needs input. Format code, send notifications, validate commands, and enforce project rules.7> Run shell commands automatically when Claude Code edits files, finishes tasks, or needs input. Format code, send notifications, validate commands, and enforce project rules.

8 8 


869 869 

870* Command hooks communicate through stdout, stderr, and exit codes only. They cannot trigger `/` commands or tool calls. Text returned via `additionalContext` is injected as a system reminder that Claude reads as plain text. HTTP hooks communicate through the response body instead.870* Command hooks communicate through stdout, stderr, and exit codes only. They cannot trigger `/` commands or tool calls. Text returned via `additionalContext` is injected as a system reminder that Claude reads as plain text. HTTP hooks communicate through the response body instead.

871* Hook timeouts vary by type. Override per hook with the `timeout` field in seconds.871* Hook timeouts vary by type. Override per hook with the `timeout` field in seconds.

872 * `command`, `http`, `mcp_tool`: 10 minutes. `UserPromptSubmit` lowers these to 30 seconds.872 * `command`, `http`, `mcp_tool`: 10 minutes. `UserPromptSubmit` lowers these to 30 seconds, and `MessageDisplay` lowers them to 10 seconds.

873 * `prompt`: 30 seconds.873 * `prompt`: 30 seconds.

874 * `agent`: 60 seconds.874 * `agent`: 60 seconds.

875* `PostToolUse` hooks cannot undo actions since the tool has already executed.875* `PostToolUse` hooks cannot undo actions since the tool has already executed.

Details

380 380 

381Once conventions live in plugins, a teammate starting Claude in an unfamiliar part of the tree has no signal about which plugin that area's owners maintain. A [`SessionStart` hook](/en/hooks#sessionstart) can close that gap, since anything the hook prints to stdout is added to Claude's context before the first prompt.381Once conventions live in plugins, a teammate starting Claude in an unfamiliar part of the tree has no signal about which plugin that area's owners maintain. A [`SessionStart` hook](/en/hooks#sessionstart) can close that gap, since anything the hook prints to stdout is added to Claude's context before the first prompt.

382 382 

383For example, you can write a script that reads the launch directory from the [hook input](/en/hooks#common-input-fields), looks it up in a path-to-plugin map committed to the repository, and prints the recommendation for Claude to relay in its first reply. See [Automate workflows with hooks](/en/hooks-guide) to write and register the hook.383For example, you can write a script that reads the launch directory from the [hook input](/en/hooks#common-input-fields), looks it up in a path-to-plugin map committed to the repository, and prints the recommendation for Claude to relay in its first reply. See [Automate actions with hooks](/en/hooks-guide) to write and register the hook.

384 384 

385## Put it together385## Put it together

386 386 

en/mcp.md +3 −1

Details

10 10 

11Connect a server when you find yourself copying data into chat from another tool, like an issue tracker or a monitoring dashboard. Once connected, Claude can read and act on that system directly instead of working from what you paste.11Connect a server when you find yourself copying data into chat from another tool, like an issue tracker or a monitoring dashboard. Once connected, Claude can read and act on that system directly instead of working from what you paste.

12 12 

13If you're connecting your first server, start with the [MCP quickstart](/en/mcp-quickstart) for a step-by-step walkthrough. This page is the full reference.

14 

13## What you can do with MCP15## What you can do with MCP

14 16 

15With MCP servers connected, you can ask Claude Code to:17With MCP servers connected, you can ask Claude Code to:


955 957 

956## Scale with MCP Tool Search958## Scale with MCP Tool Search

957 959 

958Tool search keeps MCP context usage low by deferring tool definitions until Claude needs them. Only tool names load at session start, so adding more MCP servers has minimal impact on your context window.960Tool search keeps MCP context usage low by deferring tool definitions until Claude needs them. Only tool names and server instructions load at session start, so adding more MCP servers has minimal impact on your context window.

959 961 

960### How it works962### How it works

961 963 

en/mcp-quickstart.md +379 −0 created

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

5# Connect to MCP servers

6 

7> Add an MCP server to Claude Code, verify the connection, and find the configuration on disk.

8 

9The [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) lets Claude Code use tools beyond its built-in set, such as searching an issue tracker, querying a database, or controlling a web browser. These tools come from MCP servers, which run on your machine or as hosted services.

10 

11This guide walks you through connecting one MCP server end to end with the Claude Code CLI. By the end, you'll have a server connected and responding, know where its configuration lives on disk, and know how to fix the most common connection errors.

12 

13<Note>

14 You can also add MCP servers from other surfaces, including the desktop app, VS Code, and the web. See [Connect from other surfaces](#connect-from-other-surfaces).

15</Note>

16 

17For every way to connect and configure MCP servers in Claude Code, see the [MCP reference](/en/mcp).

18 

19## Before you begin

20 

21Make sure you have:

22 

23* [Claude Code installed](/en/quickstart) and authenticated

24* A terminal open in a project directory. Any directory works, including an empty one.

25 

26## Add and verify a server

27 

28The example below connects to the [Claude Code documentation MCP server](https://code.claude.com/docs/mcp), a hosted server with full-text search over the Claude Code docs. It doesn't require authentication or any special configuration, so it works well as a first server to test the setup flow with.

29 

30The steps are the same for any server: add it, check the connection status, then use it in a session, with an optional cleanup step at the end. Some servers add a step, like a browser sign-in, shown in [Additional MCP server examples](#additional-mcp-server-examples). For more servers to connect, browse the [Anthropic Directory](/en/mcp#find-and-build-mcp-servers).

31 

32<Steps>

33 <Step title="Add the MCP server">

34 Register the server with Claude Code. Run this in your terminal, not inside a `claude` session: you're configuring the server before starting a conversation.

35 

36 ```bash theme={null}

37 claude mcp add --transport http claude-code-docs https://code.claude.com/docs/mcp

38 ```

39 

40 The parts of the command:

41 

42 * `claude mcp add`: registers a server with Claude Code.

43 * `--transport http`: the server is hosted at a URL rather than run as a local process.

44 * `claude-code-docs`: a name you make up. Calling the same server `docs` would work identically. Claude Code uses whatever name you pick to label the server's tools in Claude's output and to refer to the server in commands like `claude mcp remove`.

45 * `https://code.claude.com/docs/mcp`: the URL where the server is hosted.

46 

47 The command prints a confirmation like `Added HTTP MCP server claude-code-docs with URL: https://code.claude.com/docs/mcp to local config`. The `local config` part means the server is registered to you, in this project: if you start Claude Code in a different project, this server isn't active there. To register a server once for all your projects, add it at user scope, covered in [Change server scope](#change-server-scope).

48 </Step>

49 

50 <Step title="Check the connection status">

51 Confirm the server appears in your server list and check its status:

52 

53 ```bash theme={null}

54 claude mcp list

55 ```

56 

57 The server appears with a status indicator:

58 

59 | Status | Meaning |

60 | :----------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

61 | `✓ Connected` | Ready to use. This is what you should see for `claude-code-docs` |

62 | `! Needs authentication` | The server is reachable but needs a browser sign-in, or a token passed with `--header`. See [Connect a server that requires sign-in](#connect-a-server-that-requires-sign-in) |

63 | `✗ Failed to connect` | Server didn't respond. See [Troubleshooting](#troubleshooting) |

64 | `✗ Connection error` | The connection attempt threw an error. See [Troubleshooting](#troubleshooting) |

65 | `⏸ Pending approval` | A project-scoped server you haven't approved yet. See [Edit .mcp.json directly](#edit-mcp-json-directly) |

66 </Step>

67 

68 <Step title="Use the server">

69 Start a session and ask Claude to use the new server by name:

70 

71 ```bash theme={null}

72 claude

73 ```

74 

75 ```text theme={null}

76 Use the claude-code-docs server to look up what MCP_TIMEOUT does

77 ```

78 

79 <Info>

80 You don't normally need to name a server in your prompt, since Claude chooses relevant tools on its own. Naming it here guarantees the demonstration goes through the new server rather than another tool, such as web fetch, that could answer the same question.

81 </Info>

82 

83 The first time Claude calls the server, it asks for permission to use the new tool. Approve it to continue. The tool call in Claude's output is labeled with the server name, which is how you confirm the answer came from the MCP server rather than Claude's built-in knowledge.

84 </Step>

85 

86 <Step title="Remove the server">

87 This step is optional. When you're done experimenting, you can remove the server:

88 

89 ```bash theme={null}

90 claude mcp remove claude-code-docs

91 ```

92 

93 <Note>

94 Each connected server takes some space in [Claude's context window](/en/how-claude-code-works#the-context-window) because its tool names and server instructions load into every session. Removing servers you no longer use keeps that space free.

95 </Note>

96 </Step>

97</Steps>

98 

99## Where servers are saved

100 

101The `claude mcp add` command writes the server's details to a configuration file. By default it registers the server at `local` scope: private to you, active only in the current project. Pass `--scope user` to register it once for all your projects, or `--scope project` to share it with teammates. [Change server scope](#change-server-scope) walks through both.

102 

103<Note>

104 `claude mcp add` works the same in every shell, including PowerShell and Command Prompt. Inside a `claude` session, use the `/mcp` command to check and manage servers you've already added.

105</Note>

106 

107There are other ways to add a server, each covered later on this page:

108 

109* [Add a local server](#add-a-local-server): run a program on your machine instead of connecting to a URL.

110* [Edit `.mcp.json` directly](#edit-mcp-json-directly): write the JSON entry yourself instead of using the command.

111* [Connect a server that requires sign-in](#connect-a-server-that-requires-sign-in): add a hosted server that needs a browser sign-in before its tools work.

112 

113### Find your configuration on disk

114 

115The `claude mcp add` command writes the server to one of three scopes, stored across two files, depending on the `--scope` flag. You don't need to edit these files directly, but knowing where they are helps with debugging and version control.

116 

117| Scope | File | Available to |

118| :-------- | :----------------------------------------------------- | :--------------------------------------- |

119| `local` | `~/.claude.json`, under the entry for this project | Only you, only this project. The default |

120| `project` | `.mcp.json` in your project root | Everyone who clones the project |

121| `user` | `~/.claude.json`, under the top-level `mcpServers` key | Only you, all projects |

122 

123On Windows, `~/.claude.json` resolves to `%USERPROFILE%\.claude.json`, typically `C:\Users\YourName\.claude.json`. If you've set [`CLAUDE_CONFIG_DIR`](/en/env-vars), Claude Code reads `.claude.json` from inside that directory instead.

124 

125Run `claude mcp get claude-code-docs` to see which scope holds a server's definition. For how the scopes interact when the same server is defined in more than one, see [MCP installation scopes](/en/mcp#mcp-installation-scopes).

126 

127## Change server scope

128 

129A server's scope is fixed when you add it, so changing scope means removing the entry and re-adding it at the new one. Both cases below start by removing the local entry from the first walkthrough, so the server has only one definition. If you already removed it at the end of that walkthrough, skip this command:

130 

131```bash theme={null}

132claude mcp remove claude-code-docs --scope local

133```

134 

135### Use a server in all your projects

136 

137Re-add the server at `user` scope to make it active in every project you open, still private to you:

138 

139```bash theme={null}

140claude mcp add --scope user --transport http claude-code-docs https://code.claude.com/docs/mcp

141```

142 

143### Share a server with your team

144 

145Re-add the server at `project` scope, which writes to `.mcp.json` in the project root:

146 

147```bash theme={null}

148claude mcp add --scope project --transport http claude-code-docs https://code.claude.com/docs/mcp

149```

150 

151Commit `.mcp.json` to version control. Teammates who clone the repository and start Claude Code see a prompt to approve the server, then it connects for them too.

152 

153## Additional MCP server examples

154 

155The first walkthrough used a hosted server that connects without any sign-in. The examples below cover the other two common shapes, with the same add, check, use flow.

156 

157### Add a local server

158 

159A local stdio server is a program Claude Code starts as a subprocess on your machine, rather than a service it reaches over a URL. Use one for tools that need access to local resources like a browser, your filesystem, or a database socket.

160 

161The [Playwright MCP server](https://github.com/microsoft/playwright-mcp) is a good one to try: it gives Claude a browser it can navigate, click, and read, and it needs no account. It runs through `npx`, so it requires [Node.js](https://nodejs.org/en/download) 18 or later.

162 

163<Steps>

164 <Step title="Add the Playwright server">

165 Register the server with the command Claude Code should run to start it:

166 

167 ```bash theme={null}

168 claude mcp add playwright -- npx -y @playwright/mcp@latest

169 ```

170 

171 This command differs from the hosted example in three ways:

172 

173 * There's no `--transport` flag, because local servers use the default `stdio` transport.

174 * Everything after the `--` separator is the command Claude Code runs to start the server.

175 * `-y` tells `npx` to install the package without prompting.

176 

177 Playwright drives whichever Chrome is already installed on your machine. To use a different browser, append `--browser` with the browser name, for example `--browser firefox`, after `@playwright/mcp@latest`.

178 </Step>

179 

180 <Step title="Check the connection">

181 The `Added` confirmation means the entry was saved, not that the command runs. Check the connection:

182 

183 ```bash theme={null}

184 claude mcp list

185 ```

186 

187 The first check can show `✗ Failed to connect` while `npx` downloads the package, so wait a moment and run it again.

188 </Step>

189 

190 <Step title="Use the browser">

191 Give Claude a task that needs the browser:

192 

193 ```text theme={null}

194 Use playwright to open https://example.com and tell me the page title

195 ```

196 

197 A browser window opens so you can watch it work, and the tool calls in Claude's output are labeled with the `playwright` server name and the action, like `browser_navigate`.

198 

199 Try pointing it at your local dev server to check that a page still renders after a change, or have it walk through a bug report step by step.

200 </Step>

201</Steps>

202 

203### Connect a server that requires sign-in

204 

205Hosted services like Sentry, Linear, and Notion run their MCP servers behind OAuth: you add the server's URL, then sign in through your browser.

206 

207The steps below use Sentry as the example. To connect a different service, substitute its URL, which you can find in the [Anthropic Directory](/en/mcp#find-and-build-mcp-servers) or the service's documentation.

208 

209<Steps>

210 <Step title="Add the server">

211 The `add` command is the same as for the docs server, with Sentry's URL:

212 

213 ```bash theme={null}

214 claude mcp add --transport http sentry https://mcp.sentry.dev/mcp

215 ```

216 

217 After adding, `claude mcp list` shows the server with `! Needs authentication`. That's expected: the next step completes the sign-in.

218 </Step>

219 

220 <Step title="Authenticate in your browser">

221 Start a Claude Code session and open the MCP panel:

222 

223 ```text theme={null}

224 /mcp

225 ```

226 

227 Select `sentry` from the list, press Enter, and choose `Authenticate`. Your browser opens to Sentry's sign-in page. Approve the connection there.

228 

229 Back in Claude Code, the server's status changes to connected. If sign-in fails or the browser doesn't open, see [Troubleshooting](#troubleshooting).

230 </Step>

231 

232 <Step title="Use the server">

233 Ask Claude something that needs the service, like `What Sentry projects do I have access to?`, and look for tool calls labeled with the `sentry` server name in its output.

234 </Step>

235</Steps>

236 

237Servers that authenticate with a static token instead of OAuth take the token at add time with `--header "Authorization: Bearer <token>"`. See the [GitHub example](/en/mcp#example-connect-to-github-for-code-reviews) for a worked version.

238 

239## Edit .mcp.json directly

240 

241Every file in the [scope table](#find-your-configuration-on-disk) uses the same JSON format for server entries. This section edits `.mcp.json`, the project-scope file. It's the one most worth writing by hand because it's checked into the repository, where it doubles as configuration-as-code for your team.

242 

243Create `.mcp.json` in your project root. The example below defines both servers from this guide, the hosted docs server reached over HTTP and the Playwright server as a local `stdio` process:

244 

245```json theme={null}

246{

247 "mcpServers": {

248 "claude-code-docs": {

249 "type": "http",

250 "url": "https://code.claude.com/docs/mcp"

251 },

252 "playwright": {

253 "type": "stdio",

254 "command": "npx",

255 "args": ["-y", "@playwright/mcp@latest"]

256 }

257 }

258}

259```

260 

261The fields differ by server type:

262 

263* For HTTP servers, `url` is the endpoint Claude Code connects to.

264* For stdio servers, `command` and `args` are the program it runs.

265 

266After saving the file, start a new Claude Code session in the project. Claude Code reads `.mcp.json` at startup.

267 

268The first time Claude Code sees a project-scoped server, it asks you to approve it. The prompt exists so a repository you clone can't launch processes on your machine without your consent. Approve the prompt, or run `/mcp` to approve later if you missed it.

269 

270Once you've approved, run `/mcp` and check that the servers show as connected. If one shows an error instead, see [Troubleshooting](#troubleshooting).

271 

272## Connect from other surfaces

273 

274This guide uses the `claude mcp` CLI commands, but every Claude Code surface can connect to MCP servers:

275 

276* **Claude Code desktop app**: add servers through the [Connectors UI](/en/desktop#connect-external-tools).

277* **Claude Desktop chat app**: a separate app from Claude Code. To copy servers from its `claude_desktop_config.json` into the CLI, run `claude mcp add-from-claude-desktop` on macOS or WSL.

278* **VS Code**: see [Connect to external tools with MCP](/en/vs-code#connect-to-external-tools-with-mcp).

279* **Claude Code on the web**: reads `.mcp.json` from your repository. See [Edit .mcp.json directly](#edit-mcp-json-directly).

280* **Claude.ai**: connectors you add at [claude.ai/customize/connectors](https://claude.ai/customize/connectors) load automatically in the CLI when you sign in with that account. See [Use MCP servers from Claude.ai](/en/mcp#use-mcp-servers-from-claude-ai).

281 

282## Troubleshooting

283 

284If a server doesn't connect, check its status with `/mcp` inside a session or `claude mcp list` from your shell, then match the symptom below. The `/mcp` panel also lets you reconnect or authenticate without leaving the session.

285 

286<AccordionGroup>

287 <Accordion title="/mcp shows No MCP servers configured">

288 Claude Code didn't find any servers for the current directory. The most common causes:

289 

290 * You ran `claude mcp add` from a different project. Local-scoped servers are tied to the project where you added them: the repository root, or the exact directory if you weren't in a git repository. Re-add the server from the project you're in now, or add it with `--scope user` so it isn't tied to a project.

291 * You edited a configuration file at the wrong path. The correct files are `~/.claude.json` and `<project>/.mcp.json`. Claude Code doesn't read paths such as `~/.claude/config/mcp.json`, `~/.claude/mcp.json`, or `%APPDATA%\Claude\mcp.json`.

292 </Accordion>

293 

294 <Accordion title="Status shows Failed to connect or Connection error">

295 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](#connect-a-server-that-requires-sign-in).

296 

297 For HTTP servers, confirm the URL is reachable from your machine:

298 

299 ```bash theme={null}

300 curl -I https://mcp.sentry.dev/mcp

301 ```

302 

303 In PowerShell, use `curl.exe` instead of `curl` so the request goes to the real curl binary rather than the `Invoke-WebRequest` alias.

304 

305 The response tells you which kind of problem you have:

306 

307 * A `404` or `405`: the server is up. Many MCP endpoints answer only POST requests, so this still confirms the URL is reachable from your machine.

308 * A `401` or `403`: the server is up and you need to authenticate. Use the browser sign-in in [Connect a server that requires sign-in](#connect-a-server-that-requires-sign-in), or for servers that take a token instead, like GitHub's, pass it with `--header "Authorization: Bearer <token>"` on the `claude mcp add` command.

309 * No response at all: check the URL and your network.

310 

311 For stdio servers, run the configured command directly in your terminal to see the underlying error. For the Playwright server from this guide, run:

312 

313 ```bash theme={null}

314 npx -y @playwright/mcp@latest

315 ```

316 

317 What happens next tells you where the problem is:

318 

319 * The command starts and waits for input: the server itself works. Run `claude mcp get <name>` and confirm the command shown there matches what you just ran. If the command shown differs from what you typed, you likely omitted the `--` separator before the server command. Remove the server and re-add it with `--` in place. If you wrote `.mcp.json` by hand, check its syntax and location.

320 * The command errors: the message names what's missing, such as Node.js or a browser.

321 </Accordion>

322 

323 <Accordion title="Connection timed out at startup">

324 The server took longer than the default 30-second startup timeout. A stdio server's first run can be slow while `npx` downloads the package. Increase the limit with the [`MCP_TIMEOUT`](/en/env-vars) environment variable, in milliseconds:

325 

326 ```bash theme={null}

327 MCP_TIMEOUT=60000 claude

328 ```

329 

330 In PowerShell, set the variable before the command on the same line:

331 

332 ```powershell theme={null}

333 $env:MCP_TIMEOUT = "60000"; claude

334 ```

335 </Accordion>

336 

337 <Accordion title="Server already exists">

338 You've already added a server with that name at the same scope. Either remove the existing entry first or choose a different name:

339 

340 ```bash theme={null}

341 claude mcp remove claude-code-docs

342 ```

343 

344 If the name exists at more than one scope, `remove` reports `exists in multiple scopes`. Pass `--scope` to choose which copy to delete, for example `claude mcp remove claude-code-docs --scope local`.

345 </Accordion>

346 

347 <Accordion title="Server connects but no tools appear">

348 Run `/mcp` inside a session and select the server to see its tool list. If the list is empty, the server started but didn't register any tools, which usually means it's missing a required environment variable such as an API key.

349 

350 Pass the variable with `--env KEY=value` on `claude mcp add`, or in the `env` field of the server's `.mcp.json` entry. The server's documentation lists the variables it needs.

351 </Accordion>

352 

353 <Accordion title="Changes to .mcp.json don't take effect">

354 Claude Code reads `.mcp.json` at session start. Exit and restart the session after editing the file.

355 

356 If your servers still don't appear, run `/mcp` and look for a parse warning. Claude Code skips malformed entries and shows the offending field there.

357 

358 If you previously rejected the server when prompted, reset project approvals:

359 

360 ```bash theme={null}

361 claude mcp reset-project-choices

362 ```

363 </Accordion>

364 

365 <Accordion title="OAuth sign-in fails or browser doesn't open">

366 Run `/mcp`, select the server, and choose `Authenticate` again. If the browser doesn't open automatically, copy the URL shown in the terminal and open it manually. See [Authenticate with remote MCP servers](/en/mcp#authenticate-with-remote-mcp-servers) for fixed callback ports and pre-configured credentials.

367 </Accordion>

368</AccordionGroup>

369 

370## Next steps

371 

372With one server connected, explore the rest of what MCP enables:

373 

374* [Find more MCP servers](/en/mcp#find-and-build-mcp-servers) in the Anthropic Directory

375* [Share servers with your team](/en/mcp#mcp-installation-scopes) using installation scopes

376* [Manage MCP access for an organization](/en/managed-mcp) with managed settings and policy controls

377* [Reference MCP resources](/en/mcp#use-mcp-resources) in prompts with @ mentions

378* [Run MCP prompts as commands](/en/mcp#use-mcp-prompts-as-commands) from the `/` menu

379* [Build your own server](https://modelcontextprotocol.io/quickstart/server) with the MCP SDK

Details

338export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-8[1m]'338export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-8[1m]'

339```339```

340 340 

341The `[1m]` suffix applies the 1M context window to all usage of that alias, including `opusplan`.341The `[1m]` suffix applies the 1M context window to all usage of the `opus` and `sonnet` aliases. It does not extend the plan-mode Opus phase of `opusplan`, which [remains capped at 200K](#opusplan-model-setting).

342 342 

343* Claude Code strips the suffix before sending the model ID to your provider.343* Claude Code strips the suffix before sending the model ID to your provider.

344* Only append `[1m]` when the underlying model [supports 1M context](https://platform.claude.com/docs/en/build-with-claude/context-windows#1m-token-context-window).344* Only append `[1m]` when the underlying model [supports 1M context](https://platform.claude.com/docs/en/build-with-claude/context-windows#1m-token-context-window).

Details

1145 1145 

1146## Monitor Claude Code on Amazon Bedrock1146## Monitor Claude Code on Amazon Bedrock

1147 1147 

1148For detailed Claude Code usage monitoring guidance for Amazon Bedrock, see [Claude Code Monitoring Implementation (Bedrock)](../../../raw.githubusercontent.com/aws-solutions-library-samples/guidance-for-claude-code-with-amazon-bedrock/main/assets/docs/MONITORING.md).1148For detailed Claude Code usage monitoring guidance for Amazon Bedrock, see [Claude Code Monitoring Implementation (Bedrock)](../../../raw.githubusercontent.com/aws-solutions-library-samples/guidance-for-claude-code-with-amazon-bedrock/refs/heads/main/assets/docs/MONITORING.md).

en/overview.md +1 −1

Details

158 </Accordion>158 </Accordion>

159 159 

160 <Accordion title="Connect your tools with MCP" icon="plug">160 <Accordion title="Connect your tools with MCP" icon="plug">

161 The [Model Context Protocol (MCP)](/en/mcp) is an open standard for connecting AI tools to external data sources. With MCP, Claude Code can read your design docs in Google Drive, update tickets in Jira, pull data from Slack, or use your own custom tooling.161 The [Model Context Protocol (MCP)](/en/mcp) is an open standard for connecting AI tools to external data sources. With MCP, Claude Code can read your design docs in Google Drive, update tickets in Jira, pull data from Slack, or use your own custom tooling. The [MCP quickstart](/en/mcp-quickstart) connects your first server end to end.

162 </Accordion>162 </Accordion>

163 163 

164 <Accordion title="Customize with instructions, skills, and hooks" icon="sliders">164 <Accordion title="Customize with instructions, skills, and hooks" icon="sliders">

Details

226 <Accordion title="How the classifier evaluates actions">226 <Accordion title="How the classifier evaluates actions">

227 Each action goes through a fixed decision order. The first matching step wins:227 Each action goes through a fixed decision order. The first matching step wins:

228 228 

229 1. Actions matching your [allow or deny rules](/en/permissions#manage-permissions) resolve immediately229 1. Actions matching your [allow or deny rules](/en/permissions#manage-permissions) resolve immediately, except writes to [protected paths](#protected-paths), which route to the classifier even when an allow rule matches

230 2. Read-only actions and file edits in your working directory are auto-approved, except writes to [protected paths](#protected-paths)230 2. Read-only actions and file edits in your working directory are auto-approved, except writes to [protected paths](#protected-paths)

231 3. Everything else goes to the classifier231 3. Everything else goes to the classifier

232 4. If the classifier blocks, Claude receives the reason and tries an alternative232 4. If the classifier blocks, Claude receives the reason and tries an alternative

en/plugins.md +3 −3

Details

15Claude Code supports two ways to add custom skills, agents, and hooks:15Claude Code supports two ways to add custom skills, agents, and hooks:

16 16 

17| Approach | Skill names | Best for |17| Approach | Skill names | Best for |

18| :---------------------------------------------------------- | :------------------- | :---------------------------------------------------------------------------------------------- |18| :-------------------------------------------------------------------------------------------------------------- | :------------------- | :---------------------------------------------------------------------------------------------- |

19| **Standalone** (`.claude/` directory) | `/hello` | Personal workflows, project-specific customizations, quick experiments |19| **Standalone** (`.claude/` directory) | `/hello` | Personal workflows, project-specific customizations, quick experiments |

20| **Plugins** (directories with `.claude-plugin/plugin.json`) | `/plugin-name:hello` | Sharing with teammates, distributing to community, versioned releases, reusable across projects |20| **Plugins** (self-contained directories with skills, agents, hooks, or a `.claude-plugin/plugin.json` manifest) | `/plugin-name:hello` | Sharing with teammates, distributing to community, versioned releases, reusable across projects |

21 21 

22**Use standalone configuration when**:22**Use standalone configuration when**:

23 23 


54 54 

55<Steps>55<Steps>

56 <Step title="Create the plugin directory">56 <Step title="Create the plugin directory">

57 Every plugin lives in its own directory containing a manifest and your skills, agents, or hooks. Create one now:57 Every plugin lives in its own directory containing your skills, agents, or hooks, optionally alongside a `.claude-plugin/plugin.json` manifest. Create one now:

58 58 

59 ```bash theme={null}59 ```bash theme={null}

60 mkdir my-first-plugin60 mkdir my-first-plugin

Details

244**Optional fields:**244**Optional fields:**

245 245 

246| Field | Description |246| Field | Description |

247| :---------------------- | :-------------------------------------------------------- |247| :---------------------- | :----------------------------------------------------- |

248| `args` | Command-line arguments for the LSP server |248| `args` | Command-line arguments for the LSP server |

249| `transport` | Communication transport: `stdio` (default) or `socket` |249| `transport` | Communication transport: `stdio` (default) or `socket` |

250| `env` | Environment variables to set when starting the server |250| `env` | Environment variables to set when starting the server |


252| `settings` | Settings passed via `workspace/didChangeConfiguration` |252| `settings` | Settings passed via `workspace/didChangeConfiguration` |

253| `workspaceFolder` | Workspace folder path for the server |253| `workspaceFolder` | Workspace folder path for the server |

254| `startupTimeout` | Max time to wait for server startup (milliseconds) |254| `startupTimeout` | Max time to wait for server startup (milliseconds) |

255| `shutdownTimeout` | Max time to wait for graceful shutdown (milliseconds) |

256| `restartOnCrash` | Whether to automatically restart the server if it crashes |

257| `maxRestarts` | Maximum number of restart attempts before giving up |255| `maxRestarts` | Maximum number of restart attempts before giving up |

258 256 

259<Warning>257<Warning>

Details

23To get the most out of prefix matching, Claude Code orders each request so content that rarely changes between turns comes first:23To get the most out of prefix matching, Claude Code orders each request so content that rarely changes between turns comes first:

24 24 

25| Layer | Content | Changes when |25| Layer | Content | Changes when |

26| --------------- | ------------------------------------------------- | ----------------------------------------------------------------- |26| --------------- | ------------------------------------------------- | ---------------------------------------------------------------------- |

27| System prompt | Core instructions, tool definitions, output style | An MCP server connects or disconnects, or Claude Code is upgraded |27| System prompt | Core instructions, tool definitions, output style | The set of loaded tool definitions changes, or Claude Code is upgraded |

28| Project context | CLAUDE.md, auto memory, unscoped rules | Session starts, or after `/clear` or `/compact` |28| Project context | CLAUDE.md, auto memory, unscoped rules | Session starts, or after `/clear` or `/compact` |

29| Conversation | Your messages, Claude's responses, tool results | Every turn |29| Conversation | Your messages, Claude's responses, tool results | Every turn |

30 30 


38* **Effort level**: each effort level has its own cache for the same model. Changing it mid-session recomputes the entire request, and Claude Code asks you to confirm before applying the change. See [Changing effort level](#changing-effort-level) below.38* **Effort level**: each effort level has its own cache for the same model. Changing it mid-session recomputes the entire request, and Claude Code asks you to confirm before applying the change. See [Changing effort level](#changing-effort-level) below.

39 39 

40<Tip>40<Tip>

41 Pick your model, effort level, and MCP servers at the top of a session, then save `/compact` for natural breaks between tasks. The fewer changes you make mid-task, the higher your cache hit rate.41 Pick your model and effort level at the top of a session, then save `/compact` for natural breaks between tasks. The fewer changes you make mid-task, the higher your cache hit rate.

42</Tip>42</Tip>

43 43 

44### Where the cache lives44### Where the cache lives


54 54 

55## Actions that invalidate the cache55## Actions that invalidate the cache

56 56 

57These actions cause the next request to miss part or all of the cache. You see a one-time slower, more expensive turn, after which the new prefix is cached. Most of them are avoidable mid-task once you know they have a cost. A model switch or an MCP reconnect can feel free until you notice the slower turn that follows.57These actions cause the next request to miss part or all of the cache. You see a one-time slower, more expensive turn, after which the new prefix is cached. Most of them are avoidable mid-task once you know they have a cost. A model switch can feel free until you notice the slower turn that follows.

58 58 

59* [Switching models](#switching-models)59* [Switching models](#switching-models)

60* [Changing effort level](#changing-effort-level)60* [Changing effort level](#changing-effort-level)

61* [Connecting or disconnecting an MCP server](#connecting-or-disconnecting-an-mcp-server)61* [Connecting or disconnecting an MCP server](#connecting-or-disconnecting-an-mcp-server)

62* [Enabling or disabling a plugin](#enabling-or-disabling-a-plugin)

62* [Denying an entire tool](#denying-an-entire-tool)63* [Denying an entire tool](#denying-an-entire-tool)

63* [Compacting the conversation](#compacting-the-conversation)64* [Compacting the conversation](#compacting-the-conversation)

64* [Upgrading Claude Code](#upgrading-claude-code)65* [Upgrading Claude Code](#upgrading-claude-code)


75 76 

76### Connecting or disconnecting an MCP server77### Connecting or disconnecting an MCP server

77 78 

78Tool definitions sit in the system prompt layer, so the cache invalidates when the set of MCP tools available to Claude changes between turns. The most common cause is an [MCP server](/en/mcp) connecting or disconnecting mid-session, which can happen without any action on your part: a stdio server's process exits, an HTTP session expires, or a server [reconnects automatically after a transient failure](/en/mcp#automatic-reconnection). A connected server can also push a [dynamic tool update](/en/mcp#dynamic-tool-updates) that changes its tool list.79Tool definitions sit in the system prompt layer, so the cache invalidates when the set of tool definitions in the request changes between turns. Whether an [MCP server](/en/mcp) change does this depends on whether its tools are deferred by [tool search](/en/mcp#scale-with-mcp-tool-search) or loaded into the prefix:

80 

81* **Deferred tools**, the default on supported models: a server connecting, disconnecting, or changing its tool list only appends new content and doesn't disturb anything already cached.

82* **Tools loaded into the prefix**: any change to them invalidates the cache. This happens when [tool search is unavailable or disabled](/en/mcp#configure-tool-search), such as on Haiku models, on Vertex AI, or with a custom `ANTHROPIC_BASE_URL` gateway. It also happens for a server or tool marked [`alwaysLoad`](/en/mcp#exempt-a-server-from-deferral), and for definitions kept upfront by [threshold-based loading](/en/mcp#configure-tool-search).

83 

84When tools load into the prefix, the most common cause of an invalidation is a server connecting or disconnecting mid-session, which can happen without any action on your part: a stdio server's process exits, an HTTP session expires, or a server [reconnects automatically after a transient failure](/en/mcp#automatic-reconnection). A connected server can also push a [dynamic tool update](/en/mcp#dynamic-tool-updates) that changes its tool list.

79 85 

80Editing your MCP config does not by itself change the cache. The new config takes effect only after a restart, which is when the server connects or disconnects.86Editing your MCP config does not by itself change the cache. The new config takes effect only after a restart, which is when the server connects or disconnects.

81 87 

82[MCP tool search](/en/mcp#scale-with-mcp-tool-search) reduces how much each tool contributes to the prefix by deferring full tool definitions, but the set of tool names still has to stay stable for the cache to remain valid.88### Enabling or disabling a plugin

89 

90[Plugins](/en/plugins) bundle several component types, and the cost of a change depends on which components the plugin provides. Skills, commands, agents, hooks, LSP servers, monitors, and themes never invalidate the cache: anything they add to the request is appended after the existing conversation, so the next request pays for the new content but still reads everything before it from the cache.

91 

92The exception is a plugin that provides [MCP servers](/en/plugins-reference#mcp-servers). Enabling or disabling one follows the same rules as [connecting or disconnecting an MCP server](#connecting-or-disconnecting-an-mcp-server): the cache survives when the server's tools are deferred, and the next request re-reads the entire conversation when they load into the prefix.

93 

94Plugin changes apply when you run [`/reload-plugins`](/en/discover-plugins#apply-plugin-changes-without-restarting) or start a new session. The cost, whether appended announcements or a full re-read, shows up on the first turn after the reload, not when you run `/plugin install`, `/plugin enable`, or `/plugin disable`.

95 

96Disabling a plugin you enabled earlier in the session restores the previous request shape. If that prefix is still within its [cache lifetime](#cache-lifetime), the next request reads the older cache entry instead of rebuilding.

83 97 

84### Denying an entire tool98### Denying an entire tool

85 99 

86Adding a bare tool name like `Bash` or `WebFetch` as a [deny rule](/en/permissions#manage-permissions) removes that tool from Claude's context entirely. Tool definitions sit in the system prompt layer, so adding or removing one of these rules mid-session invalidates the cache the same way an MCP server connecting or disconnecting does. The change takes effect on the next turn whether you add it through `/permissions` or by [editing a settings file directly](/en/settings#when-edits-take-effect).100Adding a bare tool name like `Bash` or `WebFetch` as a [deny rule](/en/permissions#manage-permissions) removes that tool from Claude's context entirely. Built-in tool definitions load into the system prompt layer, so adding or removing one of these rules mid-session invalidates the cache. The change takes effect on the next turn whether you add it through `/permissions` or by [editing a settings file directly](/en/settings#when-edits-take-effect).

87 101 

88Only a bare tool name, or the equivalent `Bash(*)` form, has this effect. Scoped deny rules like `Bash(rm *)`, and all allow and ask rules, don't change which tools Claude sees. Claude Code checks them when Claude attempts a call, leaving the prefix intact.102Only a bare tool name, or the equivalent `Bash(*)` form, has this effect. Scoped deny rules like `Bash(rm *)`, and all allow and ask rules, don't change which tools Claude sees. Claude Code checks them when Claude attempts a call, leaving the prefix intact.

89 103 

Details

44| Prompt only | `/loop check the deploy` | Your prompt runs at an [interval Claude chooses](#let-claude-choose-the-interval) each iteration |44| Prompt only | `/loop check the deploy` | Your prompt runs at an [interval Claude chooses](#let-claude-choose-the-interval) each iteration |

45| Interval only, or nothing | `/loop` | The [built-in maintenance prompt](#run-the-built-in-maintenance-prompt) runs, or your `loop.md` if one exists |45| Interval only, or nothing | `/loop` | The [built-in maintenance prompt](#run-the-built-in-maintenance-prompt) runs, or your `loop.md` if one exists |

46 46 

47You can also pass another command as the prompt, for example `/loop 20m /review-pr 1234`, to re-run a packaged workflow each iteration.47You can also pass another command as the prompt, for example `/loop 20m /review-pr 1234`, to re-run a saved skill or command each iteration.

48 48 

49### Run on a fixed interval49### Run on a fixed interval

50 50 

Details

235To go deeper on the pieces this page touches:235To go deeper on the pieces this page touches:

236 236 

237* [Code Review](/en/code-review): set up the PR-time multi-agent review237* [Code Review](/en/code-review): set up the PR-time multi-agent review

238* [Automate workflows with hooks](/en/hooks-guide): build your own checks at the same lifecycle points238* [Automate actions with hooks](/en/hooks-guide): build your own checks at the same lifecycle points

239* [Discover and install plugins](/en/discover-plugins#official-anthropic-marketplace): browse other official plugins239* [Discover and install plugins](/en/discover-plugins#official-anthropic-marketplace): browse other official plugins

en/settings.md +1 −1

Details

553 553 

554### Verify active settings554### Verify active settings

555 555 

556Run `/status` inside Claude Code to see which settings sources are active. The Status tab includes a `Setting sources` line that lists each layer Claude Code loaded for the current session, such as `User settings` or `Project local settings`. When [managed settings](/en/managed-settings) are in effect, the entry shows the delivery channel in parentheses, for example `Enterprise managed settings (remote)`, `(plist)`, `(HKLM)`, `(HKCU)`, or `(file)`. A layer appears in the list only when that source is loaded with at least one key, so an empty list means no settings sources were found.556Run `/status` inside Claude Code to see which settings sources are active. The Status tab includes a `Setting sources` line that lists each layer Claude Code loaded for the current session, such as `User settings` or `Project local settings`. When [managed settings](/en/admin-setup#decide-how-settings-reach-devices) are in effect, the entry shows the delivery channel in parentheses, for example `Enterprise managed settings (remote)`, `(plist)`, `(HKLM)`, `(HKCU)`, or `(file)`. A layer appears in the list only when that source is loaded with at least one key, so an empty list means no settings sources were found.

557 557 

558The `Setting sources` line confirms which sources are being read. It does not show which layer supplied each individual key. The Config tab in the same dialog is an editor for a fixed set of toggles such as theme and verbose output, not a view of your `settings.json` contents. If a settings file contains errors, such as invalid JSON or a value that fails validation, `/status` reports the issue so you can fix it.558The `Setting sources` line confirms which sources are being read. It does not show which layer supplied each individual key. The Config tab in the same dialog is an editor for a fixed set of toggles such as theme and verbose output, not a view of your `settings.json` contents. If a settings file contains errors, such as invalid JSON or a value that fails validation, `/status` reports the issue so you can fix it.

559 559 

Details

14| Login loops, OAuth errors, `403 Forbidden`, "organization disabled", Bedrock/Vertex/Foundry credentials | [Troubleshoot installation and login](/en/troubleshoot-install#login-and-authentication) |14| Login loops, OAuth errors, `403 Forbidden`, "organization disabled", Bedrock/Vertex/Foundry credentials | [Troubleshoot installation and login](/en/troubleshoot-install#login-and-authentication) |

15| Settings not applying, hooks not firing, MCP servers not loading | [Debug your configuration](/en/debug-your-config) |15| Settings not applying, hooks not firing, MCP servers not loading | [Debug your configuration](/en/debug-your-config) |

16| `API Error: 5xx`, `529 Overloaded`, `429`, request validation errors | [Error reference](/en/errors) |16| `API Error: 5xx`, `529 Overloaded`, `429`, request validation errors | [Error reference](/en/errors) |

17| `model not found` or `you may not have access to it` | [Error reference](/en/errors#theres-an-issue-with-the-selected-model) |17| `model not found` or `you may not have access to it` | [Error reference](/en/errors#there%E2%80%99s-an-issue-with-the-selected-model) |

18| VS Code extension not connecting or detecting Claude | [VS Code integration](/en/vs-code#fix-common-issues) |18| VS Code extension not connecting or detecting Claude | [VS Code integration](/en/vs-code#fix-common-issues) |

19| JetBrains plugin or IDE not detected | [JetBrains integration](/en/jetbrains#troubleshooting) |19| JetBrains plugin or IDE not detected | [JetBrains integration](/en/jetbrains#troubleshooting) |

20| High CPU or memory, slow responses, hangs, search not finding files | [Performance and stability](#performance-and-stability) below |20| High CPU or memory, slow responses, hangs, search not finding files | [Performance and stability](#performance-and-stability) below |

Details

12 Voice dictation requires Claude Code v2.1.69 or later. Tap mode requires v2.1.116 or later. Check your version with `claude --version`.12 Voice dictation requires Claude Code v2.1.69 or later. Tap mode requires v2.1.116 or later. Check your version with `claude --version`.

13</Note>13</Note>

14 14 

15Dictation also works in [agent view](/en/agent-view#peek-and-reply). Hold or tap your push-to-talk key while the dispatch input or a peek-panel reply is focused to dictate to a background session.

16 

15## Requirements17## Requirements

16 18 

17Voice dictation streams your recorded audio to Anthropic's servers for transcription. Audio is not processed locally. The speech-to-text service is only available when you authenticate with a Claude.ai account, and is not available when Claude Code is configured to use an Anthropic API key directly, Amazon Bedrock, Google Vertex AI, or Microsoft Foundry. Voice dictation is also not available when your organization has HIPAA compliance enabled. Transcription does not consume Claude messages or tokens and does not count toward the limits shown in `/usage`. See [data usage](/en/data-usage) for how Anthropic handles your data.19Voice dictation streams your recorded audio to Anthropic's servers for transcription. Audio is not processed locally. The speech-to-text service is only available when you authenticate with a Claude.ai account, and is not available when Claude Code is configured to use an Anthropic API key directly, Amazon Bedrock, Google Vertex AI, or Microsoft Foundry. Voice dictation is also not available when your organization has HIPAA compliance enabled. Transcription does not consume Claude messages or tokens and does not count toward the limits shown in `/usage`. See [data usage](/en/data-usage) for how Anthropic handles your data.

en/workflows.md +29 −13

Details

25 25 

26## When to use a workflow26## When to use a workflow

27 27 

28[Subagents](/en/sub-agents), [skills](/en/skills), and workflows can all run a multi-step task. The difference is who holds the plan:28[Subagents](/en/sub-agents), [skills](/en/skills), [agent teams](/en/agent-teams), and workflows can all run a multi-step task. The difference is who holds the plan:

29 29 

30| | Subagents | Skills | Workflows |30| | Subagents | Skills | Agent teams | Workflows |

31| :------------------------------ | :----------------------------- | :--------------------------- | :----------------------------------- |31| :------------------------------ | :----------------------------- | :--------------------------- | :------------------------------------- | :----------------------------------- |

32| What it is | A worker Claude spawns | Instructions Claude follows | A script the runtime executes |32| What it is | A worker Claude spawns | Instructions Claude follows | A lead agent supervising peer sessions | A script the runtime executes |

33| Who decides what runs next | Claude, turn by turn | Claude, following the prompt | The script |33| Who decides what runs next | Claude, turn by turn | Claude, following the prompt | The lead agent, turn by turn | The script |

34| Where intermediate results live | Claude's context window | Claude's context window | Script variables |34| Where intermediate results live | Claude's context window | Claude's context window | A shared task list | Script variables |

35| What's repeatable | The worker definition | The instructions | The orchestration itself |35| What's repeatable | The worker definition | The instructions | The team definition | The orchestration itself |

36| Scale | A few delegated tasks per turn | Same as subagents | Dozens to hundreds of agents per run |36| Scale | A few delegated tasks per turn | Same as subagents | A handful of long-running peers | Dozens to hundreds of agents per run |

37| Interruption | Restarts the turn | Restarts the turn | Resumable in the same session |37| Interruption | Restarts the turn | Restarts the turn | Teammates keep running | Resumable in the same session |

38 38 

39A workflow moves the plan into code. With subagents and skills, Claude is the orchestrator: it decides turn by turn what to spawn next, and every result lands in Claude's context. A workflow script holds the loop, the branching, and the intermediate results itself, so Claude's context holds only the final answer.39A workflow moves the plan into code. With subagents, skills, and agent teams, Claude is the orchestrator: it decides turn by turn what to spawn or assign next, and every result lands in a context window. A workflow script holds the loop, the branching, and the intermediate results itself, so Claude's context holds only the final answer.

40 40 

41Moving the plan into code also lets a workflow apply a repeatable quality pattern, not just run more agents: it can have independent agents adversarially review each other's findings before they're reported, or draft a plan from several angles and weigh them against each other, so you get a more trustworthy result than a single pass.41Moving the plan into code also lets a workflow apply a repeatable quality pattern, not just run more agents: it can have independent agents adversarially review each other's findings before they're reported, or draft a plan from several angles and weigh them against each other, so you get a more trustworthy result than a single pass.

42 42 


124Run a workflow to audit every API endpoint under src/routes/ for missing auth checks124Run a workflow to audit every API endpoint under src/routes/ for missing auth checks

125```125```

126 126 

127Claude Code highlights the word in your input and Claude writes a workflow script for the task instead of working through it turn by turn.127Claude Code highlights the word in your input and Claude writes a workflow script for the task instead of working through it turn by turn. If you didn't mean to start a workflow, press `Option+W` on macOS or `Alt+W` on Windows and Linux to dismiss the highlight for this prompt, or press backspace while the cursor is right after the highlighted word. To stop the word from triggering at all, turn off Workflow keyword trigger in `/config`.

128 128 

129If the run does what you wanted, you can [save it as a command](#save-the-workflow-for-reuse) afterward.129If the run does what you wanted, you can [save it as a command](#save-the-workflow-for-reuse) afterward.

130 130 

131If Claude Code highlights the word when you didn't mean to trigger one, press `alt+w` to ignore it for this prompt, or press backspace while the cursor is right after the highlighted word. To stop the word from triggering at all, turn off Workflow keyword trigger in `/config`.131If you already have an orchestrator built another way, such as a folder of subagent prompts or a skill that fans work out, you can point Claude at it and ask for a workflow that does the same thing.

132 132 

133### Let Claude decide with ultracode133### Let Claude decide with ultracode

134 134 


182 182 

183If a project workflow and a personal workflow share a name, the project one runs.183If a project workflow and a personal workflow share a name, the project one runs.

184 184 

185### Pass input to a saved workflow

186 

187A saved workflow can accept input through the `args` parameter. The script reads it as a global named `args`. Use this to supply a research question, a list of target paths, or a configuration object at invocation time instead of editing the script for each run.

188 

189The following prompt runs a saved workflow with a list of issue numbers:

190 

191```text theme={null}

192> Run /triage-issues on issues 1024, 1025, and 1030

193```

194 

195Claude passes the list as structured data, so the script can call array and object methods on `args` directly without parsing it first. If `args` is omitted, the global is `undefined` inside the script.

196 

185## How a workflow runs197## How a workflow runs

186 198 

187The workflow runtime executes the script in an isolated environment, separate from your conversation. Intermediate results stay in script variables instead of landing in Claude's context.199The workflow runtime executes the script in an isolated environment, separate from your conversation. Intermediate results stay in script variables instead of landing in Claude's context.

188 200 

201Every run writes its script to a file under your session's directory in `~/.claude/projects/`. Claude receives the path when the run starts, so you can ask for it. You can open that file to read the orchestration Claude wrote, diff it against a previous run's script, or edit it and ask Claude to relaunch from the edited version.

202 

189The runtime tracks each agent's result as the run progresses, which is what makes a run [resumable](#resume-after-a-pause) within the same session.203The runtime tracks each agent's result as the run progresses, which is what makes a run [resumable](#resume-after-a-pause) within the same session.

190 204 

191### Behavior and limits205### Behavior and limits


211 225 

212### Cost226### Cost

213 227 

214A workflow spawns many agents, so a single run can use meaningfully more tokens than working through the same task in conversation. Runs count toward your plan's usage and rate limits like any other session. You can stop a running workflow from `/workflows` at any time without losing completed work.228A workflow spawns many agents, so a single run can use meaningfully more tokens than working through the same task in conversation. Runs count toward your plan's usage and rate limits like any other session.

229 

230To gauge the spend before committing to a large task, run the workflow on a small slice first: one directory instead of the whole repo, or a narrow question instead of a broad one. The `/workflows` view shows each agent's token usage as the run progresses, and you can stop the run there at any time without losing completed work. The runtime's [agent caps](#behavior-and-limits) limit how many agents a single run can spawn, which bounds the cost of a runaway script.

215 231 

216Every agent in a workflow uses your session's model unless the script routes a stage to a different one. To control the model cost:232Every agent in a workflow uses your session's model unless the script routes a stage to a different one. To control the model cost:

217 233