Follow Discord
Sweep 20 Nov 2026 · 19:55Z Build v2.1.330 547 read Stable v2.1.323 Latest v2.1.330 Next v2.1.330 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One capture · claude-code

One read of Claude Code CLIclaude-code-20261003T053702Z

5 pages moved out of 220 read.

Pages moved 5 significant first
Pages read 220 in this capture
Captured 05:37 UTC
Corpus hash eeeed8b32965 corpus-hash

What this read moved

1-5 of 5

hooks Changed · +10 / -4 lines

from line 34
3434| :- | :- |
3535| `SessionStart` | When a session begins or resumes |
3636| `Setup` | When you start Claude Code with `--init-only`, or with `--init` or `--maintenance` in `-p` mode. For one-time preparation in CI or scripts |
37| `UserPromptSubmit` | When you submit a prompt, before Claude processes it |
37| `UserPromptSubmit` | When a prompt is submitted, before Claude processes it. Also fires on [turns Claude Code starts on its own](/docs/en/hooks#userpromptsubmit) |
3838| `UserPromptExpansion` | When a user-typed command expands into a prompt, before it reaches Claude. Can block the expansion |
3939| `PreToolUse` | Before a tool call executes. Can block it |
4040| `PermissionRequest` | When a tool call needs a permission decision |
from line 1310
13101310 
13111311### UserPromptSubmit
13121312 
1313Runs when the user submits a prompt, before Claude processes it. This allows you
1313Runs when a prompt is submitted, before Claude processes it. This allows you
13141314to add additional context based on the prompt/conversation, validate prompts, or
13151315block certain types of prompts.
13161316 
1317`UserPromptSubmit` hooks don't fire only on prompts you type. Claude Code also runs them on:
1318 
1319* A [scheduled task](/docs/en/scheduled-tasks) firing, including a `/loop` iteration
1320* A [background subagent](/docs/en/sub-agents#run-subagents-in-foreground-or-background) reporting back to the session that started it
1321* A [message another session sends](/docs/en/cross-session-messaging) to your main conversation
1322 
13171323`UserPromptSubmit` hooks have a default timeout of 30 seconds for `command`, `http`, and `mcp_tool` types, shorter than the 600-second default for those types on most other events. Because this hook runs before every prompt and blocks model processing until it completes, a stuck hook stalls the session. If your hook needs more time, set the `timeout` field in the hook entry.
13181324 
13191325Apart from a command hook you run with [`async: true`](#run-hooks-in-the-background), a `UserPromptSubmit` command, HTTP, or MCP tool hook that reaches its timeout is canceled and its output, including any `additionalContext`, is discarded. The prompt still reaches Claude without that context. The transcript shows a notice naming the hook, the timeout that fired, and that the output was discarded.
from line 1328
13221328 
13231329#### UserPromptSubmit input
13241330 
1325In addition to the [common input fields](#common-input-fields), UserPromptSubmit hooks receive the `prompt` field containing the text the user submitted. Pasted content that collapsed to a `[Pasted text #N]` placeholder arrives expanded in place. In sessions where Claude Code [marks pasted text for Claude](/docs/en/terminal-config#how-claude-treats-pasted-text), that expanded content sits between a `<pasted_content id="…">` line and a `</pasted_content id="…">` line, so account for those lines if your hook parses the prompt.
1331In addition to the [common input fields](#common-input-fields), UserPromptSubmit hooks receive the `prompt` field containing the submitted text. Pasted content that collapsed to a `[Pasted text #N]` placeholder arrives expanded in place. In sessions where Claude Code [marks pasted text for Claude](/docs/en/terminal-config#how-claude-treats-pasted-text), that expanded content sits between a `<pasted_content id="…">` line and a `</pasted_content id="…">` line, so account for those lines if your hook parses the prompt.
13261332 
13271333UserPromptSubmit hooks also receive `session_title` when the session has a custom title, with the same meaning as the [SessionStart `session_title` field](#sessionstart-input).
13281334 
from line 1345
13391345 
13401346#### UserPromptSubmit decision control
13411347 
1342`UserPromptSubmit` hooks can control whether a user prompt is processed and add context. All [JSON output fields](#json-output) are available.
1348`UserPromptSubmit` hooks can control whether a submitted prompt is processed and add context. All [JSON output fields](#json-output) are available.
13431349 
13441350There are two ways to add context to the conversation on exit code 0:
13451351 

agent-sdk/hooks Changed · +1 / -1 lines

from line 146
146146| `PostToolUse` | Yes | Yes | Tool execution result | Log all file changes to audit trail |
147147| `PostToolUseFailure` | Yes | Yes | Tool execution failure | Handle or log tool errors |
148148| `PostToolBatch` | No | Yes | A full batch of tool calls resolves, once per batch before the next model call | Inject conventions once for the whole batch |
149| `UserPromptSubmit` | Yes | Yes | User prompt submission | Inject additional context into prompts |
149| [`UserPromptSubmit`](/docs/en/hooks#userpromptsubmit) | Yes | Yes | A prompt is submitted, including a turn Claude Code starts on its own | Inject additional context into prompts |
150150| [`UserPromptExpansion`](/docs/en/hooks#userpromptexpansion) | No | Yes | A user-typed command, or an MCP prompt, expands into a prompt before it reaches Claude. Doesn't fire when Claude invokes a skill itself | Block a command from direct invocation or add context when a skill is typed |
151151| `MessageDisplay` | No | Yes | An assistant message with text completes, once per message with the full message text | Redact or reformat the displayed text without changing the transcript |
152152| `Stop` | Yes | Yes | Agent execution stop | Save session state before exit |

agent-sdk/python Changed · +2 / -2 lines

from line 2019
20192019 "PreToolUse", # Called before tool execution
20202020 "PostToolUse", # Called after tool execution
20212021 "PostToolUseFailure", # Called when a tool execution fails
2022 "UserPromptSubmit", # Called when user submits a prompt
2022 "UserPromptSubmit", # Called when a prompt is submitted
20232023 "Stop", # Called when stopping execution
20242024 "SubagentStop", # Called when a subagent stops
20252025 "PreCompact", # Called before message compaction
from line 2203
22032203| Field | Type | Description |
22042204| :- | :- | :- |
22052205| `hook_event_name` | `Literal["UserPromptSubmit"]` | Always "UserPromptSubmit" |
2206| `prompt` | `str` | The user's submitted prompt |
2206| `prompt` | `str` | The submitted prompt |
22072207 
22082208### `StopHookInput`
22092209 

hooks-guide Changed · +1 / -1 lines

from line 479
479479| :- | :- |
480480| `SessionStart` | When a session begins or resumes |
481481| `Setup` | When you start Claude Code with `--init-only`, or with `--init` or `--maintenance` in `-p` mode. For one-time preparation in CI or scripts |
482| `UserPromptSubmit` | When you submit a prompt, before Claude processes it |
482| `UserPromptSubmit` | When a prompt is submitted, before Claude processes it. Also fires on [turns Claude Code starts on its own](/docs/en/hooks#userpromptsubmit) |
483483| `UserPromptExpansion` | When a user-typed command expands into a prompt, before it reaches Claude. Can block the expansion |
484484| `PreToolUse` | Before a tool call executes. Can block it |
485485| `PermissionRequest` | When a tool call needs a permission decision |

monitoring-usage Changed · +1 / -1 lines

from line 713
713713 
714714#### User prompt event
715715 
716Logged when a user submits a prompt.
716Logged when a prompt is submitted, including on turns Claude Code starts on its own.
717717 
718718**Event Name**: `claude_code.user_prompt`
719719 
Feedback