Changes on
19 changes detected
--- a/admin-setup.md
+++ b/admin-setup.md
@@ -70,6 +70,7 @@
[Managed policy CLAUDE.md](</docs/en/memory#deploy-organization-wide-claude-md>)| Org-wide instructions loaded in every session, cannot be excluded| File at the managed policy path
[MCP server control](</docs/en/mcp#managed-mcp-configuration>)| Restrict which MCP servers users can add or connect to| `allowedMcpServers`, `deniedMcpServers`, `allowManagedMcpServersOnly`
[Plugin marketplace control](</docs/en/plugin-marketplaces#managed-marketplace-restrictions>)| Restrict which marketplace sources users can add and install from| `strictKnownMarketplaces`, `blockedMarketplaces`
+[Customization lockdown](</docs/en/settings#strictpluginonlycustomization>)| Block skills, agents, hooks, and MCP servers from user and project sources, so they can only come from plugins or managed settings| `strictPluginOnlyCustomization`
[Hook restrictions](</docs/en/settings#hook-configuration>)| Only managed hooks load; restrict HTTP hook URLs| `allowManagedHooksOnly`, `allowedHttpHookUrls`
[Disable agent view](</docs/en/agent-view#how-background-sessions-are-hosted>)| Turn off `claude agents`, `--bg`, `/background`, and the on-demand supervisor| `disableAgentView`
[Version floor](</docs/en/settings>)| Prevent auto-update from installing below an org-wide minimum| `minimumVersion`
--- a/changelog.md
+++ b/changelog.md
@@ -5,6 +5,29 @@
> Use this file to discover all available pages before exploring further.
This page is generated from the [CHANGELOG.md on GitHub](<https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md>). Run `claude --version` to check your installed version.
+
+
+
+2.1.146
+
+May 21, 2026
+
+ * Renamed `/simplify` to `/code-review` with an optional effort level (e.g. `/code-review high`)
+ * Auto mode no longer suppresses `AskUserQuestion` when the user or a skill explicitly relies on it
+ * Fixed Windows PowerShell tool failing with “command line is invalid” when `pwsh` is installed via winget or the Microsoft Store (regression in v2.1.124)
+ * Fixed MCP `resources/list`, `resources/templates/list`, and `prompts/list` dropping items past page 1 on paginating servers
+ * Fixed full-screen strobing in attached background sessions on Windows Terminal while Claude is streaming
+ * Fixed the auto-updater status line not showing your current version when an update fails
+ * Fixed on Windows, removing a background-job worktree no longer follows NTFS junctions into the main repo
+ * Fixed `/background` refusing sessions whose only typed input was a skill or custom slash command
+ * Fixed backgrounded sessions re-prompting for tool permissions you already granted with “don’t ask again”
+ * Fixed `/theme` color editor and “New custom theme” dialogs not responding to Esc
+ * Fixed an uncaught exception at the end of streaming sessions when running via the Agent SDK
+ * Fixed `forceLoginOrgUUID` and `forceLoginMethod` managed-settings policies not being enforced against third-party-provider and API-key sessions
+ * Fixed GNOME Terminal right-click and middle-click paste not inserting text
+ * Fixed `CLAUDE_CODE_SUBAGENT_MODEL` not being forwarded to child processes in multi-agent sessions
+ * Improved auto-updater reliability: native version checks and downloads now retry transient network failures instead of failing immediately
+ * Improved diff rendering performance for large file edits
--- a/checkpointing.md
+++ b/checkpointing.md
@@ -32,7 +32,11 @@
Rewind and summarize
-Press `Esc` twice (`Esc` \+ `Esc`) or use the `/rewind` command to open the rewind menu. A scrollable list shows each of your prompts from the session. Select the point you want to act on, then choose an action:
+Run `/rewind`, or press `Esc` twice when the prompt input is empty, to open the rewind menu.
+
+If the prompt input contains text, double `Esc` clears it instead of opening the menu. The cleared text is saved to your input history, so press `Up` to recall it after you finish in the rewind menu.
+
+The rewind menu lists each prompt you sent during the session. Select the point you want to act on, then choose an action:
* **Restore code and conversation** : revert both code and conversation to that point
* **Restore conversation** : rewind to that message while keeping current code
--- a/commands.md
+++ b/commands.md
@@ -22,7 +22,7 @@
The table below lists all the commands included in Claude Code. Entries marked **[Skill](</docs/en/skills#bundled-skills>)** are bundled skills. They use the same mechanism as skills you write yourself: a prompt handed to Claude, which Claude can also invoke automatically when relevant. Everything else is a built-in command whose behavior is coded into the CLI. To add your own commands, see [skills](</docs/en/skills>). In the table below, `<arg>` indicates a required argument and `[arg]` indicates an optional one.
-Not every command appears for every user. Availability depends on your platform, plan, and environment. For example, `/desktop` only shows on macOS and Windows, and `/upgrade` only shows on Pro and Max plans.
+Not every command appears for every user. Availability depends on your platform, plan, and environment. For example, `/desktop` only shows on macOS and Windows when signed in with a Claude subscription, and `/upgrade` only shows on Pro and Max plans.
Command| Purpose
---|---
@@ -43,7 +43,7 @@
`/copy [N]`| Copy the last assistant response to clipboard. Pass a number `N` to copy the Nth-latest response: `/copy 2` copies the second-to-last. When code blocks are present, shows an interactive picker to select individual blocks or the full response. Press `w` in the picker to write the selection to a file instead of the clipboard, which is useful over SSH
`/cost`| Alias for `/usage`
`/debug [description]`| **[Skill](</docs/en/skills#bundled-skills>).** Enable debug logging for the current session and troubleshoot issues by reading the session debug log. Debug logging is off by default unless you started with `claude --debug`, so running `/debug` mid-session starts capturing logs from that point forward. Optionally describe the issue to focus the analysis
-`/desktop`| Continue the current session in the Claude Code Desktop app. macOS and Windows only. Alias: `/app`
+`/desktop`| Continue the current session in the Claude Code Desktop app. Requires macOS or Windows and a Claude subscription. Alias: `/app`
`/diff`| Open an interactive diff viewer showing uncommitted changes and per-turn diffs. Use left/right arrows to switch between the current git diff and individual Claude turns, and up/down to browse files
`/doctor`| Diagnose and verify your Claude Code installation and settings. Results show with status icons. Press `f` to have Claude fix any reported issues
`/effort [level|auto]`| Set the model [effort level](</docs/en/model-config#adjust-effort-level>). Accepts `low`, `medium`, `high`, `xhigh`, or `max`; available levels depend on the model and `max` is session-only. `auto` resets to the model default. Without an argument, opens an interactive slider; use left and right arrows to pick a level and `Enter` to apply. Takes effect immediately without waiting for the current response to finish
@@ -65,7 +65,7 @@
`/keybindings`| Open or create your keybindings configuration file
`/login`| Sign in to your Anthropic account
`/logout`| Sign out from your Anthropic account
-`/loop [interval] [prompt]`| **[Skill](</docs/en/skills#bundled-skills>).** Run a prompt repeatedly while the session stays open. Omit the interval and Claude self-paces between iterations. Omit the prompt and Claude runs an autonomous maintenance check, or the prompt in `.claude/loop.md` if present. Example: `/loop 5m check if the deploy finished`. See [Run prompts on a schedule](</docs/en/scheduled-tasks>). Alias: `/proactive`
+`/loop [interval] [prompt]`| **[Skill](</docs/en/skills#bundled-skills>).** Run a prompt repeatedly while the session stays open. Omit the interval and Claude self-paces between iterations. Omit the prompt and, [where available](</docs/en/scheduled-tasks#run-the-built-in-maintenance-prompt>), Claude runs an autonomous maintenance check or the prompt in `.claude/loop.md`. Example: `/loop 5m check if the deploy finished`. See [Run prompts on a schedule](</docs/en/scheduled-tasks>). Alias: `/proactive`
`/mcp`| Manage MCP server connections and OAuth authentication
`/memory`| Edit `CLAUDE.md` memory files, enable or disable [auto-memory](</docs/en/memory#auto-memory>), and view auto-memory entries
`/mobile`| Show QR code to download the Claude mobile app. Aliases: `/ios`, `/android`
--- a/desktop.md
+++ b/desktop.md
@@ -55,7 +55,7 @@
Use the prompt box
-Type what you want Claude to do and press **Enter** to send. Claude reads your project files, makes changes, and runs commands based on your permission mode. You can interrupt Claude at any point: click the stop button or type your correction and press **Enter**. Claude stops what it’s doing and adjusts based on your input. The **+** button next to the prompt box gives you access to file attachments, skills, connectors, and plugins.
+Type what you want Claude to do and press **Enter** to send. Claude reads your project files, makes changes, and runs commands based on your permission mode. You can redirect Claude at any point: click the stop button to interrupt immediately, or type a correction and press **Enter** to send it without stopping the running action. Claude reads the correction as soon as the current action completes and adjusts before its next step. The **+** button next to the prompt box gives you access to file attachments, skills, connectors, and plugins.
###
@@ -718,7 +718,7 @@
Coming from the CLI?
-If you already use the Claude Code CLI, Desktop runs the same underlying engine with a graphical interface. You can run both simultaneously on the same machine, even on the same project. Each maintains separate session history, but they share configuration and project memory via CLAUDE.md files. To move a CLI session into Desktop, run `/desktop` in the terminal. Claude saves your session and opens it in the desktop app, then exits the CLI. This command is available on macOS and Windows only.
+If you already use the Claude Code CLI, Desktop runs the same underlying engine with a graphical interface. You can run both simultaneously on the same machine, even on the same project. Each maintains separate session history, but they share configuration and project memory via CLAUDE.md files. To move a CLI session into Desktop, run `/desktop` in the terminal. Claude saves your session and opens it in the desktop app, then exits the CLI. This command is available on macOS and Windows when you are signed in with a Claude subscription. It is not available with API key authentication or on Bedrock, Vertex, or Foundry.
When to use Desktop vs CLI: use Desktop when you want to manage parallel sessions in one window, arrange panes side by side, or review changes visually. Use the CLI when you need scripting, automation, or prefer a terminal workflow.
--- a/desktop-quickstart.md
+++ b/desktop-quickstart.md
@@ -103,7 +103,7 @@
Now what?
-You’ve made your first edit. For the full reference on everything Desktop can do, see [Use Claude Code Desktop](</docs/en/desktop>). Here are some things to try next. **Interrupt and steer.** You can interrupt Claude at any point. If it’s going down the wrong path, click the stop button or type your correction and press **Enter**. Claude stops what it’s doing and adjusts based on your input. You don’t have to wait for it to finish or start over. **Give Claude more context.** Type `@filename` in the prompt box to pull a specific file into the conversation, attach images and PDFs using the attachment button, or drag and drop files directly into the prompt. The more context Claude has, the better the results. See [Add files and context](</docs/en/desktop#add-files-and-context-to-prompts>). **Use skills for repeatable tasks.** Type `/` or click **+** → **Slash commands** to browse [built-in commands](</docs/en/commands>), [custom skills](</docs/en/skills>), and plugin skills. Skills are reusable prompts you can invoke whenever you need them, like code review checklists or deployment steps. **Review changes before committing.** After Claude edits files, a `+12 -1` indicator appears. Click it to open the [diff view](</docs/en/desktop#review-changes-with-diff-view>), review modifications file by file, and comment on specific lines. Claude reads your comments and revises. Click **Review code** to have Claude evaluate the diffs itself and leave inline suggestions. **Adjust how much control you have.** Your [permission mode](</docs/en/desktop#choose-a-permission-mode>) controls the balance. Ask permissions (default) requires approval before every edit. Auto accept edits auto-accepts file edits for faster iteration. Plan mode lets Claude map out an approach without touching any files, which is useful before a large refactor. **Add plugins for more capabilities.** Click the **+** button next to the prompt box and select **Plugins** to browse and install [plugins](</docs/en/desktop#install-plugins>) that add skills, agents, MCP servers, and more. **Arrange your workspace.** Drag the chat, diff, terminal, file, and preview panes into whatever layout you want. Open the terminal with **Ctrl+`** to run commands alongside your session, or click a file path to open it in the file pane. See [Arrange your workspace](</docs/en/desktop#arrange-your-workspace>). **Preview your app.** Click the **Preview** dropdown to run your dev server directly in the desktop. Claude can view the running app, test endpoints, inspect logs, and iterate on what it sees. See [Preview your app](</docs/en/desktop#preview-your-app>). **Track your pull request.** After opening a PR, Claude Code monitors CI check results and can automatically fix failures or merge the PR once all checks pass. See [Monitor pull request status](</docs/en/desktop#monitor-pull-request-status>). **Put Claude on a schedule.** Set up [scheduled tasks](</docs/en/desktop-scheduled-tasks>) to run Claude automatically on a recurring basis: a daily code review every morning, a weekly dependency audit, or a briefing that pulls from your connected tools. **Scale up when you’re ready.** Open [parallel sessions](</docs/en/desktop#work-in-parallel-with-sessions>) from the sidebar to work on multiple tasks at once, each in its own Git worktree, and open the [tasks pane](</docs/en/desktop#watch-background-tasks>) to watch the subagents and background commands a session has running. Open a [side chat](</docs/en/desktop#ask-a-side-question-without-derailing-the-session>) to ask a question without derailing the main thread. Send [long-running work to the cloud](</docs/en/desktop#run-long-running-tasks-remotely>) so it continues even if you close the app, or [continue a session on the web or in your IDE](</docs/en/desktop#continue-in-another-surface>) if a task takes longer than expected. [Connect external tools](</docs/en/desktop#extend-claude-code>) like GitHub, Slack, and Linear to bring your workflow together.
+You’ve made your first edit. For the full reference on everything Desktop can do, see [Use Claude Code Desktop](</docs/en/desktop>). Here are some things to try next. **Interrupt and steer.** You can redirect Claude at any point. Click the stop button to interrupt immediately, or type a correction and press **Enter** to send it without stopping the running action. Either way, you don’t have to wait for it to finish or start over. **Give Claude more context.** Type `@filename` in the prompt box to pull a specific file into the conversation, attach images and PDFs using the attachment button, or drag and drop files directly into the prompt. The more context Claude has, the better the results. See [Add files and context](</docs/en/desktop#add-files-and-context-to-prompts>). **Use skills for repeatable tasks.** Type `/` or click **+** → **Slash commands** to browse [built-in commands](</docs/en/commands>), [custom skills](</docs/en/skills>), and plugin skills. Skills are reusable prompts you can invoke whenever you need them, like code review checklists or deployment steps. **Review changes before committing.** After Claude edits files, a `+12 -1` indicator appears. Click it to open the [diff view](</docs/en/desktop#review-changes-with-diff-view>), review modifications file by file, and comment on specific lines. Claude reads your comments and revises. Click **Review code** to have Claude evaluate the diffs itself and leave inline suggestions. **Adjust how much control you have.** Your [permission mode](</docs/en/desktop#choose-a-permission-mode>) controls the balance. Ask permissions (default) requires approval before every edit. Auto accept edits auto-accepts file edits for faster iteration. Plan mode lets Claude map out an approach without touching any files, which is useful before a large refactor. **Add plugins for more capabilities.** Click the **+** button next to the prompt box and select **Plugins** to browse and install [plugins](</docs/en/desktop#install-plugins>) that add skills, agents, MCP servers, and more. **Arrange your workspace.** Drag the chat, diff, terminal, file, and preview panes into whatever layout you want. Open the terminal with **Ctrl+`** to run commands alongside your session, or click a file path to open it in the file pane. See [Arrange your workspace](</docs/en/desktop#arrange-your-workspace>). **Preview your app.** Click the **Preview** dropdown to run your dev server directly in the desktop. Claude can view the running app, test endpoints, inspect logs, and iterate on what it sees. See [Preview your app](</docs/en/desktop#preview-your-app>). **Track your pull request.** After opening a PR, Claude Code monitors CI check results and can automatically fix failures or merge the PR once all checks pass. See [Monitor pull request status](</docs/en/desktop#monitor-pull-request-status>). **Put Claude on a schedule.** Set up [scheduled tasks](</docs/en/desktop-scheduled-tasks>) to run Claude automatically on a recurring basis: a daily code review every morning, a weekly dependency audit, or a briefing that pulls from your connected tools. **Scale up when you’re ready.** Open [parallel sessions](</docs/en/desktop#work-in-parallel-with-sessions>) from the sidebar to work on multiple tasks at once, each in its own Git worktree, and open the [tasks pane](</docs/en/desktop#watch-background-tasks>) to watch the subagents and background commands a session has running. Open a [side chat](</docs/en/desktop#ask-a-side-question-without-derailing-the-session>) to ask a question without derailing the main thread. Send [long-running work to the cloud](</docs/en/desktop#run-long-running-tasks-remotely>) so it continues even if you close the app, or [continue a session on the web or in your IDE](</docs/en/desktop#continue-in-another-surface>) if a task takes longer than expected. [Connect external tools](</docs/en/desktop#extend-claude-code>) like GitHub, Slack, and Linear to bring your workflow together.
##
Show diff (130 lines)
--- a/hooks.md
+++ b/hooks.md
@@ -91,7 +91,7 @@
}
}'
else
- exit 0 # allow the command
+ exit 0 # no decision; normal permission flow applies
fi
Now suppose Claude Code decides to run `Bash "rm -rf /tmp/build"`. Here’s what happens:
@@ -130,7 +130,7 @@
}
}
-If the command had been a safer `rm` variant like `rm file.txt`, the script would hit `exit 0` instead, which tells Claude Code to allow the tool call with no further action.
+If the command had been a safer `rm` variant like `rm file.txt`, the script would hit `exit 0` instead. Exit code 0 with no output means the hook has no decision to report, so the tool call continues through the normal [permission flow](</docs/en/permissions>). The hook can deny the call, but staying silent doesn’t approve it.
5
@@ -605,7 +605,7 @@
exit 2 # Blocking error: tool call is prevented
fi
- exit 0 # Success: tool call proceeds
+ exit 0 # No decision: the normal permission flow applies
For most hook events, only exit code 2 blocks the action. Claude Code treats exit code 1 as a non-blocking error and proceeds with the action, even though 1 is the conventional Unix failure code. If your hook is meant to enforce a policy, use `exit 2`. The exception is `WorktreeCreate`, where any non-zero exit code aborts worktree creation.
@@ -671,7 +671,7 @@
JSON output
-Exit codes let you allow or block, but JSON output gives you finer-grained control. Instead of exiting with code 2 to block, exit 0 and print a JSON object to stdout. Claude Code reads specific fields from that JSON to control behavior, including decision control for blocking, allowing, or escalating to the user.
+Exit codes only let you block or stay silent, but JSON output gives you finer-grained control. Instead of exiting with code 2 to block, exit 0 and print a JSON object to stdout. Claude Code reads specific fields from that JSON to control behavior, including decision control for blocking, allowing, or escalating to the user.
You must choose one approach per hook, not both: either use exit codes alone for signaling, or exit 0 and print JSON for structured control. Claude Code only processes JSON on exit 0. If you exit 2, any JSON is ignored.
@@ -685,7 +685,7 @@
---|---|---
`continue`| `true`| If `false`, Claude stops processing entirely after the hook runs. Takes precedence over any event-specific decision fields
`stopReason`| none| Message shown to the user when `continue` is `false`. Not shown to Claude
-`suppressOutput`| `false`| If `true`, omits stdout from the debug log
+`suppressOutput`| `false`| If `true`, hides the hook’s stdout from the transcript. Stdout still appears in the debug log
`systemMessage`| none| Warning message shown to the user
`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
@@ -768,6 +768,7 @@
WorktreeCreate| path return| Command hook prints path on stdout; HTTP hook returns `hookSpecificOutput.worktreePath`. Hook failure or missing path fails creation
Elicitation| `hookSpecificOutput`| `action` (accept/decline/cancel), `content` (form field values for accept)
ElicitationResult| `hookSpecificOutput`| `action` (accept/decline/cancel), `content` (form field values override)
+SessionStart, Setup, SubagentStart| Context only| `hookSpecificOutput.additionalContext` adds context for Claude. SessionStart also accepts `initialUserMessage` and `watchPaths`. No blocking or decision control
WorktreeRemove, Notification, SessionEnd, PostCompact, InstructionsLoaded, StopFailure, CwdChanged, FileChanged| None| No decision control. Used for side effects like logging or cleanup
Here are examples of each pattern in action:
@@ -862,6 +863,8 @@
Field| Description
---|---
`additionalContext`| String added to Claude’s context at the start of the conversation, before the first prompt. See Add context for Claude for how the text is delivered and what to put in it
+`initialUserMessage`| String used as the first user message of the session. Applies in [non-interactive mode](</docs/en/headless>) (`-p`), where it becomes the first turn even if no prompt is provided. If a prompt is provided, it follows as the next turn. Unlike `additionalContext`, which attaches to an existing turn, this creates the turn
+`watchPaths`| Array of absolute paths to watch for FileChanged events during this session
{
"hookSpecificOutput": {
@@ -1050,6 +1053,7 @@
`reason`| Shown to the user when `decision` is `"block"`. Not added to context
`additionalContext`| String added to Claude’s context alongside the submitted prompt. See Add context for Claude
`sessionTitle`| Sets the session title. Use to name sessions automatically based on the prompt content
+`suppressOriginalPrompt`| If `true` when `decision` is `"block"`, omits the original prompt text from the block message shown to the user
{
"decision": "block",
@@ -1406,7 +1410,7 @@
`addRules`| `rules`, `behavior`, `destination`| Adds permission rules. `rules` is an array of `{toolName, ruleContent?}` objects. Omit `ruleContent` to match the whole tool. `behavior` is `"allow"`, `"deny"`, or `"ask"`
`replaceRules`| `rules`, `behavior`, `destination`| Replaces all rules of the given `behavior` at the `destination` with the provided `rules`
`removeRules`| `rules`, `behavior`, `destination`| Removes matching rules of the given `behavior`
-`setMode`| `mode`, `destination`| Changes the permission mode. Valid modes are `default`, `acceptEdits`, `dontAsk`, `bypassPermissions`, and `plan`
+`setMode`| `mode`, `destination`| Changes the permission mode. Valid modes are `default`, `auto`, `acceptEdits`, `dontAsk`, `bypassPermissions`, and `plan`
`addDirectories`| `directories`, `destination`| Adds working directories. `directories` is an array of path strings
`removeDirectories`| `directories`, `destination`| Removes working directories
@@ -1945,7 +1949,7 @@
`tool`| MCP tool name. Present only for `monitor` and `MCP task` tasks
`name`| Workflow name. Present only for `workflow` tasks
-Each entry in `session_crons` describes one session-scoped scheduled wakeup, sourced from `CronCreate` and `/loop`:
+Each entry in `session_crons` describes one session-scoped scheduled wakeup, sourced from `CronCreate`, `ScheduleWakeup`, and `/loop`:
Field| Description
---|---
@@ -2575,6 +2579,7 @@
In addition to command, HTTP, and MCP tool hooks, Claude Code supports prompt-based hooks (`type: "prompt"`) that use an LLM to evaluate whether to allow or block an action, and agent hooks (`type: "agent"`) that spawn an agentic verifier with tool access. Not all events support every hook type. Events that support all five hook types (`command`, `http`, `mcp_tool`, `prompt`, and `agent`):
+ * `PermissionDenied`
* `PermissionRequest`
* `PostToolBatch`
* `PostToolUse`
@@ -2584,6 +2589,7 @@
* `SubagentStop`
* `TaskCompleted`
* `TaskCreated`
+ * `TeammateIdle`
* `UserPromptExpansion`
* `UserPromptSubmit`
@@ -2596,13 +2602,11 @@
* `FileChanged`
* `InstructionsLoaded`
* `Notification`
- * `PermissionDenied`
* `PostCompact`
* `PreCompact`
* `SessionEnd`
* `StopFailure`
* `SubagentStart`
- * `TeammateIdle`
* `WorktreeCreate`
* `WorktreeRemove`
@@ -2676,7 +2680,9 @@
* `PostToolUse`: by default the turn ends and the reason appears in the chat as a warning line. Set `continueOnBlock: true` to feed the reason back to Claude and continue the turn instead
* `PostToolBatch`, `UserPromptSubmit`, and `UserPromptExpansion`: the turn ends and the reason appears as a warning line. These events end the turn on `decision: "block"` regardless of `continue`
* `PostToolUseFailure`, `TaskCreated`, and `TaskCompleted`: the reason is returned to Claude as a tool error, similar to `PreToolUse`
+ * `TeammateIdle`: by default the teammate stops and the reason appears as a warning line. Set `continueOnBlock: true` to feed the reason back to the teammate and keep it working instead
* `PermissionRequest`: `ok: false` has no effect. To deny an approval from a hook, use a command hook returning `hookSpecificOutput.decision.behavior: "deny"`
+ * `PermissionDenied`: `ok: false` has no effect because the denial already happened. The only output this event reads is `hookSpecificOutput.retry`, which prompt and agent hooks cannot set — they run on this event, but their output is discarded. Use a command hook to return `retry`
If you need finer control on any event, use a command hook with the per-event fields described in Decision control.
--- a/hooks-guide.md
+++ b/hooks-guide.md
@@ -530,11 +530,11 @@
exit 2 # exit 2 = block the action
fi
- exit 0 # exit 0 = let it proceed
+ exit 0 # exit 0 = no decision; the normal permission flow applies
The exit code determines what happens next:
- * **Exit 0** : the action proceeds. For `UserPromptSubmit`, `UserPromptExpansion`, and `SessionStart` hooks, anything you write to stdout is added to Claude’s context.
+ * **Exit 0** : the hook reports no objection and the action proceeds normally. For a `PreToolUse` hook this doesn’t approve the tool call: the normal [permission flow](</docs/en/permissions>) still applies. For `UserPromptSubmit`, `UserPromptExpansion`, and `SessionStart` hooks, anything you write to stdout is added to Claude’s context.
* **Exit 2** : the action is blocked. Write a reason to stderr, and Claude receives it as feedback so it can adjust. Some events cannot be blocked: for `SessionStart`, `Setup`, `Notification`, and others, exit 2 shows stderr to the user and execution continues. See [exit code 2 behavior per event](</docs/en/hooks#exit-code-2-behavior-per-event>) for the full list.
* **Any other exit code** : the action proceeds. The transcript shows a `<hook name> hook error` notice followed by the first line of stderr; the full stderr goes to the [debug log](</docs/en/hooks#debug-hooks>).
@@ -544,7 +544,7 @@
Structured JSON output
-Exit codes give you two options: allow or block. For more control, exit 0 and print a JSON object to stdout instead.
+Exit codes only let you block or stay silent. For more control, exit 0 and print a JSON object to stdout instead.
Use exit 2 to block with a stderr message, or exit 0 with JSON for structured control. Don’t mix them: Claude Code ignores JSON when you exit 2.
--- a/how-claude-code-works.md
+++ b/how-claude-code-works.md
@@ -219,7 +219,10 @@
Interrupt and steer
-You can interrupt Claude at any point. If it’s going down the wrong path, just type your correction and press Enter. Claude will stop what it’s doing and adjust its approach based on your input. You don’t have to wait for it to finish or start over.
+You can redirect Claude at any point without waiting for the turn to finish or starting over:
+
+ * **Press`Esc`** to stop Claude immediately. The running tool call is canceled and Claude waits for your next instruction.
+ * **Type a correction and press`Enter`** to send it without stopping the running tool. Claude reads it as soon as the current action completes and adjusts before deciding its next step.
###
--- a/interactive-mode.md
+++ b/interactive-mode.md
@@ -26,7 +26,7 @@
Shortcut| Description| Context
---|---|---
-`Ctrl+C`| Cancel current input or generation| Standard interrupt
+`Ctrl+C`| Interrupt, or clear input| Interrupts a running operation. If nothing is running, the first press clears the prompt input and a second press exits Claude Code
`Ctrl+X Ctrl+K`| Kill all running [background subagents](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) in this session. Press twice within 3 seconds to confirm| Subagent control
`Ctrl+D`| Exit Claude Code session| EOF signal
`Ctrl+G` or `Ctrl+X Ctrl+E`| Open in default text editor| Edit your prompt or custom response in your default text editor. `Ctrl+X Ctrl+E` is the readline-native binding. Turn on Show last response in external editor in `/config` to prepend Claude’s previous reply as `#`-commented context above your prompt; the comment block is stripped when you save
@@ -39,7 +39,7 @@
`Left/Right arrows`| Cycle through dialog tabs| Navigate between tabs in permission dialogs and menus
`Up/Down arrows` or `Ctrl+P`/`Ctrl+N`| Move cursor or navigate command history| In multiline input, first moves the cursor within the prompt. Once the cursor is already on the top or bottom edge, pressing again navigates command history
`Esc`| Interrupt Claude| Stop the current response or tool call mid-turn so you can redirect. Claude keeps the work done so far
-`Esc` \+ `Esc`| Rewind or summarize| Restore code and/or conversation to a previous point, or summarize from a selected message
+`Esc` \+ `Esc`| Clear input draft, or rewind| When the prompt input contains text, double `Esc` clears it and saves the draft to history so `Up` recalls it. When the input is empty, double `Esc` opens the [rewind menu](</docs/en/checkpointing>) to restore or summarize code and conversation from a previous point
`Shift+Tab` or `Alt+M` (some configurations)| Cycle permission modes| Cycle through `default`, `acceptEdits`, `plan`, and any modes you have enabled, such as `auto` or `bypassPermissions`. See [permission modes](</docs/en/permission-modes>).
`Option+P` (macOS) or `Alt+P` (Windows/Linux)| Switch model| Switch models without clearing your prompt
`Option+T` (macOS) or `Alt+T` (Windows/Linux)| Toggle extended thinking| Enable or disable extended thinking mode. As of v2.1.132 this shortcut works on macOS without configuring Option as Meta
--- a/permissions.md
+++ b/permissions.md
@@ -379,6 +379,7 @@
`sandbox.filesystem.allowManagedReadPathsOnly`| When `true`, only `filesystem.allowRead` paths from managed settings are respected. `denyRead` still merges from all sources
`sandbox.network.allowManagedDomainsOnly`| When `true`, only `allowedDomains` and `WebFetch(domain:...)` allow rules from managed settings are respected. Non-allowed domains are blocked automatically without prompting the user. Denied domains still merge from all sources
`strictKnownMarketplaces`| Controls which plugin marketplace sources users can add and install plugins from. See [managed marketplace restrictions](</docs/en/plugin-marketplaces#managed-marketplace-restrictions>)
+`strictPluginOnlyCustomization`| Block skills, agents, hooks, and MCP servers from user and project sources, so they can only come from plugins or managed settings. `true` locks all four surfaces; an array such as `["skills", "hooks"]` locks only the named ones. See [`strictPluginOnlyCustomization`](</docs/en/settings#strictpluginonlycustomization>)
`wslInheritsWindowsSettings`| When `true` in the Windows HKLM registry key or `C:\Program Files\ClaudeCode\managed-settings.json`, WSL reads managed settings from the Windows policy chain in addition to `/etc/claude-code`. See [Settings files](</docs/en/settings#settings-files>)
`disableBypassPermissionsMode` is typically placed in managed settings to enforce organizational policy, but it works from any scope. A user can set it in their own settings to lock themselves out of bypass mode.
Show diff (147 lines)
--- a/plugin-hints.md
+++ b/plugin-hints.md
@@ -0,0 +1,144 @@
+> ## Documentation Index
+>
+> Fetch the complete documentation index at: <https://code.claude.com/docs/llms.txt>
+>
+> Use this file to discover all available pages before exploring further.
+
+If you maintain a CLI or SDK and have a plugin in the official Anthropic marketplace, your tool can prompt Claude Code users to install that plugin. Your CLI writes a one-line marker to stderr when it detects it is running inside Claude Code. Claude Code reads the marker, strips it from the output, and shows the user a one-time install prompt. Claude Code strips the hint line from the command output before sending it to the model, so the marker never appears in the conversation and is not counted toward token usage. The protocol requires no extra commands and does not change what your CLI prints for users outside Claude Code. This page is for CLI and SDK maintainers. If you are looking to install plugins, see [Discover and install plugins](</docs/en/discover-plugins>).
+
+##
+
+
+
+How it works
+
+Claude Code sets the [`CLAUDECODE`](</docs/en/env-vars>) environment variable to `1` for every command it runs through the Bash and PowerShell tools, and for [hook](</docs/en/hooks>) commands. When your CLI sees that variable, it writes a self-closing `<claude-code-hint />` tag to stderr. In hook commands the hint tag is stripped and ignored. Only Bash and PowerShell tool output triggers the install prompt. When Claude Code receives the command output, it:
+
+ 1. Scans for hint lines and removes them before the output reaches the model
+ 2. Checks that the hint targets a plugin in an official Anthropic marketplace
+ 3. Checks that the plugin is not already installed and has not been prompted before
+ 4. Shows the user an install prompt that names the command that emitted the hint
+
+Claude Code never installs a plugin automatically. The user always confirms.
+
+##
+
+
+
+Emit the hint
+
+Gate emission on the `CLAUDECODE` environment variable so the marker never appears in a human user’s terminal. Then write the tag to stderr on its own line. The following examples emit a hint for a plugin named `example-cli` in the official marketplace:
+
+Node.js
+
+Python
+
+Go
+
+Shell
+
+ if (process.env.CLAUDECODE) {
+ process.stderr.write(
+ '<claude-code-hint v="1" type="plugin" value="example-cli@claude-plugins-official" />\n',
+ )
+ }
+
+Replace `example-cli` with your plugin’s name in the official marketplace.
+
+##
+
+
+
+Choose where to emit
+
+You control which code paths emit the hint. Claude Code deduplicates by plugin, so emitting on every invocation has no downside. Touchpoints that work well include:
+
+Placement| Why it works
+---|---
+`--help` output| Claude often runs help when exploring an unfamiliar CLI
+Unknown-subcommand errors| Reaches the moment Claude is confused about your interface
+Login or auth success| The user is already in a setup mindset
+First-run welcome message| A natural onboarding moment
+
+##
+
+
+
+What the user sees
+
+When the hint passes all checks, Claude Code shows a prompt like the following:
+
+ ─────────────────────────────────────────────────────────────
+ Plugin Recommendation
+
+ The example-cli command suggests installing a plugin.
+
+ Plugin: example-cli
+ Marketplace: claude-plugins-official
+ Official integration for example-cli deployments
+
+ Would you like to install it?
+ ❯ 1. Yes, install example-cli
+ 2. No
+ 3. No, and don't show plugin installation hints again
+
+ ─────────────────────────────────────────────────────────────
+
+The prompt names the command that produced the hint so users can spot a mismatch between the tool and the plugin it recommends. If the user does not respond within 30 seconds, the prompt dismisses as **No**. Prompt frequency is bounded:
+
+ * **Once per plugin** : after the prompt is shown, Claude Code records the plugin and never prompts for it again, regardless of the user’s answer.
+ * **Once per session** : across all CLIs on the machine, at most one hint prompt appears per Claude Code session.
+
+Selecting **Yes** installs the plugin to user scope. Selecting **No, and don’t show plugin installation hints again** disables all future hint prompts for the user.
+
+##
+
+
+
+Hint format
+
+The hint is a self-closing tag with three required attributes.
+
+ <claude-code-hint v="1" type="plugin" value="example-cli@claude-plugins-official" />
+
+Attribute| Required| Description
+---|---|---
+`v`| Yes| Protocol version. `1` is the only supported value
+`type`| Yes| Hint kind. `plugin` is the only supported value
+`value`| Yes| Plugin identifier in `name@marketplace` form
+
+Attribute values may be quoted with double quotes or left unquoted. Unquoted values cannot contain whitespace. Escape sequences are not supported.
+
+##
+
+
+
+Requirements
+
+Claude Code enforces two conditions before acting on a hint. Hints that fail either check are dropped:
+
+ * **Own line** : the tag must occupy its own line. A tag embedded mid-line, for example inside a log statement, is ignored. Leading and trailing whitespace on the line is allowed.
+ * **Official marketplace** : the `value` must reference a plugin in an Anthropic-controlled marketplace such as `claude-plugins-official`. Hints that point to other marketplaces are silently dropped.
+
+The hint line is always removed from the output before it reaches the model, even when the version or type is unrecognized, so the marker is never counted toward token usage. The remaining guidance is recommended but not enforced. Claude Code cannot observe whether your CLI follows it:
+
+ * **Write to stderr** : stderr keeps the tag out of shell pipelines such as `example-cli deploy | jq`. Claude Code scans both streams, so stdout also works.
+ * **Gate on`CLAUDECODE`**: only emit when the `CLAUDECODE` environment variable is set. This prevents the marker from appearing to users running your CLI directly.
+
+##
+
+
+
+Get your plugin into the official marketplace
+
+The hint protocol only takes effect for plugins listed in the official Anthropic marketplace, `claude-plugins-official`. Anthropic curates that marketplace at its discretion, and the in-app submission forms add plugins to the [community marketplace](</docs/en/plugins#submit-your-plugin-to-the-community-marketplace>) instead, which the hint protocol does not check. If you are working with an Anthropic partner contact, reach out to them to coordinate an official-marketplace listing.
+
+##
+
+
+
+See also
+
+ * [Create plugins](</docs/en/plugins>): build the plugin your CLI recommends
+ * [Create and distribute a plugin marketplace](</docs/en/plugin-marketplaces>): host plugins outside the official marketplace
+ * [Environment variables](</docs/en/env-vars>): full reference for `CLAUDECODE` and related variables
--- a/plugin-marketplaces.md
+++ b/plugin-marketplaces.md
@@ -961,7 +961,7 @@
* Verify the marketplace URL is accessible
* Check that `.claude-plugin/marketplace.json` exists at the specified path
- * Ensure JSON syntax is valid and frontmatter is well-formed using `claude plugin validate` or `/plugin validate`
+ * Ensure JSON syntax is valid using `claude plugin validate` or `/plugin validate`. To check skill, agent, and command frontmatter, run the command against each plugin directory
* For private repositories, confirm you have access permissions
###
@@ -970,7 +970,7 @@
Marketplace validation errors
-Run `claude plugin validate .` or `/plugin validate .` from your marketplace directory to check for issues. The validator checks `plugin.json`, skill/agent/command frontmatter, and `hooks/hooks.json` for syntax and schema errors. Common errors:
+Run `claude plugin validate .` or `/plugin validate .` from your marketplace directory to check for issues. When pointed at a marketplace directory, the validator checks `marketplace.json` only: schema, duplicate plugin names, source path traversal, and version mismatches against each referenced `plugin.json`. To validate an individual plugin’s `plugin.json` and its skill, agent, command, and hook files, run the command against the plugin directory itself, for example `claude plugin validate ./plugins/my-plugin`. Common errors:
Error| Cause| Solution
---|---|---
@@ -978,8 +978,8 @@
`Invalid JSON syntax: Unexpected token...`| JSON syntax error in marketplace.json| Check for missing commas, extra commas, or unquoted strings
`Duplicate plugin name "x" found in marketplace`| Two plugins share the same name| Give each plugin a unique `name` value
`plugins[0].source: Path contains ".."`| Source path contains `..`| Use paths relative to the marketplace root without `..`. See Relative paths
-`YAML frontmatter failed to parse: ...`| Invalid YAML in a skill, agent, or command file| Fix the YAML syntax in the frontmatter block. At runtime this file loads with no metadata.
-`Invalid JSON syntax: ...` (hooks.json)| Malformed `hooks/hooks.json`| Fix JSON syntax. A malformed `hooks/hooks.json` prevents the entire plugin from loading.
+`YAML frontmatter failed to parse: ...`| Invalid YAML in a skill, agent, or command file| Fix the YAML syntax in the frontmatter block. At runtime this file loads with no metadata. Reported only when validating a plugin directory
+`Invalid JSON syntax: ...` (hooks.json)| Malformed `hooks/hooks.json`| Fix JSON syntax. A malformed `hooks/hooks.json` prevents the entire plugin from loading. Reported only when validating a plugin directory
**Warnings** (non-blocking):
--- a/prompt-library.md
+++ b/prompt-library.md
@@ -0,0 +1,62 @@
+> ## Documentation Index
+>
+> Fetch the complete documentation index at: <https://code.claude.com/docs/llms.txt>
+>
+> Use this file to discover all available pages before exploring further.
+
+This is a library of prompts to copy into Claude Code. Use it to explore ways of working you haven’t tried, or when you’re not sure where to start. The prompts are collected from various Anthropic guides, including [Common workflows](</docs/en/common-workflows>), [Best practices](</docs/en/best-practices>), and [How Anthropic teams use Claude Code](<https://claude.com/blog/how-anthropic-teams-use-claude-code>). They’re starting points rather than scripts. Open **Why this works** under any prompt to see the pattern behind it so you can write your own.
+
+##
+
+
+
+What makes these prompts work
+
+The prompts above share a few patterns. Recognizing them helps you adapt any prompt here to your own task. **Describe the outcome, not the steps.** Say what you want and let Claude find the files. The prompt below works without naming a single file path.
+
+ add rate limiting to the public API and make sure existing tests still pass
+
+**Give it a way to check its own work.** Ask for run, test, compare, or verify in the same prompt so Claude iterates instead of stopping after one attempt.
+
+ write the migration, run it against the dev database, and confirm the schema matches
+
+**Point at a reference.** Name an existing file, test, or pattern to match so the new code is consistent with what you already have.
+
+ add a settings page that follows the same layout as the profile page
+
+**State the measurable target.** When the goal is performance or coverage, give the metric and threshold so completion is unambiguous.
+
+ get the bundle size under 200KB and show me what you removed
+
+**Give it the artifact.** Paste errors, logs, screenshots, and plan output directly in the prompt, or type `@` to reference a file. Claude reads the source instead of your description of it.
+
+ why is the build failing? @build.log
+
+**Say how you want the answer.** Name the format, length, or audience so the explanation fits how you’ll use it. To make a format the default for every response, set an [output style](</docs/en/output-styles>).
+
+ explain how the payment retry logic works as an HTML page with a diagram, then open it in my browser
+
+For more on each pattern, see [best practices](</docs/en/best-practices>).
+
+##
+
+
+
+Where these come from
+
+These prompts are based on patterns from published Anthropic resources. Each card links to its source:
+
+ * [Common workflows](</docs/en/common-workflows>): step-by-step guides for the core tasks
+ * [Best practices](</docs/en/best-practices>): prompting patterns and project setup
+ * [How Anthropic teams use Claude Code](<https://claude.com/blog/how-anthropic-teams-use-claude-code>): real workflows from engineering, product, design, and data teams, with deep dives on [legal](<https://claude.com/blog/how-anthropic-uses-claude-legal>), [marketing](<https://claude.com/blog/how-anthropic-uses-claude-marketing>), and [cybersecurity](<https://claude.com/blog/how-anthropic-uses-claude-cybersecurity>)
+ * [Scaling agentic coding guide](<https://resources.anthropic.com/hubfs/Scaling%20agentic%20coding%20across%20your%20organization.pdf>): the enterprise adoption guide
+
+For video walkthroughs of these patterns, see the free [Claude Code in Action](<https://anthropic.skilljar.com/claude-code-in-action>) course on Anthropic Academy.
+
+##
+
+
+
+Related resources
+
+The prompts on this page are starting points. Once one works for your project, the next step is making it repeatable: save it as a [skill](</docs/en/skills>) so anyone on your team can run it as a `/command`, and record the conventions Claude learned in [CLAUDE.md](</docs/en/memory>) so every session starts with that context instead of Claude relearning it. For larger or riskier changes, [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) shows you the file list before any edits happen. If you’re introducing Claude Code across a team, see [administration](</docs/en/admin-setup>) for managed settings and policy, and [costs and usage](</docs/en/costs>) for how this work is billed on your plan.
--- a/scheduled-tasks.md
+++ b/scheduled-tasks.md
@@ -90,7 +90,7 @@
A bare `/loop` runs this prompt at a dynamically chosen interval. Add an interval, for example `/loop 15m`, to run it on a fixed schedule instead. To replace the built-in prompt with your own default, see Customize the default prompt with loop.md.
-On Bedrock, Vertex AI, and Microsoft Foundry, `/loop` with no prompt prints the usage message instead of starting the maintenance loop.
+The built-in maintenance prompt isn’t available to everyone yet, and isn’t supported on Bedrock, Vertex AI, or Microsoft Foundry. Where it isn’t active, `/loop` with no prompt prints the usage message instead.
###
@@ -115,6 +115,8 @@
quiet, say so in one line.
Edits to `loop.md` take effect on the next iteration, so you can refine the instructions while a loop is running. When no `loop.md` exists in either location, the loop falls back to the built-in maintenance prompt. Keep the file concise: content beyond 25,000 bytes is truncated.
+
+`loop.md` follows the same availability as the built-in maintenance prompt. Where the maintenance prompt isn’t active, `/loop` with no prompt prints the usage message and the file isn’t read.
###
Show diff (252 lines)
--- a/session-storage.md
+++ b/session-storage.md
@@ -0,0 +1,249 @@
+> ## Documentation Index
+>
+> Fetch the complete documentation index at: <https://code.claude.com/docs/llms.txt>
+>
+> Use this file to discover all available pages before exploring further.
+
+By default, the SDK writes session transcripts to JSONL files under `~/.claude/projects/` on the local filesystem. A `SessionStore` adapter lets you mirror those transcripts to your own backend, such as S3, Redis, or a database, so a session created on one host can be resumed on another. Common reasons to use a session store:
+
+ * **Multi-host deployments.** Serverless functions, autoscaled workers, and CI runners don’t share a filesystem. A shared store lets any replica resume any session.
+ * **Durability.** Local containers are ephemeral. A store backed by S3 or a database survives restarts and redeploys.
+ * **Compliance and audit.** Keep transcripts in storage you already govern, with your own retention rules, encryption, and access controls.
+
+##
+
+
+
+The `SessionStore` interface
+
+A `SessionStore` is an object with two required methods, `append` and `load`, and three optional methods. The SDK calls `append` to write transcript entries during a query and `load` to read them back for resume.
+
+TypeScript
+
+Python
+
+ // Exported from @anthropic-ai/claude-agent-sdk as
+ // SessionStore, SessionKey, SessionStoreEntry.
+
+ type SessionKey = {
+ projectKey: string;
+ sessionId: string;
+ subpath?: string;
+ };
+
+ type SessionStore = {
+ // Required
+ append(key: SessionKey, entries: SessionStoreEntry[]): Promise<void>;
+ load(key: SessionKey): Promise<SessionStoreEntry[] | null>;
+
+ // Optional
+ listSessions?(
+ projectKey: string,
+ ): Promise<Array<{ sessionId: string; mtime: number }>>;
+ delete?(key: SessionKey): Promise<void>;
+ listSubkeys?(key: {
+ projectKey: string;
+ sessionId: string;
+ }): Promise<string[]>;
+ };
+
+`SessionKey` addresses one transcript. `projectKey` is a stable, filesystem-safe encoding of the working directory, `sessionId` is the session UUID, and `subpath` is set when the entry belongs to a subagent transcript or sidecar file rather than the main conversation. Treat `subpath` as an opaque key suffix; it follows the on-disk layout, for example `subagents/agent-<id>`. When `subpath` is undefined the key refers to the main transcript.
+
+Method| Required| Called when
+---|---|---
+`append`| Yes| After each batch of transcript entries is written locally. Entries are JSON-safe objects, one per line in the local JSONL.
+`load`| Yes| Once before the subprocess spawns, when `resume` is set. Return `null` if the session is unknown.
+`listSessions`| No| By `listSessions({ sessionStore })` and by `query()`/`startup()` with `continue: true`. If undefined, those calls throw.
+`delete`| No| By `deleteSession({ sessionStore })`. Deleting the main key (no `subpath`) must cascade to all subkeys for that session. If undefined, deletion is a no-op, which suits append-only backends.
+`listSubkeys`| No| During resume, to discover subagent transcripts. If undefined, only the main transcript is restored.
+
+##
+
+
+
+Quick start
+
+The SDK ships an `InMemorySessionStore` for development and testing. The example below runs a query with the store attached, captures the session ID from the result message, then resumes from the store in a second `query()` call. The second call passes the same store instance plus `resume`, so the SDK loads the transcript from the store instead of the local filesystem:
+
+TypeScript
+
+Python
+
+ import { query, InMemorySessionStore } from "@anthropic-ai/claude-agent-sdk";
+
+ const store = new InMemorySessionStore();
+
+ let sessionId: string | undefined;
+ for await (const message of query({
+ prompt: "List the TypeScript files under src/",
+ options: { sessionStore: store },
+ })) {
+ if (message.type === "result") {
+ sessionId = message.session_id;
+ }
+ }
+
+ // Resume from the store. The agent has full context from the first call.
+ for await (const message of query({
+ prompt: "Summarize what those files do",
+ options: { sessionStore: store, resume: sessionId },
+ })) {
+ if (message.type === "result" && message.subtype === "success") {
+ console.log(message.result);
+ }
+ }
+
+##
+
+
+
+Write your own adapter
+
+Implement `append` and `load` against your backend. Add `listSessions`, `delete`, and `listSubkeys` if you want `listSessions()`, `deleteSession()`, and subagent resume to work against the store. Entries passed to `append` are typed as `SessionStoreEntry` (a `{ type: string; ... }` object). Treat them as opaque JSON-safe values: persist them in order and return them from `load` in the same order. `load` must return entries that are deep-equal to what was appended; byte-equal serialization is not required, so backends like Postgres `jsonb` that reorder object keys are fine.
+
+##
+
+
+
+Reference implementations
+
+The TypeScript SDK repository includes runnable reference adapters for S3, Redis, and Postgres under [`examples/session-stores/`](<https://github.com/anthropics/claude-agent-sdk-typescript/tree/main/examples/session-stores>). They are not published to npm; copy the `src/` file you need into your project and install the corresponding backend client.
+
+Adapter| Backend client| Storage model
+---|---|---
+[`S3SessionStore`](<https://github.com/anthropics/claude-agent-sdk-typescript/tree/main/examples/session-stores/s3>)| `@aws-sdk/client-s3`| One JSONL part file per `append()`; `load()` lists, sorts, and concatenates.
+[`RedisSessionStore`](<https://github.com/anthropics/claude-agent-sdk-typescript/tree/main/examples/session-stores/redis>)| `ioredis`| `RPUSH`/`LRANGE` list per transcript, plus a sorted-set session index.
+[`PostgresSessionStore`](<https://github.com/anthropics/claude-agent-sdk-typescript/tree/main/examples/session-stores/postgres>)| `pg`| One row per entry in a `jsonb` table, ordered by `BIGSERIAL`.
+
+Each adapter takes a pre-configured client instance, so you control credentials, TLS, region, and pooling. For example, with S3:
+
+TypeScript
+
+ import { query } from "@anthropic-ai/claude-agent-sdk";
+ import { S3Client } from "@aws-sdk/client-s3";
+ import { S3SessionStore } from "./S3SessionStore"; // copied from examples/session-stores/s3
+
+ const store = new S3SessionStore({
+ bucket: "my-claude-sessions",
+ prefix: "transcripts",
+ client: new S3Client({ region: "us-east-1" }),
+ });
+
+ for await (const message of query({
+ prompt: "Hello!",
+ options: { sessionStore: store },
+ })) {
+ if (message.type === "result" && message.subtype === "success") {
+ console.log(message.result);
+ }
+ }
+
+ // Later, possibly on a different host:
+ for await (const message of query({
+ prompt: "Continue where we left off",
+ options: { sessionStore: store, resume: "previous-session-id" },
+ })) {
+ // ...
+ }
+
+###
+
+
+
+Validate your adapter
+
+Both SDKs ship a conformance suite that asserts the behavioral contract `append`, `load`, and the optional methods must satisfy. Tests for optional methods skip automatically when those methods are not implemented. In TypeScript, copy [`shared/conformance.ts`](<https://github.com/anthropics/claude-agent-sdk-typescript/blob/main/examples/session-stores/shared/conformance.ts>) from the example directory into your test suite. In Python, the suite ships in the package:
+
+Python
+
+ import pytest
+ from claude_agent_sdk.testing import run_session_store_conformance
+
+ @pytest.mark.asyncio
+ async def test_my_store_conformance():
+ await run_session_store_conformance(MyRedisStore)
+
+##
+
+
+
+Behavior notes
+
+###
+
+
+
+Dual-write architecture
+
+The store is a mirror, not a replacement. The Claude Code subprocess always writes to local disk first; the SDK then forwards each batch to `append()`. If you want the local copy to be ephemeral, point `CLAUDE_CONFIG_DIR` at a temp directory in `options.env`. Because the mirror depends on local writes, `sessionStore` cannot be combined with `persistSession: false`; the SDK throws if you set both. It also throws if combined with `enableFileCheckpointing`, since file-history backup blobs are written directly to local disk and are not mirrored to the store.
+
+###
+
+
+
+Mirror writes are best-effort
+
+If `append()` rejects or times out, the error is logged, a `{ type: "system", subtype: "mirror_error" }` message is emitted into the iterator, and the query continues. The local transcript is already durable on disk, so a store outage does not interrupt the agent or lose data locally. Batches that fail are not retried, so monitor for `mirror_error` if you need to detect store data loss.
+
+###
+
+
+
+`getSessionMessages` returns the post-compaction chain
+
+`getSessionMessages({ sessionStore })` returns the linked message chain the agent would see on resume. After auto-compaction, earlier turns are replaced by a summary, so a session whose store holds 503 raw entries may return 18 messages from `getSessionMessages`. For the full raw history, including pre-compaction turns and metadata entries, call `store.load(key)` directly.
+
+###
+
+
+
+`forkSession` is not a byte copy
+
+`forkSession({ sessionStore })` reads the source entries, rewrites every `sessionId` field and remaps message UUIDs, then appends the transformed entries under a new key. An adapter-level copy or `CopyObject` shortcut would produce a transcript that still references the old session ID, so the SDK does not use one.
+
+###
+
+
+
+Subagent transcripts
+
+Subagent transcripts are mirrored under `subpath: "subagents/agent-<id>"`. `listSubagents({ sessionStore })` requires the adapter to implement `listSubkeys`; `getSubagentMessages({ sessionStore })` uses it when available but falls back to the direct subpath when it is undefined. Resume also calls `listSubkeys` to restore subagent files; without it, only the main transcript is materialized.
+
+###
+
+
+
+Retention
+
+The SDK never deletes from your store on its own. Retention is the adapter’s responsibility: implement TTLs, S3 lifecycle policies, or scheduled cleanup according to your compliance requirements. Local transcripts under `CLAUDE_CONFIG_DIR` are swept independently by the `cleanupPeriodDays` setting.
+
+##
+
+
+
+Supported on
+
+The following SDK functions accept a `sessionStore` option and operate against the store instead of the local filesystem when it is provided:
+
+ * [`query()`](</docs/en/agent-sdk/typescript#query>)
+ * [`startup()`](</docs/en/agent-sdk/typescript#startup>)
+ * [`listSessions()`](</docs/en/agent-sdk/typescript#listsessions>)
+ * [`getSessionInfo()`](</docs/en/agent-sdk/typescript#getsessioninfo>)
+ * [`getSessionMessages()`](</docs/en/agent-sdk/typescript#getsessionmessages>)
+ * [`renameSession()`](</docs/en/agent-sdk/typescript#renamesession>)
+ * [`tagSession()`](</docs/en/agent-sdk/typescript#tagsession>)
+ * [`deleteSession()`](</docs/en/agent-sdk/typescript>)
+ * [`forkSession()`](</docs/en/agent-sdk/typescript>)
+ * [`listSubagents()`](</docs/en/agent-sdk/typescript>)
+ * [`getSubagentMessages()`](</docs/en/agent-sdk/typescript>)
+
+##
+
+
+
+Related resources
+
+ * [Work with sessions](</docs/en/agent-sdk/sessions>): Continue, resume, and fork without a custom store
+ * [Host the SDK](</docs/en/agent-sdk/hosting>): Deployment patterns for multi-host environments
+ * [TypeScript `Options`](</docs/en/agent-sdk/typescript#options>): Full option reference
+ * [`examples/session-stores/`](<https://github.com/anthropics/claude-agent-sdk-typescript/tree/main/examples/session-stores>): Runnable S3, Redis, and Postgres reference adapters
Show diff (359 lines)
--- a/sessions.md
+++ b/sessions.md
@@ -4,273 +4,132 @@
>
> Use this file to discover all available pages before exploring further.
-A session is the conversation history the SDK accumulates while your agent works. It contains your prompt, every tool call the agent made, every tool result, and every response. The SDK writes it to disk automatically so you can return to it later. Returning to a session means the agent has full context from before: files it already read, analysis it already performed, decisions it already made. You can ask a follow-up question, recover from an interruption, or branch off to try a different approach.
+A session is a saved conversation tied to a project directory. Claude Code stores it locally as you work, so you can resume where you left off, branch to try a different approach, or switch between tasks. The [desktop app](</docs/en/desktop#work-in-parallel-with-sessions>), [Claude Code on the web](</docs/en/claude-code-on-the-web>), and the [VS Code extension](</docs/en/vs-code#resume-past-conversations>) each maintain their own session history. This page covers the CLI:
-Sessions persist the **conversation** , not the filesystem. To snapshot and revert file changes the agent made, use [file checkpointing](</docs/en/agent-sdk/file-checkpointing>).
-
-This guide covers how to pick the right approach for your app, the SDK interfaces that track sessions automatically, how to capture session IDs and use `resume` and `fork` manually, and what to know about resuming sessions across hosts.
+ * Resume a previous conversation by flag, name, or PR
+ * Name sessions so you can find them later
+ * Browse sessions with the `/resume` picker
+ * Branch a conversation to try a different approach
+ * Export transcripts and find them on disk
##
-Choose an approach
+Resume a session
-How much session handling you need depends on your application’s shape. Session management comes into play when you send multiple prompts that should share context. Within a single `query()` call, the agent already takes as many turns as it needs, and permission prompts and `AskUserQuestion` are [handled in-loop](</docs/en/agent-sdk/user-input>) (they don’t end the call).
+Sessions are saved continuously to local transcript files as you work, so you can return to one after exiting or running `/clear`. Use these entry points:
-What you’re building| What to use
+Command| What it does
---|---
-One-shot task: single prompt, no follow-up| Nothing extra. One `query()` call handles it.
-Multi-turn chat in one process| `ClaudeSDKClient` (Python) or `continue: true` (TypeScript). The SDK tracks the session for you with no ID handling.
-Pick up where you left off after a process restart| `continue_conversation=True` (Python) / `continue: true` (TypeScript). Resumes the most recent session in the directory, no ID needed.
-Resume a specific past session (not the most recent)| Capture the session ID and pass it to `resume`.
-Try an alternative approach without losing the original| Fork the session.
-Stateless task, don’t want anything written to disk (TypeScript only)| Set [`persistSession: false`](</docs/en/agent-sdk/typescript#options>). The session exists only in memory for the duration of the call. Python always persists to disk.
+`claude --continue`| Resumes the most recent session in the current directory
+`claude --resume`| Opens the session picker
+`claude --resume <name>`| Resumes the named session directly
+`claude --from-pr <number>`| Resumes the session linked to that pull request
+`/resume`| Switches to a different conversation from inside an active session
+
+Sessions created with [`claude -p`](</docs/en/headless>) or the [Agent SDK](</docs/en/agent-sdk/overview>) do not appear in the session picker, but you can still resume one by passing its session ID to `claude --resume <session-id>`.
###
-Continue, resume, and fork
+Where the session picker looks
-Continue, resume, and fork are option fields you set on `query()` ([`ClaudeAgentOptions`](</docs/en/agent-sdk/python#claudeagentoptions>) in Python, [`Options`](</docs/en/agent-sdk/typescript#options>) in TypeScript). **Continue** and **resume** both pick up an existing session and add to it. The difference is how they find that session:
+Sessions are stored per project directory. By default the session picker shows interactive sessions from the current worktree, plus sessions started elsewhere that added the current directory with `/add-dir`. Use `Ctrl+W` to widen to all worktrees of the repository or `Ctrl+A` to widen to every project on this machine. Selecting a session from another worktree of the same repository resumes it in place. Selecting a session from an unrelated project copies a `cd` and resume command to your clipboard instead. Resuming by name resolves across the current repository and its worktrees. Both forms look for an exact match and resume it directly even if it lives in a different worktree:
- * **Continue** finds the most recent session in the current directory. You don’t track anything. Works well when your app runs one conversation at a time.
- * **Resume** takes a specific session ID. You track the ID. Required when you have multiple sessions (for example, one per user in a multi-user app) or want to return to one that isn’t the most recent.
-
-**Fork** is different: it creates a new session that starts with a copy of the original’s history. The original stays unchanged. Use fork to try a different direction while keeping the option to go back.
+Command| Exact match| Ambiguous name
+---|---|---
+`claude --resume <name>`| Resumes directly| Opens the session picker with the name pre-filled as a search term
+`/resume <name>`| Resumes directly| Reports an error; run `/resume` with no argument to open the session picker
##
-Automatic session management
+Name your sessions
-Both SDKs offer an interface that tracks session state for you across calls, so you don’t pass IDs around manually. Use these for multi-turn conversations within a single process.
+Give sessions descriptive names so they’re findable in the session picker and resumable by name. This matters most when you’re working on several tasks in parallel.
-###
+When| How to set the name
+---|---
+At startup| `claude -n auth-refactor`
+During a session| `/rename auth-refactor`. The name also appears on the prompt bar
+From the session picker| Highlight a session and press `Ctrl+R`
+On plan accept| Accepting a plan in [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) names the session from the plan content unless you’ve already set one
-
-
-Python: `ClaudeSDKClient`
-
-[`ClaudeSDKClient`](</docs/en/agent-sdk/python#claudesdkclient>) handles session IDs internally. Each call to `client.query()` automatically continues the same session. Call [`client.receive_response()`](</docs/en/agent-sdk/python#claudesdkclient>) to iterate over the messages for the current query. The client is typically used as an async context manager. This example runs two queries against the same `client`. The first asks the agent to analyze a module; the second asks it to refactor that module. Because both calls go through the same client instance, the second query has full context from the first without any explicit `resume` or session ID:
-
-Python
-
- import asyncio
- from claude_agent_sdk import (
- ClaudeSDKClient,
- ClaudeAgentOptions,
- AssistantMessage,
- ResultMessage,
- TextBlock,
- )
-
- def print_response(message):
- """Print only the human-readable parts of a message."""
- if isinstance(message, AssistantMessage):
- for block in message.content:
- if isinstance(block, TextBlock):
- print(block.text)
- elif isinstance(message, ResultMessage):
- cost = (
- f"${message.total_cost_usd:.4f}"
- if message.total_cost_usd is not None
- else "N/A"
- )
- print(f"[done: {message.subtype}, cost: {cost}]")
-
- async def main():
- options = ClaudeAgentOptions(
- allowed_tools=["Read", "Edit", "Glob", "Grep"],
- )
-
- async with ClaudeSDKClient(options=options) as client:
- # First query: client captures the session ID internally
- await client.query("Analyze the auth module")
- async for message in client.receive_response():
- print_response(message)
-
- # Second query: automatically continues the same session
- await client.query("Now refactor it to use JWT")
- async for message in client.receive_response():
- print_response(message)
-
- asyncio.run(main())
-
-See the [Python SDK reference](</docs/en/agent-sdk/python#choosing-between-query-and-claudesdkclient>) for details on when to use `ClaudeSDKClient` vs the standalone `query()` function.
-
-###
-
-
-
-TypeScript: `continue: true`
-
-The TypeScript SDK doesn’t have a session-holding client object like Python’s `ClaudeSDKClient`. Instead, pass `continue: true` on each subsequent `query()` call and the SDK picks up the most recent session in the current directory. No ID tracking required. This example makes two separate `query()` calls. The first creates a fresh session; the second sets `continue: true`, which tells the SDK to find and resume the most recent session on disk. The agent has full context from the first call:
-
-TypeScript
-
- import { query } from "@anthropic-ai/claude-agent-sdk";
-
- // First query: creates a new session
- for await (const message of query({
- prompt: "Analyze the auth module",
- options: { allowedTools: ["Read", "Glob", "Grep"] }
- })) {
- if (message.type === "result" && message.subtype === "success") {
- console.log(message.result);
- }
- }
-
- // Second query: continue: true resumes the most recent session
- for await (const message of query({
- prompt: "Now refactor it to use JWT",
- options: {
- continue: true,
- allowedTools: ["Read", "Edit", "Write", "Glob", "Grep"]
- }
- })) {
- if (message.type === "result" && message.subtype === "success") {
- console.log(message.result);
- }
- }
-
-The experimental [V2 session API](</docs/en/agent-sdk/typescript-v2-preview>), which provided `createSession()` with a `send` / `stream` pattern, was removed in TypeScript Agent SDK 0.3.142. Use the `query()` function and the session options described on this page instead.
+Once a session is named, return to it with `claude --resume <name>` or `/resume <name>`. See Resume a session for how name resolution behaves across worktrees.
##
-Use session options with `query()`
+Use the session picker
-###
+Run `/resume` inside a session, or `claude --resume` with no arguments, to open the interactive session picker. Use these keyboard shortcuts to navigate, search, and widen the list:
-
+Shortcut| Action
+---|---
+`↑` / `↓`| Navigate between sessions
+`→` / `←`| Expand or collapse grouped sessions
+`Enter`| Resume the highlighted session
+`Space`| Preview the session content. `Ctrl+V` also works on terminals that don’t capture it as paste
+`Ctrl+R`| Rename the highlighted session
+`/` or any printable character other than `Space`| Enter search mode and filter sessions. Paste a GitHub, GitHub Enterprise, GitLab, or Bitbucket pull or merge request URL to find the session that created it
+`Ctrl+A`| Show sessions from all projects on this machine. Press again to return to the current repository
+`Ctrl+W`| Show sessions from all worktrees of the current repository. Press again to return to the current worktree. Only shown in multi-worktree repositories
+`Ctrl+B`| Filter to sessions from the current git branch. Press again to show all branches
+`Esc`| Exit the session picker or search mode
-Capture the session ID
-
-Resume and fork require a session ID. Read it from the `session_id` field on the result message ([`ResultMessage`](</docs/en/agent-sdk/python#resultmessage>) in Python, [`SDKResultMessage`](</docs/en/agent-sdk/typescript#sdkresultmessage>) in TypeScript), which is present on every result regardless of success or error. In TypeScript the ID is also available earlier as a direct field on the init `SystemMessage`; in Python it’s nested inside `SystemMessage.data`.
-
-Python
-
-TypeScript
-
- import asyncio
- from claude_agent_sdk import query, ClaudeAgentOptions, ResultMessage
-
- async def main():
- session_id = None
-
- async for message in query(
- prompt="Analyze the auth module and suggest improvements",
- options=ClaudeAgentOptions(
- allowed_tools=["Read", "Glob", "Grep"],
- ),
- ):
- if isinstance(message, ResultMessage):
- session_id = message.session_id
- if message.subtype == "success":
- print(message.result)
-
- print(f"Session ID: {session_id}")
- return session_id
-
- session_id = asyncio.run(main())
-
-###
-
-
-
-Resume by ID
-
-Pass a session ID to `resume` to return to that specific session. The agent picks up with full context from wherever the session left off. Common reasons to resume:
-
- * **Follow up on a completed task.** The agent already analyzed something; now you want it to act on that analysis without re-reading files.
- * **Recover from a limit.** The first run ended with `error_max_turns` or `error_max_budget_usd` (see [Handle the result](</docs/en/agent-sdk/agent-loop#handle-the-result>)); resume with a higher limit.
- * **Restart your process.** You captured the ID before shutdown and want to restore the conversation.
-
-This example resumes the session from Capture the session ID with a follow-up prompt. Because you’re resuming, the agent already has the prior analysis in context:
-
-Python
-
-TypeScript
-
- # Earlier session analyzed the code; now build on that analysis
- async for message in query(
- prompt="Now implement the refactoring you suggested",
- options=ClaudeAgentOptions(
- resume=session_id,
- allowed_tools=["Read", "Edit", "Write", "Glob", "Grep"],
- ),
- ):
- if isinstance(message, ResultMessage) and message.subtype == "success":
- print(message.result)
-
-If a `resume` call returns a fresh session instead of the expected history, the most common cause is a mismatched `cwd`. Sessions are stored under `~/.claude/projects/<encoded-cwd>/*.jsonl`, where `<encoded-cwd>` is the absolute working directory with every non-alphanumeric character replaced by `-` (so `/Users/me/proj` becomes `-Users-me-proj`). If your resume call runs from a different directory, the SDK looks in the wrong place. The session file also needs to exist on the current machine.
-
-To resume sessions across machines or in serverless environments, mirror transcripts to shared storage with a [`SessionStore` adapter](</docs/en/agent-sdk/session-storage>).
-
-###
-
-
-
-Fork to explore alternatives
-
-Forking creates a new session that starts with a copy of the original’s history but diverges from that point. The fork gets its own session ID; the original’s ID and history stay unchanged. You end up with two independent sessions you can resume separately.
-
-Forking branches the conversation history, not the filesystem. If a forked agent edits files, those changes are real and visible to any session working in the same directory. To branch and revert file changes, use [file checkpointing](</docs/en/agent-sdk/file-checkpointing>).
-
-This example builds on Capture the session ID: you’ve already analyzed an auth module in `session_id` and want to explore OAuth2 without losing the JWT-focused thread. The first block forks the session and captures the fork’s ID (`forked_id`); the second block resumes the original `session_id` to continue down the JWT path. You now have two session IDs pointing at two separate histories:
-
-Python
-
-TypeScript
-
- # Fork: branch from session_id into a new session
- forked_id = None
- async for message in query(
- prompt="Instead of JWT, implement OAuth2 for the auth module",
- options=ClaudeAgentOptions(
- resume=session_id,
- fork_session=True,
- ),
- ):
- if isinstance(message, ResultMessage):
- forked_id = message.session_id # The fork's ID, distinct from session_id
- if message.subtype == "success":
- print(message.result)
-
- print(f"Forked session: {forked_id}")
-
- # Original session is untouched; resuming it continues the JWT thread
- async for message in query(
- prompt="Continue with the JWT approach",
- options=ClaudeAgentOptions(resume=session_id),
- ):
- if isinstance(message, ResultMessage) and message.subtype == "success":
- print(message.result)
+Each row shows the session name if set, otherwise the conversation summary or first prompt, along with time since last activity, message count, and git branch. Project path appears after you widen to all projects with `Ctrl+A`. Forked sessions created with `/branch`, `/rewind`, or `--fork-session` are grouped under their root session. Press `→` to expand a group.
##
-Resume across hosts
+Branch a session
-Session files are local to the machine that created them. To resume a session on a different host (CI workers, ephemeral containers, serverless), you have two options:
+Branching creates a copy of the conversation so far and switches you into it, leaving the original intact. Use it to try a different approach without losing the path you were on. From inside a session, run `/branch` with an optional name:
- * **Move the session file.** Persist `~/.claude/projects/<encoded-cwd>/<session-id>.jsonl` from the first run and restore it to the same path on the new host before calling `resume`. The `cwd` must match.
- * **Don’t rely on session resume.** Capture the results you need (analysis output, decisions, file diffs) as application state and pass them into a fresh session’s prompt. This is often more robust than shipping transcript files around.
+ /branch try-streaming-approach
-Both SDKs expose functions for enumerating sessions on disk and reading their messages: [`listSessions()`](</docs/en/agent-sdk/typescript#listsessions>) and [`getSessionMessages()`](</docs/en/agent-sdk/typescript#getsessionmessages>) in TypeScript, [`list_sessions()`](</docs/en/agent-sdk/python#list_sessions>) and [`get_session_messages()`](</docs/en/agent-sdk/python#get_session_messages>) in Python. Use them to build custom session pickers, cleanup logic, or transcript viewers. Both SDKs also expose functions for looking up and mutating individual sessions: [`get_session_info()`](</docs/en/agent-sdk/python#get_session_info>), [`rename_session()`](</docs/en/agent-sdk/python#rename_session>), and [`tag_session()`](</docs/en/agent-sdk/python#tag_session>) in Python, and [`getSessionInfo()`](</docs/en/agent-sdk/typescript#getsessioninfo>), [`renameSession()`](</docs/en/agent-sdk/typescript#renamesession>), and [`tagSession()`](</docs/en/agent-sdk/typescript#tagsession>) in TypeScript. Use them to organize sessions by tag or give them human-readable titles.
+From the command line, combine `--continue` or `--resume` with `--fork-session`:
+
+ claude --continue --fork-session
+
+The original session is unchanged and remains available in the session picker. The `/branch` confirmation prints two session IDs: the new branch you are now in and the original. To return to the original, pass its ID to `/resume`, use the session picker, or run `/resume <original-name>`. Permissions you approved with “allow for this session” do not carry over to the new branch. If you resume the same session in two terminals without forking, messages from both interleave into one transcript. For checkpoint-based rewind within a single session, see [Checkpointing](</docs/en/checkpointing>).
##
-Related resources
+Manage context within a session
- * [How the agent loop works](</docs/en/agent-sdk/agent-loop>): Understand turns, messages, and context accumulation within a session
- * [File checkpointing](</docs/en/agent-sdk/file-checkpointing>): Track and revert file changes across sessions
- * [Python `ClaudeAgentOptions`](</docs/en/agent-sdk/python#claudeagentoptions>): Full session option reference for Python
- * [TypeScript `Options`](</docs/en/agent-sdk/typescript#options>): Full session option reference for TypeScript
+These commands control what’s in the context window without leaving the session:
+
+ * **`/clear`** : start fresh with an empty context. The previous conversation is saved and resumable
+ * **`/compact [instructions]`** : replace history with a summary, optionally focused on what you specify
+ * **`/context`** : show what is currently consuming context
+
+For how compaction interacts with CLAUDE.md, skills, and rules, see the [context window guide](</docs/en/context-window>). For strategies on when to clear versus compact, see [Best practices](</docs/en/best-practices#manage-your-session>).
+
+##
+
+
+
+Export and locate session data
+
+Run `/export` to copy the current conversation to your clipboard or save it as a plain-text file, with messages and tool outputs rendered as readable text. Pass a filename to write directly to that file. Transcripts are stored as JSONL at `~/.claude/projects/<project>/<session-id>.jsonl`, where `<project>` is derived from your working directory path. Each line is a JSON object for a message, tool use, or metadata entry. To store sessions somewhere other than `~/.claude`, set [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>). These local files are removed after 30 days by default; change this with [`cleanupPeriodDays`](</docs/en/settings#available-settings>). To suppress transcript writes entirely, set [`CLAUDE_CODE_SKIP_PROMPT_HISTORY`](</docs/en/env-vars>), or in non-interactive mode use `--no-session-persistence`.
+
+##
+
+
+
+See also
+
+These pages cover related session and parallelism mechanics:
+
+ * [Worktrees](</docs/en/worktrees>): run isolated parallel sessions on separate branches
+ * [Checkpointing](</docs/en/checkpointing>): rewind code and conversation to an earlier point
+ * [Context window](</docs/en/context-window>): what fills context and what survives compaction
+ * [Non-interactive mode](</docs/en/headless>): session behavior under `claude -p`
--- a/settings.md
+++ b/settings.md
@@ -256,6 +256,7 @@
`sshConfigs`| SSH connections to show in the [Desktop](</docs/en/desktop#pre-configure-ssh-connections-for-your-team>) environment dropdown. Each entry requires `id`, `name`, and `sshHost`; `sshPort`, `sshIdentityFile`, and `startDirectory` are optional. When set in managed settings, connections are read-only for users. Read from managed and user settings only| `[{"id": "dev-vm", "name": "Dev VM", "sshHost": "user@dev.example.com"}]`
`statusLine`| Configure a custom status line to display context. See [`statusLine` documentation](</docs/en/statusline>)| `{"type": "command", "command": "~/.claude/statusline.sh"}`
`strictKnownMarketplaces`| (Managed settings only) Allowlist of plugin marketplace sources. Undefined = no restrictions, empty array = lockdown. Enforced on marketplace add and on plugin install, update, refresh, and auto-update, so a marketplace added before the policy was set cannot be used to fetch plugins. See [Managed marketplace restrictions](</docs/en/plugin-marketplaces#managed-marketplace-restrictions>)| `[{ "source": "github", "repo": "acme-corp/plugins" }]`
+`strictPluginOnlyCustomization`| (Managed settings only) Block skills, agents, hooks, and MCP servers from user and project sources, so they can only come from plugins or managed settings. `true` locks all four surfaces; an array locks only the named ones. See `strictPluginOnlyCustomization`| `["skills", "hooks"]`
`syntaxHighlightingDisabled`| Disable syntax highlighting in diffs, code blocks, and file previews| `true`
`teammateMode`| How [agent team](</docs/en/agent-teams>) teammates display: `auto` (picks split panes in tmux or iTerm2, in-process otherwise), `in-process`, or `tmux`. `--teammate-mode` overrides this for one session. See [choose a display mode](</docs/en/agent-teams#choose-a-display-mode>)| `"in-process"`
`terminalProgressBarEnabled`| Show the terminal progress bar in supported terminals: ConEmu, Ghostty 1.2.0+, and iTerm2 3.6.6+. Default: `true`. Appears in `/config` as **Terminal progress bar**| `false`
@@ -934,6 +935,33 @@
See [Managed marketplace restrictions](</docs/en/plugin-marketplaces#managed-marketplace-restrictions>) for user-facing documentation.
+####
+
+
+
+`strictPluginOnlyCustomization`
+
+**Managed settings only** : blocks skills, agents, hooks, and MCP servers from user and project sources, so they can only come from plugins or managed settings. Combine it with `strictKnownMarketplaces` to control the full customization supply chain: the marketplace allowlist controls which plugins users can install, and this setting blocks everything that doesn’t come from a plugin or from managed settings.
+
+`strictPluginOnlyCustomization` requires Claude Code v2.1.82 or later. Earlier versions ignore the key and keep loading user and project customizations, so the lockdown isn’t enforced until clients update.
+
+The value is either `true` to lock all four surfaces, or an array naming the surfaces to lock:
+
+ {
+ "strictPluginOnlyCustomization": ["skills", "hooks"]
+ }
+
+For each locked surface, Claude Code skips user-level and project-level sources and loads only plugin-provided and managed sources:
+
+Surface| Blocked when locked| Still loads
+---|---|---
+`skills`| `~/.claude/skills/`, `.claude/skills/`| Plugin skills, bundled skills, skills in the managed policy directory
+`agents`| `~/.claude/agents/`, `.claude/agents/`| Plugin agents, built-in agents, agents in the managed policy directory
+`hooks`| Hooks in user, project, and local `settings.json`| Plugin hooks, hooks in managed settings
+`mcp`| Servers in `~/.claude.json` and `.mcp.json`| Plugin MCP servers, [`managed-mcp.json`](</docs/en/mcp#managed-mcp-configuration>) servers
+
+Surface names that a Claude Code version doesn’t recognize are ignored rather than failing the settings file, so you can add new surface names before all clients have updated.
+
###
--- a/tools-reference.md
+++ b/tools-reference.md
@@ -30,6 +30,7 @@
`Read`| Reads the contents of files. See Read tool behavior| No
`ReadMcpResourceTool`| Reads a specific MCP resource by URI| No
`RemoteTrigger`| Creates, updates, runs, and lists [Routines](</docs/en/routines>) on claude.ai. Backs the `/schedule` command. Routines live on claude.ai and require a Pro, Max, Team, or Enterprise plan, so this tool is not accessible from Amazon Bedrock, Google Vertex AI, or Microsoft Foundry| No
+`ScheduleWakeup`| Reschedules the next iteration of a [self-paced `/loop`](</docs/en/scheduled-tasks#let-claude-choose-the-interval>). Claude calls this at the end of each iteration to pick when the next one runs, between one minute and one hour out; you don’t call it directly. The pending wakeup appears in `session_crons` in [Stop hook input](</docs/en/hooks#stop-input>). Not available on Amazon Bedrock, Google Vertex AI, or Microsoft Foundry, where a `/loop` prompt with no interval runs on a fixed schedule instead| No
`SendMessage`| Sends a message to an [agent team](</docs/en/agent-teams>) teammate, or [resumes a subagent](</docs/en/sub-agents#resume-subagents>) by its agent ID. Stopped subagents auto-resume in the background. Only available when `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` is set| No
`ShareOnboardingGuide`| Uploads `ONBOARDING.md` and returns a share link teammates can open in Claude Code. Called from `/team-onboarding` after the guide is written. Available to claude.ai subscribers on Pro, Max, Team, and Enterprise plans| Yes
`Skill`| Executes a [skill](</docs/en/skills#control-who-invokes-a-skill>) within the main conversation| Yes