SpyBara
Go Premium

Documentation 2026-05-13 23:01 UTC to 2026-05-14 17:02 UTC

23 files changed +269 −63. View all changes and history on the product overview
2026
Sun 31 06:39 Sat 30 06:23 Fri 29 06:38 Thu 28 06:37 Wed 27 06:42 Tue 26 06:33 Sun 24 06:25 Sat 23 06:18 Fri 22 06:33 Thu 21 06:36 Wed 20 06:35 Tue 19 06:34 Mon 18 23:59 Sun 17 01:01 Fri 15 22:58 Thu 14 17:02 Wed 13 23:01 Tue 12 22:57 Mon 11 23:00 Sun 10 23:03 Sat 9 04:57 Fri 8 22:00 Thu 7 22:59 Tue 5 23:00 Mon 4 22:58 Sat 2 18:14 Fri 1 18:19
Details

235 235 

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

237 237 

238* **Top-level fields** control the conversation: `systemMessage` injects a message into the conversation visible to the model, and `continue` (`continue_` in Python) determines whether the agent keeps running after this hook.238* **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* **`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.239* **`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 240 

241Return `{}` 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.241Return `{}` 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.


331 331 

332### Add context and block a tool332### Add context and block a tool

333 333 

334This example blocks any attempt to write to the `/etc` directory and uses two output fields together: `permissionDecision: 'deny'` stops the tool call, while `systemMessage` injects a reminder into the conversation so the agent receives context about why the operation was blocked and avoids retrying it:334This example blocks writes to the `/etc` directory and explains why to both the model and the user:

335 

336* `permissionDecision: 'deny'` stops the tool call.

337* `permissionDecisionReason` tells the model why, so it avoids retrying.

338* `systemMessage` shows the user what happened.

335 339 

336<CodeGroup>340<CodeGroup>

337 ```python Python theme={null}341 ```python Python theme={null}


340 344 

341 if file_path.startswith("/etc"):345 if file_path.startswith("/etc"):

342 return {346 return {

343 # Top-level field: inject guidance into the conversation347 # Top-level field: message shown to the user

344 "systemMessage": "Remember: system directories like /etc are protected.",348 "systemMessage": "Remember: system directories like /etc are protected.",

345 # hookSpecificOutput: block the operation349 # hookSpecificOutput: block the operation

346 "hookSpecificOutput": {350 "hookSpecificOutput": {


360 364 

361 if (filePath?.startsWith("/etc")) {365 if (filePath?.startsWith("/etc")) {

362 return {366 return {

363 // Top-level field: inject guidance into the conversation367 // Top-level field: message shown to the user

364 systemMessage: "Remember: system directories like /etc are protected.",368 systemMessage: "Remember: system directories like /etc are protected.",

365 // hookSpecificOutput: block the operation369 // hookSpecificOutput: block the operation

366 hookSpecificOutput: {370 hookSpecificOutput: {


807 811 

808### systemMessage not appearing in output812### systemMessage not appearing in output

809 813 

810The `systemMessage` field adds context to the conversation that the model sees, but it may not appear in all SDK output modes. If you need to surface hook decisions to your application, log them separately or use a dedicated output channel.814The `systemMessage` field shows a message to the user, not the model. By default the SDK does not surface hook output in the message stream, so the message may not appear unless you set `includeHookEvents` (`include_hook_events` in Python). To pass context to the model instead, return [`additionalContext`](/en/hooks#add-context-for-claude).

815 

816If you need to surface hook decisions to your application reliably, log them separately or use a dedicated output channel.

811 817 

812## Related resources818## Related resources

813 819 

Details

1860Returns a [`HookJSONOutput`](#hookjsonoutput) that may contain:1860Returns a [`HookJSONOutput`](#hookjsonoutput) that may contain:

1861 1861 

1862* `decision`: `"block"` to block the action1862* `decision`: `"block"` to block the action

1863* `systemMessage`: System message to add to the transcript1863* `systemMessage`: warning message shown to the user

1864* `hookSpecificOutput`: Hook-specific output data1864* `hookSpecificOutput`: Hook-specific output data

1865 1865 

1866### `HookContext`1866### `HookContext`

Details

389| `fallbackModel` | `string` | `undefined` | Model to use if primary fails |389| `fallbackModel` | `string` | `undefined` | Model to use if primary fails |

390| `forkSession` | `boolean` | `false` | When resuming with `resume`, fork to a new session ID instead of continuing the original session |390| `forkSession` | `boolean` | `false` | When resuming with `resume`, fork to a new session ID instead of continuing the original session |

391| `hooks` | `Partial<Record<`[`HookEvent`](#hookevent)`, `[`HookCallbackMatcher`](#hookcallbackmatcher)`[]>>` | `{}` | Hook callbacks for events |391| `hooks` | `Partial<Record<`[`HookEvent`](#hookevent)`, `[`HookCallbackMatcher`](#hookcallbackmatcher)`[]>>` | `{}` | Hook callbacks for events |

392| `includeHookEvents` | `boolean` | `false` | Include hook lifecycle events in the message stream as [`SDKHookStartedMessage`](#sdkhookstartedmessage), [`SDKHookProgressMessage`](#sdkhookprogressmessage), and [`SDKHookResponseMessage`](#sdkhookresponsemessage) |

392| `includePartialMessages` | `boolean` | `false` | Include partial message events |393| `includePartialMessages` | `boolean` | `false` | Include partial message events |

393| `maxBudgetUsd` | `number` | `undefined` | Stop the query when the client-side cost estimate reaches this USD value. Compared against the same estimate as `total_cost_usd`; see [Track cost and usage](/en/agent-sdk/cost-tracking) for accuracy caveats |394| `maxBudgetUsd` | `number` | `undefined` | Stop the query when the client-side cost estimate reaches this USD value. Compared against the same estimate as `total_cost_usd`; see [Track cost and usage](/en/agent-sdk/cost-tracking) for accuracy caveats |

394| `maxThinkingTokens` | `number` | `undefined` | *Deprecated:* Use `thinking` instead. Maximum tokens for thinking process |395| `maxThinkingTokens` | `number` | `undefined` | *Deprecated:* Use `thinking` instead. Maximum tokens for thinking process |


1596 | ReadMcpResourceInput1597 | ReadMcpResourceInput

1597 | SubscribeMcpResourceInput1598 | SubscribeMcpResourceInput

1598 | SubscribePollingInput1599 | SubscribePollingInput

1600 | TaskCreateInput

1601 | TaskGetInput

1602 | TaskListInput

1599 | TaskStopInput1603 | TaskStopInput

1604 | TaskUpdateInput

1600 | TodoWriteInput1605 | TodoWriteInput

1601 | UnsubscribeMcpResourceInput1606 | UnsubscribeMcpResourceInput

1602 | UnsubscribePollingInput1607 | UnsubscribePollingInput


1850**Tool name:** `TaskCreate`1855**Tool name:** `TaskCreate`

1851 1856 

1852```typescript theme={null}1857```typescript theme={null}

1853// Not yet exported from the SDK; define locally.

1854type TaskCreateInput = {1858type TaskCreateInput = {

1855 subject: string;1859 subject: string;

1856 description: string;1860 description: string;


1866**Tool name:** `TaskUpdate`1870**Tool name:** `TaskUpdate`

1867 1871 

1868```typescript theme={null}1872```typescript theme={null}

1869// Not yet exported from the SDK; define locally.

1870type TaskUpdateInput = {1873type TaskUpdateInput = {

1871 taskId: string;1874 taskId: string;

1872 status?: "pending" | "in_progress" | "completed" | "deleted";1875 status?: "pending" | "in_progress" | "completed" | "deleted";


1887**Tool name:** `TaskGet`1890**Tool name:** `TaskGet`

1888 1891 

1889```typescript theme={null}1892```typescript theme={null}

1890// Not yet exported from the SDK; define locally.

1891type TaskGetInput = {1893type TaskGetInput = {

1892 taskId: string;1894 taskId: string;

1893};1895};


1900**Tool name:** `TaskList`1902**Tool name:** `TaskList`

1901 1903 

1902```typescript theme={null}1904```typescript theme={null}

1903// Not yet exported from the SDK; define locally.

1904type TaskListInput = {};1905type TaskListInput = {};

1905```1906```

1906 1907 


1983 | MonitorOutput1984 | MonitorOutput

1984 | NotebookEditOutput1985 | NotebookEditOutput

1985 | ReadMcpResourceOutput1986 | ReadMcpResourceOutput

1987 | TaskCreateOutput

1988 | TaskGetOutput

1989 | TaskListOutput

1986 | TaskStopOutput1990 | TaskStopOutput

1991 | TaskUpdateOutput

1987 | TodoWriteOutput1992 | TodoWriteOutput

1988 | WebFetchOutput1993 | WebFetchOutput

1989 | WebSearchOutput;1994 | WebSearchOutput;


2347**Tool name:** `TaskCreate`2352**Tool name:** `TaskCreate`

2348 2353 

2349```typescript theme={null}2354```typescript theme={null}

2350// Not yet exported from the SDK; define locally.

2351type TaskCreateOutput = {2355type TaskCreateOutput = {

2352 task: {2356 task: {

2353 id: string;2357 id: string;


2363**Tool name:** `TaskUpdate`2367**Tool name:** `TaskUpdate`

2364 2368 

2365```typescript theme={null}2369```typescript theme={null}

2366// Not yet exported from the SDK; define locally.

2367type TaskUpdateOutput = {2370type TaskUpdateOutput = {

2368 success: boolean;2371 success: boolean;

2369 taskId: string;2372 taskId: string;


2383**Tool name:** `TaskGet`2386**Tool name:** `TaskGet`

2384 2387 

2385```typescript theme={null}2388```typescript theme={null}

2386// Not yet exported from the SDK; define locally.

2387type TaskGetOutput = {2389type TaskGetOutput = {

2388 task: {2390 task: {

2389 id: string;2391 id: string;


2403**Tool name:** `TaskList`2405**Tool name:** `TaskList`

2404 2406 

2405```typescript theme={null}2407```typescript theme={null}

2406// Not yet exported from the SDK; define locally.

2407type TaskListOutput = {2408type TaskListOutput = {

2408 tasks: Array<{2409 tasks: Array<{

2409 id: string;2410 id: string;

agent-view.md +44 −6

Details

46 </Step>46 </Step>

47 47 

48 <Step title="Dispatch a session">48 <Step title="Dispatch a session">

49 Type a prompt describing a task and press `Enter`. A new background session starts on that task and appears as a row showing whether it's working, waiting on you, or done. The new session uses the model shown in the agent view header and the same [permission mode](#permission-mode-and-settings) you'd get running `claude` in that directory.49 Type a prompt describing a task and press `Enter`. A new background session starts on that task and appears as a row showing whether it's working, waiting on you, or done. The new session uses the model shown in the agent view header and the same [permission mode](#permission-mode-model-and-effort) you'd get running `claude` in that directory.

50 50 

51 Every prompt you enter here starts its own new session. Typing another prompt and pressing `Enter` launches a second session alongside the first rather than sending a follow-up to it. You can run several in parallel this way.51 Every prompt you enter here starts its own new session. Typing another prompt and pressing `Enter` launches a second session alongside the first rather than sending a follow-up to it. You can run several in parallel this way.

52 52 


74 74 

75The list shows every background session you've started, across all your projects. A session working in one repository and another in a different worktree both appear here, regardless of which directory you opened agent view from. Interactive sessions you have open in other terminals don't appear until you [background them](#from-inside-a-session). [Subagents](/en/sub-agents) and [teammates](/en/agent-teams) a session spawns aren't listed as separate rows.75The list shows every background session you've started, across all your projects. A session working in one repository and another in a different worktree both appear here, regardless of which directory you opened agent view from. Interactive sessions you have open in other terminals don't appear until you [background them](#from-inside-a-session). [Subagents](/en/sub-agents) and [teammates](/en/agent-teams) a session spawns aren't listed as separate rows.

76 76 

77To scope the view to one project, launch with `claude agents --cwd <path>`. Only sessions started under that directory appear, including any running in a [worktree](/en/worktrees) dispatched from it.

78 

77```text theme={null}79```text theme={null}

78Pinned80Pinned

79 ✽ clawd walk cycle Write assets/sprites/clawd-walk.png 3m81 ✽ clawd walk cycle Write assets/sprites/clawd-walk.png 3m


285 287 

286### Set the model288### Set the model

287 289 

288The model name shown in the agent view header is the dispatch default. New sessions you start from the input use this model, which is the same setting [`/model`](/en/model-config) controls in any session.290The model name shown in the agent view header is the dispatch default. New sessions you start from the input use this model, which is the same setting [`/model`](/en/model-config) controls in any session. To override it for the whole agent view session, pass `--model` when opening agent view. See [Permission mode, model, and effort](#permission-mode-model-and-effort).

289 291 

290Each background session can run on a different model. To override it for one session:292Each background session can run on a different model. To override it for one session:

291 293 


293* Attach to a running session and run `/model` there. The change persists if the session is respawned.295* Attach to a running session and run `/model` there. The change persists if the session is respawned.

294* Dispatch a [subagent](/en/sub-agents) whose frontmatter sets a `model` field.296* Dispatch a [subagent](/en/sub-agents) whose frontmatter sets a `model` field.

295 297 

296### Permission mode and settings298### Permission mode, model, and effort

299 

300A background session reads its [settings](/en/settings) from the directory it runs in, the same as if you had started `claude` there.

301 

302The [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).

303 

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

305 

306```bash theme={null}

307claude agents --permission-mode plan --model opus --effort high

308```

309 

310<Note>

311 Passing `--permission-mode`, `--model`, or `--effort` to `claude agents` requires Claude Code v2.1.142 or later. Earlier versions reject these flags with an unknown-option error.

312</Note>

297 313 

298A dispatched session reads its [settings](/en/settings) and [permission mode](/en/permissions) from the directory it runs in, the same as if you had started `claude` there. Dispatching from the agent view input doesn't pass a permission mode, so the session uses the `defaultMode` from that directory's settings or the `permissionMode` from the dispatched [subagent's frontmatter](/en/sub-agents#supported-frontmatter-fields).314The active defaults appear in the footer below the dispatch input.

299 315 

300To set the mode from the shell, pass `--permission-mode` with `claude --bg`. Using `bypassPermissions` or `auto` this way is refused until you have accepted that mode by running `claude` with it once interactively, since those modes let a session you aren't watching act without approval.316Without these flags, the session uses the `defaultMode` from that directory's settings or the `permissionMode` from the dispatched [subagent's frontmatter](/en/sub-agents#supported-frontmatter-fields), and the model shown in the agent view header.

317 

318Using `bypassPermissions` or `auto` is refused until you have accepted that mode by running `claude` with it once interactively, since those modes let a session you aren't watching act without approval. The same applies whether you pass the mode to `claude agents` or to `claude --bg --permission-mode`.

319 

320### Settings, plugins, and MCP servers

321 

322Agent view accepts the same configuration flags as `claude` for loading settings, plugins, MCP servers, and additional directories. Each flag applies to agent view itself and is passed through to every session you dispatch from it, so a plugin or MCP server you load this way is available in those sessions too.

323 

324| Flag | Effect |

325| :----------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------- |

326| [`--settings <file-or-json>`](/en/settings) | Override settings for agent view and dispatched sessions |

327| [`--add-dir <path>`](/en/permissions#additional-directories-grant-file-access-not-configuration) | Grant file access to an additional directory |

328| [`--plugin-dir <path>`](/en/plugins) | Load a plugin from a local directory |

329| [`--mcp-config <file-or-json>`](/en/mcp) | Load MCP servers from a config file or JSON string |

330| `--strict-mcp-config` | Use only the MCP servers from `--mcp-config`, ignoring other MCP configuration |

331 

332Repeat `--add-dir`, `--plugin-dir`, or `--mcp-config` once per value. The space-separated form, such as `--add-dir a b c`, is not supported with `claude agents`.

333 

334The following example opens agent view with a settings override and one extra directory:

335 

336```bash theme={null}

337claude agents --settings ./ci-settings.json --add-dir ../shared-lib

338```

301 339 

302## Manage sessions from the shell340## Manage sessions from the shell

303 341 


305 343 

306| Command | Purpose |344| Command | Purpose |

307| :--------------------- | :----------------------------------------------------------------------------------------- |345| :--------------------- | :----------------------------------------------------------------------------------------- |

308| `claude agents` | Open agent view |346| `claude agents` | Open agent view. Pass `--cwd <path>` to list only sessions started under that directory |

309| `claude attach <id>` | Attach to a session in this terminal |347| `claude attach <id>` | Attach to a session in this terminal |

310| `claude logs <id>` | Print the session's recent output |348| `claude logs <id>` | Print the session's recent output |

311| `claude stop <id>` | Stop a session. Also accepts `claude kill` |349| `claude stop <id>` | Stop a session. Also accepts `claude kill` |

Details

170 170 

171Claude Code supports automatic credential refresh for AWS SSO and corporate identity providers. Add these settings to your Claude Code settings file (see [Settings](/en/settings) for file locations).171Claude Code supports automatic credential refresh for AWS SSO and corporate identity providers. Add these settings to your Claude Code settings file (see [Settings](/en/settings) for file locations).

172 172 

173When Claude Code detects that your AWS credentials are expired (either locally based on their timestamp or when Bedrock returns a credential error), it will automatically run your configured `awsAuthRefresh` and/or `awsCredentialExport` commands to obtain new credentials before retrying the request.173These two settings have different trigger conditions:

174 

175* **`awsAuthRefresh`**: runs only when Claude Code detects that your AWS credentials are expired, either locally based on their timestamp or when Bedrock returns a credential error, then retries the request with refreshed credentials.

176* **`awsCredentialExport`**: runs at session start and on each credential reload, even when the credentials in your AWS default credential provider chain are still valid. Use this when your Bedrock account requires cross-account credentials that differ from the ones the default provider chain would resolve.

174 177 

175##### Example configuration178##### Example configuration

176 179 


187 190 

188**`awsAuthRefresh`**: Use this for commands that modify the `.aws` directory, such as updating credentials, SSO cache, or config files. The command's output is displayed to the user, but interactive input isn't supported. This works well for browser-based SSO flows where the CLI displays a URL or code and you complete authentication in the browser.191**`awsAuthRefresh`**: Use this for commands that modify the `.aws` directory, such as updating credentials, SSO cache, or config files. The command's output is displayed to the user, but interactive input isn't supported. This works well for browser-based SSO flows where the CLI displays a URL or code and you complete authentication in the browser.

189 192 

190**`awsCredentialExport`**: Only use this if you can't modify `.aws` and must directly return credentials. Output is captured silently and not shown to the user. The command must output JSON in this format:193**`awsCredentialExport`**: Only use this if you can't modify `.aws` and must directly return credentials. This command runs whenever credentials need to be refreshed, not only when credentials are expired. Output is captured silently and not shown to the user. The command must output JSON in this format:

191 194 

192```json theme={null}195```json theme={null}

193{196{


465* Switch to a supported region: `export AWS_REGION=us-east-1`468* Switch to a supported region: `export AWS_REGION=us-east-1`

466* Consider using inference profiles for cross-region access469* Consider using inference profiles for cross-region access

467 470 

468If you receive an error "on-demand throughput isnt supported":471If you receive an error "on-demand throughput isn't supported":

469 472 

470* Specify the model as an [inference profile](https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-support.html) ID473* Specify the model as an [inference profile](https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-support.html) ID

471 474 

Details

396* Use `/clear` frequently between tasks to reset the context window entirely396* Use `/clear` frequently between tasks to reset the context window entirely

397* When auto compaction triggers, Claude summarizes what matters most, including code patterns, file states, and key decisions397* When auto compaction triggers, Claude summarizes what matters most, including code patterns, file states, and key decisions

398* For more control, run `/compact <instructions>`, like `/compact Focus on the API changes`398* For more control, run `/compact <instructions>`, like `/compact Focus on the API changes`

399* To compact only part of the conversation, use `Esc + Esc` or `/rewind`, select a message checkpoint, and choose **Summarize from here**. This condenses messages from that point forward while keeping earlier context intact.399* To compact only part of the conversation, use `Esc + Esc` or `/rewind`, select a message checkpoint, and choose **Summarize from here** or **Summarize up to here**. The first condenses messages from that point forward while keeping earlier context intact; the second condenses earlier messages while keeping recent ones in full. See [Restore vs. summarize](/en/checkpointing#restore-vs-summarize).

400* Customize compaction behavior in CLAUDE.md with instructions like `"When compacting, always preserve the full list of modified files and any test commands"` to ensure critical context survives summarization400* Customize compaction behavior in CLAUDE.md with instructions like `"When compacting, always preserve the full list of modified files and any test commands"` to ensure critical context survives summarization

401* For quick questions that don't need to stay in context, use [`/btw`](/en/interactive-mode#side-questions-with-%2Fbtw). The answer appears in a dismissible overlay and never enters conversation history, so you can check a detail without growing context.401* For quick questions that don't need to stay in context, use [`/btw`](/en/interactive-mode#side-questions-with-%2Fbtw). The answer appears in a dismissible overlay and never enters conversation history, so you can check a detail without growing context.

402 402 


424### Rewind with checkpoints424### Rewind with checkpoints

425 425 

426<Tip>426<Tip>

427 Every action Claude makes creates a checkpoint. You can restore conversation, code, or both to any previous checkpoint.427 Every prompt you send creates a checkpoint. You can restore conversation, code, or both to any previous checkpoint.

428</Tip>428</Tip>

429 429 

430Claude automatically checkpoints before changes. Double-tap `Escape` or run `/rewind` to open the rewind menu. You can restore conversation only, restore code only, restore both, or summarize from a selected message. See [Checkpointing](/en/checkpointing) for details.430Claude automatically snapshots files before each change so a checkpoint can restore them. Double-tap `Escape` or run `/rewind` to open the rewind menu. You can restore conversation only, restore code only, restore both, or summarize from a selected message. See [Checkpointing](/en/checkpointing) for details.

431 431 

432Instead of carefully planning every move, you can tell Claude to try something risky. If it doesn't work, rewind and try a different approach. Checkpoints persist across sessions, so you can close your terminal and still rewind later.432Instead of carefully planning every move, you can tell Claude to try something risky. If it doesn't work, rewind and try a different approach. Checkpoints persist across sessions, so you can close your terminal and still rewind later.

433 433 

Details

28* **Restore conversation**: rewind to that message while keeping current code28* **Restore conversation**: rewind to that message while keeping current code

29* **Restore code**: revert file changes while keeping the conversation29* **Restore code**: revert file changes while keeping the conversation

30* **Summarize from here**: compress the conversation from this point forward into a summary, freeing context window space30* **Summarize from here**: compress the conversation from this point forward into a summary, freeing context window space

31* **Summarize up to here**: compress the conversation before this point into a summary, keeping later messages intact

31* **Never mind**: return to the message list without making changes32* **Never mind**: return to the message list without making changes

32 33 

33After restoring the conversation or summarizing, the original prompt from the selected message is restored into the input field so you can re-send or edit it.34After restoring the conversation or choosing Summarize from here, the original prompt from the selected message is restored into the input field so you can re-send or edit it.

35 

36Choosing Summarize up to here leaves you at the end of the conversation with the input empty.

34 37 

35#### Restore vs. summarize38#### Restore vs. summarize

36 39 

37The three restore options revert state: they undo code changes, conversation history, or both. "Summarize from here" works differently:40The restore options revert state: they undo code changes, conversation history, or both. The summarize options compress part of the conversation into an AI-generated summary without changing files on disk:

38 41 

39* Messages before the selected message stay intact42* **Summarize from here**: messages before the selected message stay intact. The selected message and everything after it are replaced with a summary. Use this to discard a side discussion while keeping early context in full detail.

40* The selected message and all subsequent messages get replaced with a compact AI-generated summary43* **Summarize up to here**: messages before the selected message are replaced with a summary. The selected message and everything after it stay intact, and you remain at the end of the conversation. Use this to compress early setup discussion while keeping recent work in full detail.

41* No files on disk are changed

42* The original messages are preserved in the session transcript, so Claude can reference the details if needed

43 44 

44This is similar to `/compact`, but targeted: instead of summarizing the entire conversation, you keep early context in full detail and only compress the parts that are using up space. You can type optional instructions to guide what the summary focuses on.45In both cases the original messages are preserved in the session transcript, so Claude can reference the details if needed. You can type optional instructions to guide what the summary focuses on. This is similar to `/compact`, but targeted: instead of summarizing the entire conversation, you choose which side of the selected message to compress.

45 46 

46<Note>47<Note>

47 Summarize keeps you in the same session and compresses context. If you want to branch off and try a different approach while preserving the original session intact, use [fork](/en/sessions#branch-a-session) instead (`claude --continue --fork-session`).48 Summarize keeps you in the same session and compresses context. If you want to branch off and try a different approach while preserving the original session intact, use [fork](/en/sessions#branch-a-session) instead (`claude --continue --fork-session`).

Details

782 782 

783### Remote Control session expired or access denied783### Remote Control session expired or access denied

784 784 

785`--teleport` connects through the same Remote Control session infrastructure that cloud sessions use, so authentication and session-expiry errors surface with Remote Control wording. You may see `Remote Control session has expired` or `Access denied`. The connection token is short-lived and scoped to your account.785`--teleport` connects through the same Remote Control session infrastructure that cloud sessions use, so authentication and session-expiry errors surface with Remote Control wording. You may see `Remote Control session expired` or `Access denied`. The connection token is short-lived and scoped to your account.

786 786 

787* Run `/login` locally to refresh your credentials, then reconnect787* Run `/login` locally to refresh your credentials, then reconnect

788* Confirm you are signed in to the same account that owns the session788* Confirm you are signed in to the same account that owns the session

Details

24| `claude auth login` | Sign in to your Anthropic account. Use `--email` to pre-fill your email address, `--sso` to force SSO authentication, and `--console` to sign in with Anthropic Console for API usage billing instead of a Claude subscription | `claude auth login --console` |24| `claude auth login` | Sign in to your Anthropic account. Use `--email` to pre-fill your email address, `--sso` to force SSO authentication, and `--console` to sign in with Anthropic Console for API usage billing instead of a Claude subscription | `claude auth login --console` |

25| `claude auth logout` | Log out from your Anthropic account | `claude auth logout` |25| `claude auth logout` | Log out from your Anthropic account | `claude auth logout` |

26| `claude auth status` | Show authentication status as JSON. Use `--text` for human-readable output. Exits with code 0 if logged in, 1 if not | `claude auth status` |26| `claude auth status` | Show authentication status as JSON. Use `--text` for human-readable output. Exits with code 0 if logged in, 1 if not | `claude auth status` |

27| `claude agents` | Open [agent view](/en/agent-view) to monitor and dispatch parallel background sessions. When output is piped, lists configured [subagents](/en/sub-agents) instead | `claude agents` |27| `claude agents` | Open [agent view](/en/agent-view) to monitor and dispatch parallel background sessions. Use `--cwd <path>` to show only sessions started under that directory | `claude agents` |

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


67| `--disallowedTools` | Tools that are removed from the model's context and cannot be used | `"Bash(git log *)" "Bash(git diff *)" "Edit"` |67| `--disallowedTools` | Tools that are removed from the model's context and cannot be used | `"Bash(git log *)" "Bash(git diff *)" "Edit"` |

68| `--effort` | Set the [effort level](/en/model-config#adjust-effort-level) for the current session. Options: `low`, `medium`, `high`, `xhigh`, `max`; available levels depend on the model. Overrides the [`effortLevel`](/en/settings#available-settings) setting for this session and does not persist | `claude --effort high` |68| `--effort` | Set the [effort level](/en/model-config#adjust-effort-level) for the current session. Options: `low`, `medium`, `high`, `xhigh`, `max`; available levels depend on the model. Overrides the [`effortLevel`](/en/settings#available-settings) setting for this session and does not persist | `claude --effort high` |

69| `--enable-auto-mode` | {/* max-version: 2.1.110 */}Removed in v2.1.111. Auto mode is now in the `Shift+Tab` cycle by default; use `--permission-mode auto` to start in it | `claude --permission-mode auto` |69| `--enable-auto-mode` | {/* max-version: 2.1.110 */}Removed in v2.1.111. Auto mode is now in the `Shift+Tab` cycle by default; use `--permission-mode auto` to start in it | `claude --permission-mode auto` |

70| `--exclude-dynamic-system-prompt-sections` | Move per-machine sections from the system prompt (working directory, environment info, memory paths, git status) into the first user message. Improves prompt-cache reuse across different users and machines running the same task. Only applies with the default system prompt; ignored when `--system-prompt` or `--system-prompt-file` is set. Use with `-p` for scripted, multi-user workloads | `claude -p --exclude-dynamic-system-prompt-sections "query"` |70| `--exclude-dynamic-system-prompt-sections` | Move per-machine sections from the system prompt (working directory, environment info, memory paths, git-repo flag) into the first user message. Improves prompt-cache reuse across different users and machines running the same task. Only applies with the default system prompt; ignored when `--system-prompt` or `--system-prompt-file` is set. Use with `-p` for scripted, multi-user workloads | `claude -p --exclude-dynamic-system-prompt-sections "query"` |

71| `--fallback-model` | Enable automatic fallback to specified model when default model is overloaded (print mode only) | `claude -p --fallback-model sonnet "query"` |71| `--fallback-model` | Enable automatic fallback to specified model when default model is overloaded (print mode only) | `claude -p --fallback-model sonnet "query"` |

72| `--fork-session` | When resuming, create a new session ID instead of reusing the original (use with `--resume` or `--continue`) | `claude --resume abc123 --fork-session` |72| `--fork-session` | When resuming, create a new session ID instead of reusing the original (use with `--resume` or `--continue`) | `claude --resume abc123 --fork-session` |

73| `--from-pr` | Resume sessions linked to a specific pull request. Accepts a PR number, a GitHub or GitHub Enterprise PR URL, a GitLab merge request URL, or a Bitbucket pull request URL. Sessions are linked automatically when Claude creates the pull request | `claude --from-pr 123` |73| `--from-pr` | Resume sessions linked to a specific pull request. Accepts a PR number, a GitHub or GitHub Enterprise PR URL, a GitLab merge request URL, or a Bitbucket pull request URL. Sessions are linked automatically when Claude creates the pull request | `claude --from-pr 123` |


124 124 

125`--system-prompt` and `--system-prompt-file` are mutually exclusive. The append flags can be combined with either replacement flag.125`--system-prompt` and `--system-prompt-file` are mutually exclusive. The append flags can be combined with either replacement flag.

126 126 

127For most use cases, use an append flag. Appending preserves Claude Code's built-in capabilities while adding your requirements. Use a replacement flag only when you need complete control over the system prompt.127Choose based on whether Claude Code's default identity still fits your task. Use an append flag when Claude should remain a coding assistant that also follows your extra rules: per-invocation instructions, output formatting, or domain context for a `-p` script. Appending preserves the default tool guidance, safety instructions, and coding conventions, so you only supply what differs. Use a replacement flag when the surface, identity, or permission model differs from Claude Code's, like a non-coding agent in a pipeline that no human watches. Replacing drops all of the default prompt, including tool guidance and safety instructions, so you take responsibility for whatever your task still needs.

128 

129These flags apply only to the current invocation. For persistent personas you can switch between and share across a project, use [output styles](/en/output-styles). For project conventions Claude should always follow, use [CLAUDE.md](/en/memory). The [Agent SDK guide on system prompts](/en/agent-sdk/modifying-system-prompts#decide-on-a-starting-point) covers the same decision in more depth.

128 130 

129## See also131## See also

130 132 

commands.md +1 −1

Details

26 26 

27**Between sessions.** `/clear` starts fresh on a new task while keeping project memory. `/resume` and `/branch` let you return to or fork an earlier conversation. `/teleport` pulls a web session into this terminal, and `/remote-control` lets you continue this local session from another device.27**Between sessions.** `/clear` starts fresh on a new task while keeping project memory. `/resume` and `/branch` let you return to or fork an earlier conversation. `/teleport` pulls a web session into this terminal, and `/remote-control` lets you continue this local session from another device.

28 28 

29**When something is wrong.** `/rewind` rolls code and conversation back to a checkpoint. `/doctor` and `/debug` diagnose install and runtime issues, and `/feedback` reports a bug with session context attached.29**When something is wrong.** `/rewind` rolls code and conversation back to a checkpoint, or summarizes part of the conversation. `/doctor` and `/debug` diagnose install and runtime issues, and `/feedback` reports a bug with session context attached.

30 30 

31## All commands31## All commands

32 32 

desktop.md +5 −2

Details

148 148 

149### Run commands in the terminal149### Run commands in the terminal

150 150 

151The integrated terminal lets you run commands alongside your session without switching to another app. Open it from the **Views** menu or press **Ctrl+\`** on macOS or Windows. The terminal opens in your session's working directory and shares the same environment as Claude, so commands like `npm test` or `git status` see the same files Claude is editing. The terminal is available in local sessions only.151The integrated terminal lets you run commands alongside your session without switching to another app. Open it from the **Views** menu or press **Ctrl+\`** on macOS or Windows. The terminal opens in your session's working directory and shares the same environment as Claude, so commands like `npm test` or `git status` see the same files Claude is editing. To open a second terminal tab, click **+** in the terminal pane header or right-click a folder in the chat to choose **Open in terminal**. The terminal is available in local sessions only.

152 152 

153### Open and edit files153### Open and edit files

154 154 


296 296 

297Use the controls at the top of the sidebar to filter sessions by status, project, or environment, and to group sessions by project. To rename a session, click the session title in the toolbar at the top of the active session. To check context usage, see [Check usage](#check-usage). When context fills up, Claude automatically summarizes the conversation and continues working. You can also type `/compact` to trigger summarization earlier and free up context space. See [the context window](/en/how-claude-code-works#the-context-window) for details on how compaction works.297Use the controls at the top of the sidebar to filter sessions by status, project, or environment, and to group sessions by project. To rename a session, click the session title in the toolbar at the top of the active session. To check context usage, see [Check usage](#check-usage). When context fills up, Claude automatically summarizes the conversation and continues working. You can also type `/compact` to trigger summarization earlier and free up context space. See [the context window](/en/how-claude-code-works#the-context-window) for details on how compaction works.

298 298 

299The desktop app sends an OS notification when a Code session finishes a task and you aren't currently viewing that session.

300 

299### Ask a side question without derailing the session301### Ask a side question without derailing the session

300 302 

301A side chat lets you ask Claude a question that uses your session's context but doesn't add anything back to the main conversation. Use it when you want to understand a piece of code, check an assumption, or explore an idea without steering the session off course.303A side chat lets you ask Claude a question that uses your session's context but doesn't add anything back to the main conversation. Use it when you want to understand a piece of code, check an assumption, or explore an idea without steering the session off course.


598Managed settings override project and user settings and apply when Desktop spawns CLI sessions. You can set these keys in your organization's [managed settings](/en/settings#settings-precedence) file or push them remotely through the admin console.600Managed settings override project and user settings and apply when Desktop spawns CLI sessions. You can set these keys in your organization's [managed settings](/en/settings#settings-precedence) file or push them remotely through the admin console.

599 601 

600| Key | Description |602| Key | Description |

601| ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |603| ------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

602| `permissions.disableBypassPermissionsMode` | set to `"disable"` to prevent users from enabling Bypass permissions mode. |604| `permissions.disableBypassPermissionsMode` | set to `"disable"` to prevent users from enabling Bypass permissions mode. |

603| `disableAutoMode` | set to `"disable"` to prevent users from enabling [Auto](/en/permission-modes#eliminate-prompts-with-auto-mode) mode. Removes Auto from the mode selector. Also accepted under `permissions`. |605| `disableAutoMode` | set to `"disable"` to prevent users from enabling [Auto](/en/permission-modes#eliminate-prompts-with-auto-mode) mode. Removes Auto from the mode selector. Also accepted under `permissions`. |

604| `autoMode` | customize what the auto mode classifier trusts and blocks across your organization. See [Configure auto mode](/en/auto-mode-config). |606| `autoMode` | customize what the auto mode classifier trusts and blocks across your organization. See [Configure auto mode](/en/auto-mode-config). |

605| `sshConfigs` | pre-configure [SSH connections](#pre-configure-ssh-connections-for-your-team) that appear in the environment dropdown. Users cannot edit or delete managed connections. |607| `sshConfigs` | pre-configure [SSH connections](#pre-configure-ssh-connections-for-your-team) that appear in the environment dropdown. Users cannot edit or delete managed connections. |

606| `sshHostAllowlist` | restrict [SSH sessions](#restrict-which-ssh-hosts-users-can-connect-to) to hosts whose resolved hostname matches one of these patterns. An empty array disables SSH sessions. Read from managed settings only. |608| `sshHostAllowlist` | restrict [SSH sessions](#restrict-which-ssh-hosts-users-can-connect-to) to hosts whose resolved hostname matches one of these patterns. An empty array disables SSH sessions. Read from managed settings only. |

609| `managedMcpServers` | push MCP server configurations to all users in a third-party deployment. Each entry specifies a transport of `"http"`, `"sse"`, or `"stdio"`, connection details, and optionally a `toolPolicy` map that restricts which tools in that server users can invoke. Available in third-party (3P) Desktop deployments only. |

607 610 

608A managed settings file deployed to disk on each machine applies to Desktop sessions. Managed settings pushed remotely through the admin console currently reach CLI and IDE sessions only, so for Desktop deployments either distribute the file via MDM or use the [admin console controls](#admin-console-controls) above.611A managed settings file deployed to disk on each machine applies to Desktop sessions. Managed settings pushed remotely through the admin console currently reach CLI and IDE sessions only, so for Desktop deployments either distribute the file via MDM or use the [admin console controls](#admin-console-controls) above.

609 612 

desktop-changelog.md +92 −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# Desktop changelog

6 

7> Release notes for Claude Code on Desktop, covering new features, improvements, and bug fixes by Desktop app version.

8 

9This page covers Claude Code-specific changes in the Desktop app. For changes to the Claude Code CLI bundled inside the app, see the [CLI changelog](/en/changelog).

10 

11<Update label="1.7196.0" description="May 12, 2026">

12 * Fixed auto-update hanging indefinitely on Relaunch to Update when popout windows refused to close.

13 * Fixed local sessions failing to start after a corrupted bundled Claude Code binary was cached.

14 * Fixed the credential helper opening duplicate browser sign-in tabs when starting a new conversation.

15 * Fixed Code tab PR status icons showing the wrong state for merged, merge-queued, and draft pull requests.

16 * Fixed Quick Entry dropping characters entered with a Korean, Japanese, or Chinese input method.

17 * Added an "Also delete files on disk" option to the scheduled task delete dialog; checking it removes the task's `SKILL.md` file and associated data from `~/.claude/scheduled-tasks/`.

18 * Added support for mouse back and forward buttons for navigating the chat view.

19 

20 **3P managed deployments**

21 

22 * Added an organization banner across the top of the app window, configured by IT administrators.

23</Update>

24 

25<Update label="1.6889.0" description="May 8, 2026">

26 * Added MCP App widget rendering in Code tab sessions.

27 * Added an OS notification when a Code session finishes a task and you aren't currently viewing it.

28 * Added automatic detection and re-download of corrupted Claude Code CLI binaries on macOS.

29 * Added support for scheduled tasks to modify their own schedule or prompt during a run using the `update_scheduled_task` MCP tool.

30 * Updated the list of available MCP tools to reload automatically when the local MCP configuration changes.

31 * Updated PR auto-fix to post a reply on each review thread it addresses and mark the thread resolved.

32 * Improved SSH session startup speed by preconnecting saved SSH configurations at app launch.

33 * Fixed pasting a code block into a busy terminal; the app now opens a new terminal tab when the existing one has a process running.

34 * Fixed PR bar issues in Code sessions: each row now shows its own diff, and the sidebar status icon updates when a PR is merged.

35 * Fixed garbled scrollback, such as stray `%` marks and half-wrapped prompts, when opening the terminal pane after running a code block.

36 * Fixed Code session links opening with overlapping window controls when reached via Handoff or share links.

37 * Fixed git commit signing failing in local sessions when the signing key is held by 1Password or Secretive.

38 * Fixed locally installed plugins disappearing from sessions after the plugin registry file became corrupted by concurrent writes.

39 * Fixed scheduled tasks running with auto-approve echoing tool-use suggestions into the session.

40 * Fixed SSH plugin sync so a single problematic plugin no longer blocks sync for the rest.

41 

42 **3P managed deployments**

43 

44 * Added support for stdio-transport local MCP servers via the `managedMcpServers` managed-settings key; the connector detail panel now shows the command and arguments, and environment variable values are masked outside the admin Setup screen.

45 * Added a managed-settings option to disable `claude://` deep-link handling.

46 * Added support for customizing model display names in the model picker via `labelOverride`.

47 * Fixed per-tool MCP server policies set by administrators not being enforced in all session types.

48</Update>

49 

50<Update label="1.6608.0" description="May 7, 2026">

51 * Fixed scheduled tasks failing to run when a previous run was stuck waiting on a permission prompt.

52 * Fixed scheduled tasks repeatedly retrying a failed run instead of waiting for the next scheduled time.

53 * Fixed scheduled-task history incorrectly showing "computer asleep" for runs skipped due to a concurrency limit.

54 * Added per-plugin auto-install for organization-provisioned plugins via the plugin manifest.

55 * Added Unarchive to the Code session context menu; sending a message in an archived session now restores it automatically.

56 * Added a warning when archiving a Code session that has uncommitted changes in its worktree.

57 * Added a warning when quitting or restarting the app while local Code sessions are running.

58 * Added csh and tcsh login shell support when connecting to remote SSH hosts.

59 * Fixed folder permission rules failing to match when the connected folder is a drive root.

60 * Fixed Windows installs leaving an empty folder under `%LOCALAPPDATA%`.

61</Update>

62 

63<Update label="1.6259.0" description="May 5, 2026">

64 * Code sessions now default the working directory to the home folder when none is configured.

65 * `settings.json` project settings now cascade from the SSH host for SSH Code sessions.

66 * "Always allow" tool permissions now persist across app restarts and display their scope.

67 * Added automatic detection and re-download of corrupted Claude Code CLI binaries on Windows.

68 * The PR bar now shows stacked and sibling pull requests alongside the branch's own PR.

69 * Messages sent while a turn is running are now queued rather than dropped.

70 * Opening a Code session link on iOS now continues the session on macOS via Handoff.

71</Update>

72 

73<Update label="1.5354.0" description="April 29, 2026">

74 * Disabling the org Skills toggle in the admin console now removes the skill management tools `list_skills`, `save_skill`, and `propose_skills` from Code sessions.

75 * The preview pane now opens automatically when a session's working directory is a symlink.

76 * Improved login-shell PATH extraction for more reliable tool discovery.

77</Update>

78 

79<Update label="1.5220.0" description="April 28, 2026">

80 * Added a multi-tab terminal pane; click **+** in the terminal pane header to open a second tab, or right-click a folder in the chat to choose **Open in terminal**.

81 * Fixed worktree pool re-lease creating a fresh worktree on checkout failure instead of re-using an existing one.

82 * Fixed rewind selecting the wrong assistant message after a previous rewind created a fork.

83</Update>

84 

85<Update label="1.5186.0" description="April 28, 2026">

86 * Added `list_sessions`, `search_session_transcripts`, and `archive_session` MCP tools for managing Code sessions from within a session.

87 * Improved SSH wake-path reliability and surfaced `ProxyCommand` stderr output for easier debugging.

88 * Fixed login-shell PATH extraction for fish shell users. It was returning a newline-separated list instead of a colon-separated one.

89 * Fixed the SSH remote control socket directory permissions so `~/.claude/remote` is no longer world-traversable.

90 * PR review bodies and issue comments are now forwarded to the auto-fix engine.

91 * Added a category-driven error UI for Code sessions that groups failures by type and surfaces actionable recovery steps.

92</Update>

Details

90* **Edit**: change the instructions, schedule, folder, or other settings90* **Edit**: change the instructions, schedule, folder, or other settings

91* **Review history**: see every past run, including skipped runs. Hover a skipped entry to see why: your computer was asleep, the previous run was still in progress, or other scheduled tasks were already running. Click **Show more** to load older entries.91* **Review history**: see every past run, including skipped runs. Hover a skipped entry to see why: your computer was asleep, the previous run was still in progress, or other scheduled tasks were already running. Click **Show more** to load older entries.

92* **Review allowed permissions**: see and revoke saved tool approvals for this task from the **Always allowed** panel92* **Review allowed permissions**: see and revoke saved tool approvals for this task from the **Always allowed** panel

93* **Delete**: remove the task and archive all sessions it created93* **Delete**: remove the task and archive all sessions it created. An **Also delete files on disk** checkbox appears in the confirmation dialog; check it to also remove the task's `SKILL.md` file and associated data from `~/.claude/scheduled-tasks/`.

94 94 

95You can also list, create, edit, and pause tasks by asking Claude in any Desktop session. For example, "pause my dependency-audit task" or "show me my scheduled tasks." To delete a task, use the **Delete** button on its detail page.95You can also list, create, edit, and pause tasks by asking Claude in any Desktop session. For example, "pause my dependency-audit task" or "show me my scheduled tasks." To delete a task, use the **Delete** button on its detail page.

96 96 

97A scheduled task can also modify its own schedule or prompt from within a running session using the `update_scheduled_task` MCP tool. This lets a task reschedule itself based on what it finds, for example, rescheduling a code review to run earlier when it detects a release branch has been created.

98 

97To edit a task's prompt on disk, open `~/.claude/scheduled-tasks/<task-name>/SKILL.md` (or under [`CLAUDE_CONFIG_DIR`](/en/env-vars) if set). The file uses YAML frontmatter for `name` and `description`, with the prompt as the body. Changes take effect on the next run. Schedule, folder, model, and enabled state are not in this file: change them through the Edit form or ask Claude.99To edit a task's prompt on disk, open `~/.claude/scheduled-tasks/<task-name>/SKILL.md` (or under [`CLAUDE_CONFIG_DIR`](/en/env-vars) if set). The file uses YAML frontmatter for `name` and `description`, with the prompt as the body. Changes take effect on the next run. Schedule, folder, model, and enabled state are not in this file: change them through the Edit form or ask Claude.

98 100 

99## Related resources101## Related resources

env-vars.md +3 −1

Details

45| `ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION` | Override AWS region for the Haiku-class model when using Bedrock or Bedrock Mantle |45| `ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION` | Override AWS region for the Haiku-class model when using Bedrock or Bedrock Mantle |

46| `ANTHROPIC_VERTEX_BASE_URL` | Override the Vertex AI endpoint URL. Use for custom Vertex endpoints or when routing through an [LLM gateway](/en/llm-gateway). See [Google Vertex AI](/en/google-vertex-ai) |46| `ANTHROPIC_VERTEX_BASE_URL` | Override the Vertex AI endpoint URL. Use for custom Vertex endpoints or when routing through an [LLM gateway](/en/llm-gateway). See [Google Vertex AI](/en/google-vertex-ai) |

47| `ANTHROPIC_VERTEX_PROJECT_ID` | GCP project ID for Vertex AI requests. Overridden by `GCLOUD_PROJECT`, `GOOGLE_CLOUD_PROJECT`, or the project in your `GOOGLE_APPLICATION_CREDENTIALS` credential file. See [Google Vertex AI](/en/google-vertex-ai) |47| `ANTHROPIC_VERTEX_PROJECT_ID` | GCP project ID for Vertex AI requests. Overridden by `GCLOUD_PROJECT`, `GOOGLE_CLOUD_PROJECT`, or the project in your `GOOGLE_APPLICATION_CREDENTIALS` credential file. See [Google Vertex AI](/en/google-vertex-ai) |

48| `ANTHROPIC_WORKSPACE_ID` | Workspace ID for [workload identity federation](https://platform.claude.com/docs/en/manage-claude/workload-identity-federation). Set this when your federation rule is scoped to more than one workspace so the token exchange knows which workspace to target |

48| `API_TIMEOUT_MS` | Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). Increase this when requests time out on slow networks or when routing through a proxy. Values above the maximum overflow the underlying timer and cause requests to fail immediately |49| `API_TIMEOUT_MS` | Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). Increase this when requests time out on slow networks or when routing through a proxy. Values above the maximum overflow the underlying timer and cause requests to fail immediately |

49| `AWS_BEARER_TOKEN_BEDROCK` | Bedrock API key for authentication (see [Bedrock API keys](https://aws.amazon.com/blogs/machine-learning/accelerate-ai-development-with-amazon-bedrock-api-keys/)) |50| `AWS_BEARER_TOKEN_BEDROCK` | Bedrock API key for authentication (see [Bedrock API keys](https://aws.amazon.com/blogs/machine-learning/accelerate-ai-development-with-amazon-bedrock-api-keys/)) |

50| `BASH_DEFAULT_TIMEOUT_MS` | Default timeout for long-running bash commands (default: 120000, or 2 minutes) |51| `BASH_DEFAULT_TIMEOUT_MS` | Default timeout for long-running bash commands (default: 120000, or 2 minutes) |


138| `CLAUDE_CODE_PLUGIN_CACHE_DIR` | Override the plugins root directory. Despite the name, this sets the parent directory, not the cache itself: marketplaces and the plugin cache live in subdirectories under this path. Defaults to `~/.claude/plugins` |139| `CLAUDE_CODE_PLUGIN_CACHE_DIR` | Override the plugins root directory. Despite the name, this sets the parent directory, not the cache itself: marketplaces and the plugin cache live in subdirectories under this path. Defaults to `~/.claude/plugins` |

139| `CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS` | Timeout in milliseconds for git operations when installing or updating plugins (default: 120000). Increase this value for large repositories or slow network connections. See [Git operations time out](/en/plugin-marketplaces#git-operations-time-out) |140| `CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS` | Timeout in milliseconds for git operations when installing or updating plugins (default: 120000). Increase this value for large repositories or slow network connections. See [Git operations time out](/en/plugin-marketplaces#git-operations-time-out) |

140| `CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE` | Set to `1` to keep the existing marketplace cache when a `git pull` fails instead of wiping and re-cloning. Useful in offline or airgapped environments where re-cloning would fail the same way. See [Marketplace updates fail in offline environments](/en/plugin-marketplaces#marketplace-updates-fail-in-offline-environments) |141| `CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE` | Set to `1` to keep the existing marketplace cache when a `git pull` fails instead of wiping and re-cloning. Useful in offline or airgapped environments where re-cloning would fail the same way. See [Marketplace updates fail in offline environments](/en/plugin-marketplaces#marketplace-updates-fail-in-offline-environments) |

142| `CLAUDE_CODE_PLUGIN_PREFER_HTTPS` | Set to `1` to clone GitHub `owner/repo` plugin sources over HTTPS instead of SSH. Useful in CI runners, containers, or any environment without a configured SSH key for `github.com` |

141| `CLAUDE_CODE_PLUGIN_SEED_DIR` | Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](/en/plugin-marketplaces#pre-populate-plugins-for-containers) |143| `CLAUDE_CODE_PLUGIN_SEED_DIR` | Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](/en/plugin-marketplaces#pre-populate-plugins-for-containers) |

142| `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST` | Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files are ignored so user settings cannot override the host's routing. The automatic telemetry opt-out for Bedrock, Vertex, and Foundry is also skipped, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](/en/data-usage#default-behaviors-by-api-provider) |144| `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST` | Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files are ignored so user settings cannot override the host's routing. The automatic telemetry opt-out for Bedrock, Vertex, and Foundry is also skipped, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](/en/data-usage#default-behaviors-by-api-provider) |

143| `CLAUDE_CODE_PROXY_RESOLVES_HOSTS` | Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution |145| `CLAUDE_CODE_PROXY_RESOLVES_HOSTS` | Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution |


152| `CLAUDE_CODE_SHELL` | Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`) |154| `CLAUDE_CODE_SHELL` | Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`) |

153| `CLAUDE_CODE_SHELL_PREFIX` | Command prefix that wraps shell commands Claude Code spawns: Bash tool calls, [hook](/en/hooks) commands, and stdio [MCP server](/en/mcp) startup commands. Useful for logging or auditing. Example: setting `/path/to/logger.sh` runs each command as `/path/to/logger.sh <command>` |155| `CLAUDE_CODE_SHELL_PREFIX` | Command prefix that wraps shell commands Claude Code spawns: Bash tool calls, [hook](/en/hooks) commands, and stdio [MCP server](/en/mcp) startup commands. Useful for logging or auditing. Example: setting `/path/to/logger.sh` runs each command as `/path/to/logger.sh <command>` |

154| `CLAUDE_CODE_SIMPLE` | Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. The [`--bare`](/en/headless#start-faster-with-bare-mode) CLI flag sets this |156| `CLAUDE_CODE_SIMPLE` | Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. The [`--bare`](/en/headless#start-faster-with-bare-mode) CLI flag sets this |

155| `CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT` | Set to `1` to use a shorter system prompt and abbreviated tool descriptions on Opus 4.7. Has no effect on other models. The full tool set, hooks, MCP servers, and CLAUDE.md discovery remain enabled |157| `CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT` | Set to `1` to use a shorter system prompt and abbreviated tool descriptions on any model. Set to `0`, `false`, `no`, or `off` to opt out even on models where the experiment or server configuration would otherwise enable it. The full tool set, hooks, MCP servers, and CLAUDE.md discovery remain enabled |

156| `CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH` | Skip client-side authentication for [Claude Platform on AWS](/en/claude-platform-on-aws), for gateways that sign requests themselves |158| `CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH` | Skip client-side authentication for [Claude Platform on AWS](/en/claude-platform-on-aws), for gateways that sign requests themselves |

157| `CLAUDE_CODE_SKIP_BEDROCK_AUTH` | Skip AWS authentication for Bedrock (for example, when using an LLM gateway) |159| `CLAUDE_CODE_SKIP_BEDROCK_AUTH` | Skip AWS authentication for Bedrock (for example, when using an LLM gateway) |

158| `CLAUDE_CODE_SKIP_FOUNDRY_AUTH` | Skip Azure authentication for Microsoft Foundry (for example, when using an LLM gateway) |160| `CLAUDE_CODE_SKIP_FOUNDRY_AUTH` | Skip Azure authentication for Microsoft Foundry (for example, when using an LLM gateway) |

Details

159 159 

160### Using skills160### Using skills

161 161 

162The `prompt` input accepts a [skill](/en/skills) invocation as well as plain text:

163 

164* For a skill in your repository's `.claude/skills/` directory, run `actions/checkout` before the action step and pass `/skill-name`.

165* For a skill packaged in a plugin, install the plugin with the `plugin_marketplaces` and `plugins` inputs and pass the namespaced `/plugin-name:skill-name`.

166 

167The following workflow installs the `code-review` plugin and runs its skill on each new or updated pull request:

168 

162```yaml theme={null}169```yaml theme={null}

163name: Code Review170name: Code Review

164on:171on:


171 - uses: anthropics/claude-code-action@v1178 - uses: anthropics/claude-code-action@v1

172 with:179 with:

173 anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}180 anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}

174 prompt: "Review this pull request for code quality, correctness, and security. Analyze the diff, then post your findings as review comments."181 plugin_marketplaces: "https://github.com/anthropics/claude-code.git"

175 claude_args: "--max-turns 5"182 plugins: "code-review@claude-code-plugins"

183 prompt: "/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}"

176```184```

177 185 

178### Custom automation with prompts186### Custom automation with prompts


625The Claude Code Action v1 uses a simplified configuration:633The Claude Code Action v1 uses a simplified configuration:

626 634 

627| Parameter | Description | Required |635| Parameter | Description | Required |

628| ------------------- | ------------------------------------------------------------------ | -------- |636| --------------------- | ------------------------------------------------------------------ | -------- |

629| `prompt` | Instructions for Claude (plain text or a [skill](/en/skills) name) | No\* |637| `prompt` | Instructions for Claude (plain text or a [skill](/en/skills) name) | No\* |

630| `claude_args` | CLI arguments passed to Claude Code | No |638| `claude_args` | CLI arguments passed to Claude Code | No |

639| `plugin_marketplaces` | Newline-separated list of plugin marketplace Git URLs | No |

640| `plugins` | Newline-separated list of plugin names to install before execution | No |

631| `anthropic_api_key` | Claude API key | Yes\*\* |641| `anthropic_api_key` | Claude API key | Yes\*\* |

632| `github_token` | GitHub token for API access | No |642| `github_token` | GitHub token for API access | No |

633| `trigger_phrase` | Custom trigger phrase (default: "@claude") | No |643| `trigger_phrase` | Custom trigger phrase (default: "@claude") | No |

glossary.md +1 −1

Details

70 70 

71### Checkpoint71### Checkpoint

72 72 

73An automatic snapshot of your code captured before each edit Claude makes. Press `Esc` twice or run `/rewind` to restore code, conversation, or both to an earlier point. Checkpoints are local to the session, separate from git, and don't track changes made through the Bash tool.73A restore point created at each prompt you send. Claude Code snapshots files before every edit so a checkpoint can revert them. Press `Esc` twice or run `/rewind` to restore code, conversation, or both to an earlier point, or to summarize part of the conversation from a selected message. Checkpoints are local to the session, separate from git, and don't track changes made through the Bash tool.

74 74 

75Learn more: [Checkpointing](/en/checkpointing)75Learn more: [Checkpointing](/en/checkpointing)

76 76 

goal.md +1 −1

Details

108 108 

109### Run non-interactively109### Run non-interactively

110 110 

111`/goal` works in [non-interactive mode](/en/headless) and through [Remote Control](/en/remote-control). Setting a goal with `-p` runs the loop to completion in a single invocation:111`/goal` works in [non-interactive mode](/en/headless), in the [desktop app](/en/desktop), and through [Remote Control](/en/remote-control). Setting a goal with `-p` runs the loop to completion in a single invocation:

112 112 

113```bash theme={null}113```bash theme={null}

114claude -p "/goal CHANGELOG.md has an entry for every PR merged this week"114claude -p "/goal CHANGELOG.md has an entry for every PR merged this week"

hooks.md +47 −7

Details

297| :-------------- | :------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |297| :-------------- | :------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

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

299| `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) |299| `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| `timeout` | no | Seconds before canceling. Defaults: 600 for command, 30 for prompt, 60 for agent |300| `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| `statusMessage` | no | Custom spinner message displayed while the hook runs |301| `statusMessage` | no | Custom spinner message displayed while the hook runs |

302| `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 |302| `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 303 


558 558 

559Command hooks receive JSON data via stdin and communicate results through exit codes, stdout, and stderr. HTTP hooks receive the same JSON as the POST request body and communicate results through the HTTP response body. This section covers fields and behavior common to all events. Each event's section under [Hook events](#hook-events) includes its specific input schema and decision control options.559Command hooks receive JSON data via stdin and communicate results through exit codes, stdout, and stderr. HTTP hooks receive the same JSON as the POST request body and communicate results through the HTTP response body. This section covers fields and behavior common to all events. Each event's section under [Hook events](#hook-events) includes its specific input schema and decision control options.

560 560 

561On macOS and Linux, command hooks run in their own session without a controlling terminal as of v2.1.139. The hook process and any child processes cannot open `/dev/tty` or send escape sequences directly to the Claude Code interface. Windows has no `/dev/tty`. To surface a message to the user on any platform, return [`systemMessage`](#json-output) in JSON output. To trigger a desktop notification, set a window title, or ring the bell, return [`terminalSequence`](#emit-terminal-notifications) instead.

562 

561### Common input fields563### Common input fields

562 564 

563Hook events receive these fields as JSON, in addition to event-specific fields documented in each [hook event](#hook-events) section. For command hooks, this JSON arrives via stdin. For HTTP hooks, it arrives as the POST request body.565Hook events receive these fields as JSON, in addition to event-specific fields documented in each [hook event](#hook-events) section. For command hooks, this JSON arrives via stdin. For HTTP hooks, it arrives as the POST request body.


685 687 

686Your hook's stdout must contain only the JSON object. If your shell profile prints text on startup, it can interfere with JSON parsing. See [JSON validation failed](/en/hooks-guide#json-validation-failed) in the troubleshooting guide.688Your hook's stdout must contain only the JSON object. If your shell profile prints text on startup, it can interfere with JSON parsing. See [JSON validation failed](/en/hooks-guide#json-validation-failed) in the troubleshooting guide.

687 689 

688Hook output injected into context (`additionalContext`, `systemMessage`, or plain stdout) is capped at 10,000 characters. Output that exceeds this limit is saved to a file and replaced with a preview and file path, the same way large tool results are handled.690Hook output strings, including `additionalContext`, `systemMessage`, and plain stdout, are capped at 10,000 characters. Output that exceeds this limit is saved to a file and replaced with a preview and file path, the same way large tool results are handled.

689 691 

690The JSON object supports three kinds of fields:692The JSON object supports three kinds of fields:

691 693 


694* **`hookSpecificOutput`** is a nested object for events that need richer control. It requires a `hookEventName` field set to the event name.696* **`hookSpecificOutput`** is a nested object for events that need richer control. It requires a `hookEventName` field set to the event name.

695 697 

696| Field | Default | Description |698| Field | Default | Description |

697| :--------------- | :------ | :------------------------------------------------------------------------------------------------------------------------- |699| :----------------- | :------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

698| `continue` | `true` | If `false`, Claude stops processing entirely after the hook runs. Takes precedence over any event-specific decision fields |700| `continue` | `true` | If `false`, Claude stops processing entirely after the hook runs. Takes precedence over any event-specific decision fields |

699| `stopReason` | none | Message shown to the user when `continue` is `false`. Not shown to Claude |701| `stopReason` | none | Message shown to the user when `continue` is `false`. Not shown to Claude |

700| `suppressOutput` | `false` | If `true`, omits stdout from the debug log |702| `suppressOutput` | `false` | If `true`, omits stdout from the debug log |

701| `systemMessage` | none | Warning message shown to the user |703| `systemMessage` | none | Warning message shown to the user |

704| `terminalSequence` | none | A terminal escape sequence for Claude Code to emit on your behalf, such as a desktop notification, window title, or bell. Restricted to OSC `0`/`1`/`2`/`9`/`99`/`777` and BEL. If the value contains anything outside the allowlist, the field is ignored. Use this instead of writing to `/dev/tty`, which is unavailable to hooks |

702 705 

703To stop Claude entirely regardless of event type:706To stop Claude entirely regardless of event type:

704 707 


706{ "continue": false, "stopReason": "Build failed, fix errors before continuing" }709{ "continue": false, "stopReason": "Build failed, fix errors before continuing" }

707```710```

708 711 

712#### Emit terminal notifications

713 

714The `terminalSequence` field requires Claude Code v2.1.141 or later.

715 

716Hooks run without a controlling terminal, so writing escape sequences directly to `/dev/tty` fails. Instead, return the escape sequence in the `terminalSequence` field and Claude Code emits it for you through its own terminal write path. This is race-free, works inside tmux and GNU screen, and works on Windows where there is no `/dev/tty`.

717 

718The field accepts a string of one or more allowlisted escape sequences:

719 

720* OSC `0`, `1`, `2`: window and icon titles

721* OSC `9`: iTerm2, ConEmu, Windows Terminal, and WezTerm notifications, including `9;4` taskbar progress

722* OSC `99`: Kitty notifications

723* OSC `777`: urxvt, Ghostty, and Warp notifications

724* Bare BEL

725 

726Sequences may be terminated with BEL or with ST. Anything outside the allowlist, including CSI cursor and color sequences, OSC palette sequences, OSC 8 hyperlinks, OSC 52 clipboard writes, and OSC 1337, is rejected and the field is ignored.

727 

728The example below fires a desktop notification from a `Notification` hook. The escape sequence is built with `printf` octal escapes so the control bytes never appear on the shell command line, and `jq -n --arg` builds the JSON output so quotes, backslashes, and newlines in the notification message are escaped correctly:

729 

730```bash theme={null}

731#!/bin/bash

732# Notification hook: ping the desktop when Claude Code needs attention.

733input=$(cat)

734title="Claude Code"

735body=$(jq -r '.message // "Needs your attention"' <<<"$input")

736seq=$(printf '\033]777;notify;%s;%s\007' "$title" "$body")

737jq -nc --arg seq "$seq" '{terminalSequence: $seq}'

738```

739 

740The `{ "terminalSequence": "..." }` shape is the same from any shell or language. On Windows, build the escape string in PowerShell or a script and emit the same JSON object.

741 

742<Note>

743 `terminalSequence` is the supported replacement for hooks that previously wrote escape sequences directly to `/dev/tty`. The allowlist is restricted to sequences that cannot move the cursor or alter colors, so a hook can never corrupt an on-screen prompt.

744</Note>

745 

709#### Add context for Claude746#### Add context for Claude

710 747 

711The `additionalContext` field passes a string from your hook into Claude's context window. Claude Code wraps the string in a system reminder and inserts it into the conversation at the point where the hook fired. Claude reads the reminder on the next model request, but it does not appear as a chat message in the interface.748The `additionalContext` field passes a string from your hook into Claude's context window. Claude Code wraps the string in a system reminder and inserts it into the conversation at the point where the hook fired. Claude reads the reminder on the next model request, but it does not appear as a chat message in the interface.


991to add additional context based on the prompt/conversation, validate prompts, or1028to add additional context based on the prompt/conversation, validate prompts, or

992block certain types of prompts.1029block certain types of prompts.

993 1030 

1031`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.

1032 

994#### UserPromptSubmit input1033#### UserPromptSubmit input

995 1034 

996In addition to the [common input fields](#common-input-fields), UserPromptSubmit hooks receive the `prompt` field containing the text the user submitted.1035In addition to the [common input fields](#common-input-fields), UserPromptSubmit hooks receive the `prompt` field containing the text the user submitted.


2604 2643 

2605When an async hook fires, Claude Code starts the hook process and immediately continues without waiting for it to finish. The hook receives the same JSON input via stdin as a synchronous hook.2644When an async hook fires, Claude Code starts the hook process and immediately continues without waiting for it to finish. The hook receives the same JSON input via stdin as a synchronous hook.

2606 2645 

2607After the background process exits, if the hook produced a JSON response with a `systemMessage` or `additionalContext` field, that content is delivered to Claude as context on the next conversation turn.2646After the background process exits, if the hook produced a JSON response with an `additionalContext` field, that content is delivered to Claude as context on the next conversation turn. A `systemMessage` field is shown to you, not to Claude.

2608 2647 

2609Async hook completion notifications are suppressed by default. To see them, enable verbose mode with `Ctrl+O` or start Claude Code with `--verbose`.2648Async hook completion notifications are suppressed by default. To see them, enable verbose mode with `Ctrl+O` or start Claude Code with `--verbose`.

2610 2649 


2625 exit 02664 exit 0

2626fi2665fi

2627 2666 

2628# Run tests and report results via systemMessage2667# Run tests and report results to Claude via additionalContext

2629RESULT=$(npm test 2>&1)2668RESULT=$(npm test 2>&1)

2630EXIT_CODE=$?2669EXIT_CODE=$?

2631 2670 

2632if [ $EXIT_CODE -eq 0 ]; then2671if [ $EXIT_CODE -eq 0 ]; then

2633 echo "{\"systemMessage\": \"Tests passed after editing $FILE_PATH\"}"2672 MSG="Tests passed after editing $FILE_PATH"

2634else2673else

2635 echo "{\"systemMessage\": \"Tests failed after editing $FILE_PATH: $RESULT\"}"2674 MSG="Tests failed after editing $FILE_PATH: $RESULT"

2636fi2675fi

2676jq -nc --arg msg "$MSG" '{hookSpecificOutput: {hookEventName: "PostToolUse", additionalContext: $msg}}'

2637```2677```

2638 2678 

2639Then add this configuration to `.claude/settings.json` in your project root. The `async: true` flag lets Claude keep working while tests run:2679Then add this configuration to `.claude/settings.json` in your project root. The `async: true` flag lets Claude keep working while tests run:

hooks-guide.md +4 −1

Details

865### Limitations865### Limitations

866 866 

867* 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.867* 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.

868* Hook timeout is 10 minutes by default, configurable per hook with the `timeout` field (in seconds).868* Hook timeouts vary by type. Override per hook with the `timeout` field in seconds.

869 * `command`, `http`, `mcp_tool`: 10 minutes. `UserPromptSubmit` lowers these to 30 seconds.

870 * `prompt`: 30 seconds.

871 * `agent`: 60 seconds.

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

870* `PermissionRequest` hooks do not fire in [non-interactive mode](/en/headless) (`-p`). Use `PreToolUse` hooks for automated permission decisions.873* `PermissionRequest` hooks do not fire in [non-interactive mode](/en/headless) (`-p`). Use `PreToolUse` hooks for automated permission decisions.

871* `Stop` hooks fire whenever Claude finishes responding, not only at task completion. They do not fire on user interrupts. API errors fire [StopFailure](/en/hooks#stopfailure) instead.874* `Stop` hooks fire whenever Claude finishes responding, not only at task completion. They do not fire on user interrupts. API errors fire [StopFailure](/en/hooks#stopfailure) instead.

mcp.md +1 −1

Details

458 458 

459Many cloud-based MCP servers require authentication. Claude Code supports OAuth 2.0 for secure connections.459Many cloud-based MCP servers require authentication. Claude Code supports OAuth 2.0 for secure connections.

460 460 

461Claude Code marks a remote server as needing authentication when the server responds with `401 Unauthorized` and a `WWW-Authenticate` header pointing to its authorization server. Any custom server that returns that response gets the same `/mcp` authentication flow as any other remote server.461Claude Code marks a remote server as needing authentication when the server responds with `401 Unauthorized` or `403 Forbidden`. Either status code flags the server in `/mcp` so you can complete the OAuth flow. A custom server that returns a `WWW-Authenticate` header pointing to its authorization server gets the same automatic discovery as any other remote server.

462 462 

463<Steps>463<Steps>

464 <Step title="Add the server that requires authentication">464 <Step title="Add the server that requires authentication">

Details

130 130 

131### Enable Remote Control for all sessions131### Enable Remote Control for all sessions

132 132 

133By default, Remote Control only activates when you explicitly run `claude remote-control`, `claude --remote-control`, or `/remote-control`. To enable it automatically for every interactive session, run `/config` inside Claude Code and set **Enable Remote Control for all sessions** to `true`. Set it back to `false` to disable.133By default, Remote Control only activates when you explicitly run `claude remote-control`, `claude --remote-control`, or `/remote-control`. To enable it automatically for every interactive session, run `/config` inside Claude Code and set **Enable Remote Control for all sessions** to `true`. Set it back to `false` to disable. In the Desktop app, you can also toggle this from **Settings → Claude Code → Enable remote control by default**.

134 134 

135With this setting on, each interactive Claude Code process registers one remote session. If you run multiple instances, each one gets its own environment and session. To run multiple concurrent sessions from a single process, use [server mode](#start-a-remote-control-session) instead.135With this setting on, each interactive Claude Code process registers one remote session. If you run multiple instances, each one gets its own environment and session. To run multiple concurrent sessions from a single process, use [server mode](#start-a-remote-control-session) instead.

136 136 

sub-agents.md +6 −4

Details

158 158 

159This is the recommended way to create and manage subagents. For manual creation or automation, you can also add subagent files directly.159This is the recommended way to create and manage subagents. For manual creation or automation, you can also add subagent files directly.

160 160 

161To list all configured subagents from the command line without opening [agent view](/en/agent-view), pipe the output of `claude agents`. For example, `claude agents | cat` prints agents grouped by source and indicates which are overridden by higher-priority definitions.

162 

163### Choose the subagent scope161### Choose the subagent scope

164 162 

165Subagents are Markdown files with YAML frontmatter. Store them in different locations depending on scope. When multiple subagents share the same name, the higher-priority location wins.163Subagents are Markdown files with YAML frontmatter. Store them in different locations depending on scope. When multiple subagents share the same name, the higher-priority location wins.


178 176 

179**User subagents** (`~/.claude/agents/`) are personal subagents available in all your projects.177**User subagents** (`~/.claude/agents/`) are personal subagents available in all your projects.

180 178 

179Claude Code scans `.claude/agents/` and `~/.claude/agents/` recursively, so you can organize definitions into subfolders such as `agents/review/` or `agents/research/`. The subdirectory path does not affect how a subagent is identified or invoked, because identity comes only from the `name` frontmatter field. Keep `name` values unique across the whole tree: if two files within one scope declare the same name, Claude Code keeps one and discards the other without warning.

180 

181Plugin `agents/` directories are also scanned recursively. Unlike project and user scopes, a subfolder inside a plugin's `agents/` directory becomes part of the [scoped identifier](#invoke-subagents-explicitly): a file at `agents/review/security.md` in plugin `my-plugin` registers as `my-plugin:review:security`.

182 

181**CLI-defined subagents** are passed as JSON when launching Claude Code. They exist only for that session and aren't saved to disk, making them useful for quick testing or automation scripts. You can define multiple subagents in a single `--agents` call:183**CLI-defined subagents** are passed as JSON when launching Claude Code. They exist only for that session and aren't saved to disk, making them useful for quick testing or automation scripts. You can define multiple subagents in a single `--agents` call:

182 184 

183<Tabs>185<Tabs>


638 640 

639Your full message still goes to Claude, which writes the subagent's task prompt based on what you asked. The @-mention controls which subagent Claude invokes, not what prompt it receives.641Your full message still goes to Claude, which writes the subagent's task prompt based on what you asked. The @-mention controls which subagent Claude invokes, not what prompt it receives.

640 642 

641Subagents provided by an enabled [plugin](/en/plugins) appear in the typeahead as `<plugin-name>:<agent-name>`. Named background subagents currently running in the session also appear in the typeahead, showing their status next to the name. You can also type the mention manually without using the picker: `@agent-<name>` for local subagents, or `@agent-<plugin-name>:<agent-name>` for plugin subagents.643Subagents provided by an enabled [plugin](/en/plugins) appear in the typeahead under their scoped name, such as `my-plugin:code-reviewer` or `my-plugin:review:security` when the plugin [organizes agents into subfolders](#choose-the-subagent-scope). Named background subagents currently running in the session also appear in the typeahead, showing their status next to the name. You can also type the mention manually without using the picker: `@agent-<name>` for local subagents, or `@agent-` followed by the scoped name for plugin subagents, for example `@agent-my-plugin:code-reviewer`.

642 644 

643**Run the whole session as a subagent.** Pass [`--agent <name>`](/en/cli-reference) to start a session where the main thread itself takes on that subagent's system prompt, tool restrictions, and model:645**Run the whole session as a subagent.** Pass [`--agent <name>`](/en/cli-reference) to start a session where the main thread itself takes on that subagent's system prompt, tool restrictions, and model:

644 646 


650 652 

651This works with built-in and custom subagents, and the choice persists when you resume the session.653This works with built-in and custom subagents, and the choice persists when you resume the session.

652 654 

653For a plugin-provided subagent, pass the scoped name: `claude --agent <plugin-name>:<agent-name>`.655For a plugin-provided subagent, pass the scoped name: `claude --agent <plugin-name>:<agent-name>`. If the plugin places the agent in a subfolder of its `agents/` directory, include the subfolder in the scoped name, for example `claude --agent my-plugin:review:security`.

654 656 

655To make it the default for every session in a project, set `agent` in `.claude/settings.json`:657To make it the default for every session in a project, set `agent` in `.claude/settings.json`:

656 658 

Details

16 16 

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. 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.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. 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.

18 18 

19Voice dictation also needs local microphone access, so it does not work in remote environments such as [Claude Code on the web](/en/claude-code-on-the-web) or SSH sessions. In WSL, voice dictation requires WSLg for audio access, which is included with WSL2 on Windows 11. On Windows 10 or WSL1, run Claude Code in native Windows instead.19Voice dictation also needs local microphone access, so it does not work in remote environments such as [Claude Code on the web](/en/claude-code-on-the-web) or SSH sessions. In WSL, voice dictation requires WSLg for audio access. WSLg is included with WSL2 when installed from the Microsoft Store on Windows 10 or 11. If WSLg is not available, for example on WSL1, run Claude Code in native Windows instead.

20 20 

21Audio recording uses a built-in native module on macOS, Linux, and Windows. On Linux, if the native module cannot load, Claude Code falls back to `arecord` from ALSA utils or `rec` from SoX. If neither is available, `/voice` prints an install command for your package manager.21Audio recording uses a built-in native module on macOS, Linux, and Windows. On Linux, if the native module cannot load, Claude Code falls back to `arecord` from ALSA utils or `rec` from SoX. If neither is available, `/voice` prints an install command for your package manager.

22 22 


51}51}

52```52```

53 53 

54While voice dictation is enabled, the input footer shows a `hold Space to speak` hint when the prompt is empty. The hint text is the same in both modes, and it does not appear if you have a [custom status line](/en/statusline) configured.54While voice dictation is enabled, the input footer shows a `hold Space to speak` hint when the prompt is empty. The hint reflects your current `voice:pushToTalk` binding and updates if you [rebind the dictation key](#rebind-the-dictation-key). The hint text is the same in both modes, and it does not appear if you have a [custom status line](/en/statusline) configured.

55 55 

56Transcription is tuned for coding vocabulary in both modes. Common development terms like `regex`, `OAuth`, `JSON`, and `localhost` are recognized correctly, and your current project name and git branch name are added as recognition hints automatically.56Transcription is tuned for coding vocabulary in both modes. Common development terms like `regex`, `OAuth`, `JSON`, and `localhost` are recognized correctly, and your current project name and git branch name are added as recognition hints automatically.

57 57 


155* **`Voice mode requires a Claude.ai account`**: you are authenticated with an API key or a third-party provider. Run `/login` to sign in with a Claude.ai account.155* **`Voice mode requires a Claude.ai account`**: you are authenticated with an API key or a third-party provider. Run `/login` to sign in with a Claude.ai account.

156* **`Microphone access is denied`**: grant microphone permission to your terminal in system settings. On macOS, go to System Settings → Privacy & Security → Microphone and enable your terminal app, then run `/voice` again. On Windows, go to Settings → Privacy & security → Microphone and turn on microphone access for desktop apps, then run `/voice` again. If your terminal isn't listed in the macOS settings, see [Terminal not listed in macOS Microphone settings](#terminal-not-listed-in-macos-microphone-settings).156* **`Microphone access is denied`**: grant microphone permission to your terminal in system settings. On macOS, go to System Settings → Privacy & Security → Microphone and enable your terminal app, then run `/voice` again. On Windows, go to Settings → Privacy & security → Microphone and turn on microphone access for desktop apps, then run `/voice` again. If your terminal isn't listed in the macOS settings, see [Terminal not listed in macOS Microphone settings](#terminal-not-listed-in-macos-microphone-settings).

157* **`No audio recording tool found` on Linux**: the native audio module could not load and no fallback is installed. Install SoX with the command shown in the error message, for example `sudo apt-get install sox`.157* **`No audio recording tool found` on Linux**: the native audio module could not load and no fallback is installed. Install SoX with the command shown in the error message, for example `sudo apt-get install sox`.

158* **`Voice mode could not find a working audio recorder in WSL`**: WSLg routes audio through PulseAudio rather than an ALSA device, so SoX needs its PulseAudio backend installed explicitly. Run `sudo apt install sox libsox-fmt-pulse`. Installing `sox` alone pulls in the ALSA backend, which cannot record on WSL because there is no `/dev/snd` device.

158* **`Voice input is failing repeatedly and has been paused`**: voice dictation hit several start-up failures in a row and stopped attempting new sessions until one succeeds. This usually means the microphone or audio stack on this host can't capture audio, for example a headless server, a remote shell with no audio passthrough, or a denied microphone permission. Confirm a working input device, fix the underlying cause from the entries above, then trigger voice again.159* **`Voice input is failing repeatedly and has been paused`**: voice dictation hit several start-up failures in a row and stopped attempting new sessions until one succeeds. This usually means the microphone or audio stack on this host can't capture audio, for example a headless server, a remote shell with no audio passthrough, or a denied microphone permission. Confirm a working input device, fix the underlying cause from the entries above, then trigger voice again.

159* **Nothing happens when holding `Space` in hold mode**: watch the prompt input while you hold. If spaces keep accumulating, voice dictation is likely off; run `/voice hold` to enable it. If only one or two spaces appear and then nothing, voice dictation is on but hold detection is not triggering. Hold detection requires your terminal to send key-repeat events, so it cannot detect a held key if key-repeat is disabled at the OS level. Switch to tap mode with `/voice tap` to avoid the key-repeat requirement.160* **Nothing happens when holding `Space` in hold mode**: watch the prompt input while you hold. If spaces keep accumulating, voice dictation is likely off; run `/voice hold` to enable it. If only one or two spaces appear and then nothing, voice dictation is on but hold detection is not triggering. Hold detection requires your terminal to send key-repeat events, so it cannot detect a held key if key-repeat is disabled at the OS level. Switch to tap mode with `/voice tap` to avoid the key-repeat requirement.

160* **Tapping `Space` types a space instead of recording in tap mode**: the first tap only starts recording when the prompt input is empty. Clear the input first, or check that you are in tap mode by running `/voice tap`.161* **Tapping `Space` types a space instead of recording in tap mode**: the first tap only starts recording when the prompt input is empty. Clear the input first, or check that you are in tap mode by running `/voice tap`.