events
events ¶
BaseHookEvent
dataclass
¶
Base class for all hook events, providing access to raw payload, context, and convenience methods.
tasks
cached
property
¶
The live task list for this session, read from Claude Code's native task store.
Unlike transcript-derived task_ops(), this reflects updates made by
subagents, teammates, or resumed sessions, and is empty when the session
has no task store — it never falls back to another session's tasks.
warn ¶
Emit a warning whose parts are auto-rendered and joined with newlines.
Each part is rendered by form: a plain str passes through verbatim; a
(label, value) tuple becomes "{label}: {json}" with value
JSON-encoded; any other object is JSON-encoded directly. Rendered parts are
joined with "\n".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*parts
|
str | tuple[str, object] | object
|
Warning fragments, each a |
()
|
Returns:
| Type | Description |
|---|---|
HookResult
|
A warn :class: |
ToolHookEvent
dataclass
¶
Bases: BaseHookEvent
Event for tool-related hooks, adding tool name, input, command, and file access.
PreToolUseEvent
dataclass
¶
PostToolUseEvent
dataclass
¶
PostToolUseFailureEvent
dataclass
¶
UserPromptSubmitEvent
dataclass
¶
StopEvent
dataclass
¶
Bases: BaseHookEvent
Fires when the agent is about to stop. Return a block result to prevent stopping.
SubagentStopEvent
dataclass
¶
SubagentStartEvent
dataclass
¶
PreCompactEvent
dataclass
¶
Bases: BaseHookEvent
Fires before context compaction, providing the trigger and custom instructions.
NotificationEvent
dataclass
¶
Bases: BaseHookEvent
Fires on system notifications, providing message, title, and notification type.