Skip to main content

Classic Event Types

These are the input and result types of the classic.* events. Each input type matches the data that a settings hook of the same name receives on stdin. The result types match the JSON that a settings hook prints. Use them when you write a mod hook for an event such as classic.Stop.

Example​

This hook on classic.Stop passes the event on without a change. Its e is the same data a Stop settings hook reads on stdin.

on("classic.Stop", ($, e, next) => next(e))

How It Works​

Every settings hook event has a twin event under classic. The twin fires wherever the engine runs the classic hook, even with no settings hook configured. The chain runs managed settings hooks first, then hooks modules, then the other settings hooks. A managed block ends the chain above every module.

Types without Fields​

These types are aliases, unions, or plain shapes. Each row gives its use and its shape.

TypeStatusWhat it is forShape and limits
ClassicEventNameDocumentedThe name of a classic hook event as a function-hooks event: the settings hook's own name under classic (classic.Stop, classic.PreToolUse).Alias of `classic.${ClassicHookEvent}`. Each fires wherever the engine runs the classic hook, even with no settings hook configured.
ClassicHookEventDocumentedThe name of a classic hook event: PreToolUse, Stop, and the rest.Alias of HookInput['hook_event_name'].
ClassicHookInputsDocumentedWhat a classic hook receives on stdin for each event, by event name: the Agent SDK's <Event>HookInput.Alias of { [I in HookInput as I['hook_event_name']]: I, }.
ExitReasonDocumentedNot described in the type file.Alias of 'clear' | 'resume' | 'logout' | 'prompt_input_exit' | 'other'.
HookInputDocumentedNot described in the type file.Alias of the union of every hook input type, such as PreToolUseHookInput, PostToolUseHookInput, SessionStartHookInput, and StopHookInput.
PermissionBehaviorDocumentedNot described in the type file.Alias of 'allow' | 'deny' | 'ask'.
PermissionModeDocumentedHow tool runs are handled: default, acceptEdits, bypassPermissions, plan, dontAsk, or auto. bypassPermissions needs allowDangerouslySkipPermissions.Alias of 'default' | 'acceptEdits' | 'bypassPermissions' | 'plan' | 'dontAsk' | 'auto'.
PermissionUpdateDestinationDocumentedNot described in the type file.Alias of 'userSettings' | 'projectSettings' | 'localSettings' | 'session' | 'cliArg'.
PermissionUpdatesDocumentedThe permission rules a PermissionRequest allow may add: the shape of the request's own permission_suggestions (the SDK's PermissionUpdate list).Alias of NonNullable<ClassicHookInputs['PermissionRequest']['permission_suggestions']>.
SDKAssistantMessageErrorDocumentedNot described in the type file.Alias of 13 error names, from authentication_failed and billing_error to rate_limit, overloaded, model_not_found, server_error, max_output_tokens, and unknown.

Types with Fields​

Each type below has its own table of fields.

BackgroundTaskSummary​

FieldStatusWhat it is forType and limits
idDocumentedNot described in the type file.Type: string.
typeDocumentedFriendly task-type label (e.g. 'shell', 'subagent', 'monitor', 'workflow'). Falls back to the raw discriminant for unknown types.Type: string.
statusDocumentedNot described in the type file.Type: string.
descriptionDocumentedFree-text description. Capped at 1000 chars, clipped values append an in-string "... [+N chars]" marker.Type: string.
commandDocumentedShell command line. Only present for 'shell' tasks. Capped at 1000 chars with the same "... [+N chars]" marker.Type: string. Optional.
agent_typeDocumentedSubagent type name. Only present for 'subagent' tasks.Type: string. Optional.
serverDocumentedMCP server name. Only present for 'monitor' / 'MCP task' tasks.Type: string. Optional.
toolDocumentedMCP tool name. Only present for 'monitor' / 'MCP task' tasks.Type: string. Optional.
nameDocumentedWorkflow name. Only present for 'workflow' tasks.Type: string. Optional.

BaseHookInput​

FieldStatusWhat it is forType and limits
session_idDocumentedNot described in the type file.Type: string.
transcript_pathDocumentedNot described in the type file.Type: string.
cwdDocumentedNot described in the type file.Type: string.
prompt_idDocumentedA UUID that ties a user prompt to all later events until the next prompt. It is also the prompt.id attribute on OpenTelemetry events. Absent until the first user input.Type: string. Optional.
permission_modeDocumentedNot described in the type file.Type: string. Optional.
agent_idDocumentedSubagent identifier. Present only when the hook fires inside a subagent. Absent on the main thread. Use it, not agent_type, to tell subagent calls apart.Type: string. Optional.
agent_typeDocumentedAgent type name, such as general-purpose. Present inside a subagent, or on the main thread of a session started with --agent.Type: string. Optional.
effortDocumentedReasoning effort of the current turn. Present for hooks in a tool-use context on a model that supports effort. Absent for session-lifecycle hooks.Type: object. Optional.

ClassicEventOf​

The classic (settings) hook events, one per classic event name: e is the hook's whole stdin input, base fields (transcript_path, cwd) included. Object. One key for each classic event. The chain is managed settings hooks, then hooks modules, then the other settings hooks. A managed block ends it above every module.

FieldStatusWhat it is forType and limits
[E in ClassicHookEvent as `classic.${E}`]DocumentedNot described in the type file.Type: E extends 'PreToolUse' ? ToolCallEnvelope : ClassicHookInputs[E].

ClassicResult​

Everything a classic hook event's answer can carry, named as the classic hook's JSON output names it, each event reads its subset (ClassicResultOf). The settings hooks fold into one of these. A field of the wrong shape fails the hook.

FieldStatusWhat it is forType and limits
blockDocumenteddecision: "block" with this text as reason (a command hook's exit code 2): the event's block, veto or re-prompt.Type: string. Optional.
preventContinuationDocumentedcontinue: false: the session stops after this event.Type: true. Optional.
stopReasonDocumentedShown when preventContinuation stops the session (stopReason).Type: string. Optional.
additionalContextDocumentedhookSpecificOutput.additionalContext, one entry per hook: text handed to the model with the event.Type: string[]. Optional.
sessionTitleDocumentedhookSpecificOutput.sessionTitle (UserPromptSubmit, SessionStart).Type: string. Optional.
suppressOriginalPromptDocumentedhookSpecificOutput.suppressOriginalPrompt (UserPromptSubmit, UserPromptExpansion).Type: true. Optional.
initialUserMessageDocumentedhookSpecificOutput.initialUserMessage (SessionStart).Type: string. Optional.
watchPathsDocumentedhookSpecificOutput.watchPaths (SessionStart).Type: string[]. Optional.
reloadSkillsDocumentedhookSpecificOutput.reloadSkills (SessionStart).Type: true. Optional.
permissionDecisionDocumentedhookSpecificOutput.permissionDecision (PreModelSwitch).Type: 'allow' | 'deny' | 'ask'. Optional.
permissionDecisionReasonDocumentedhookSpecificOutput.permissionDecisionReason (PreModelSwitch).Type: string. Optional.
decisionDocumentedhookSpecificOutput.decision (PermissionRequest).Type: PermissionRequestDecision. Optional.
updatedToolOutputDocumentedhookSpecificOutput.updatedToolOutput (PostToolUse): replaces what the model sees of the tool's result.Type: unknown. Optional.
updatedMCPToolOutputDocumentedhookSpecificOutput.updatedMCPToolOutput (PostToolUse, MCP tools only).Type: unknown. Optional.
retryDocumentedhookSpecificOutput.retry (PermissionDenied).Type: true. Optional.
displayContentDocumentedhookSpecificOutput.displayContent (MessageDisplay).Type: string. Optional.
worktreePathDocumentedhookSpecificOutput.worktreePath (WorktreeCreate, a command hook prints it): the worktree the hook created, absolute or relative to its cwd.Type: string. Optional. Left unset, the session creates its git worktree as it would unhooked.

ClassicResultFields​

The event-specific fields of ClassicResult each classic event reads (its hookSpecificOutput), by event, an event absent here reads none of them. block, preventContinuation and stopReason are every event's.

FieldStatusWhat it is forType and limits
UserPromptSubmitDocumentedNot described in the type file.Type: 'additionalContext' | 'sessionTitle' | 'suppressOriginalPrompt'.
UserPromptExpansionDocumentedNot described in the type file.Type: 'additionalContext' | 'suppressOriginalPrompt'.
SessionStartDocumentedNot described in the type file.Type: 'additionalContext' | 'initialUserMessage' | 'sessionTitle' | 'watchPaths' | 'reloadSkills'.
SetupDocumentedNot described in the type file.Type: 'additionalContext'.
PreModelSwitchDocumentedNot described in the type file.Type: 'permissionDecision' | 'permissionDecisionReason'.
PostModelSwitchDocumentedNot described in the type file.Type: 'additionalContext'.
SubagentStartDocumentedNot described in the type file.Type: 'additionalContext'.
PostToolUseDocumentedNot described in the type file.Type: 'additionalContext' | 'updatedToolOutput' | 'updatedMCPToolOutput'.
PostToolUseFailureDocumentedNot described in the type file.Type: 'additionalContext'.
PostToolBatchDocumentedNot described in the type file.Type: 'additionalContext'.
StopDocumentedNot described in the type file.Type: 'additionalContext'.
SubagentStopDocumentedNot described in the type file.Type: 'additionalContext'.
PermissionDeniedDocumentedNot described in the type file.Type: 'retry'.
PermissionRequestDocumentedNot described in the type file.Type: 'decision'.
MessageDisplayDocumentedNot described in the type file.Type: 'displayContent'.
WorktreeCreateDocumentedNot described in the type file.Type: 'worktreePath'.

ClassicResultOf​

What each classic hook event's hook returns and its next(e) resolves to: the event's own subset of ClassicResult. [E in ClassicHookEvent as classic.${E}] ``. classic.PreToolUse keeps its allow / ask / deny result (PreToolUseResult).

FieldStatusWhat it is forType and limits
[E in ClassicHookEvent as `classic.${E}`]DocumentedNot described in the type file.Type: E extends 'PreToolUse' ? PreToolUseResult : Pick<ClassicResult, 'block' | 'preventContinuation' | 'stopReason' | (E extends keyof ClassicResultFields ? ClassicResultFields[E] : never)>.

ConfigChangeHookInput​

Combines ConfigChangeHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'ConfigChange'.
sourceDocumentedNot described in the type file.Type: 'user_settings' | 'project_settings' | 'local_settings' | 'policy_settings' | 'skills'.
file_pathDocumentedNot described in the type file.Type: string. Optional.

CwdChangedHookInput​

Combines CwdChangedHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'CwdChanged'.
old_cwdDocumentedNot described in the type file.Type: string.
new_cwdDocumentedNot described in the type file.Type: string.

DirectoryAddedHookInput​

Combines DirectoryAddedHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'DirectoryAdded'.
directoryDocumentedAbsolute path of the directory that was added.Type: string.
sourceDocumentedHow the directory was added: "slash_command" for /add-dir, "register_repo_root" for the SDK control_request.Type: 'slash_command' | 'register_repo_root'.

ElicitationHookInput​

Hook input for the Elicitation event. Fired when an MCP server requests user input. Hooks can auto-respond (accept/decline) instead of showing the dialog. Combines ElicitationHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'Elicitation'.
mcp_server_nameDocumentedNot described in the type file.Type: string.
messageDocumentedNot described in the type file.Type: string.
modeDocumentedNot described in the type file.Type: 'form' | 'url'. Optional.
urlDocumentedNot described in the type file.Type: string. Optional.
elicitation_idDocumentedNot described in the type file.Type: string. Optional.
requested_schemaDocumentedNot described in the type file.Type: Record<string, unknown>. Optional.

ElicitationResultHookInput​

Hook input for the ElicitationResult event. Fired after the user responds to an MCP elicitation. Hooks can observe or override the response before it is sent to the server. Combines ElicitationResultHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'ElicitationResult'.
mcp_server_nameDocumentedNot described in the type file.Type: string.
elicitation_idDocumentedNot described in the type file.Type: string. Optional.
modeDocumentedNot described in the type file.Type: 'form' | 'url'. Optional.
actionDocumentedNot described in the type file.Type: 'accept' | 'decline' | 'cancel'.
contentDocumentedNot described in the type file.Type: Record<string, unknown>. Optional.

FileChangedHookInput​

Combines FileChangedHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'FileChanged'.
file_pathDocumentedNot described in the type file.Type: string.
eventDocumentedNot described in the type file.Type: 'change' | 'add' | 'unlink'.

InstructionsLoadedHookInput​

Combines InstructionsLoadedHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'InstructionsLoaded'.
file_pathDocumentedNot described in the type file.Type: string.
memory_typeDocumentedNot described in the type file.Type: 'User' | 'Project' | 'Local' | 'Managed'.
load_reasonDocumentedNot described in the type file.Type: 'session_start' | 'nested_traversal' | 'path_glob_match' | 'include' | 'compact'.
globsDocumentedNot described in the type file.Type: string[]. Optional.
trigger_file_pathDocumentedNot described in the type file.Type: string. Optional.
parent_file_pathDocumentedNot described in the type file.Type: string. Optional.

MessageDisplayHookInput​

Hook input for the MessageDisplay event. Fired with each batch of newly completed lines while an assistant message streams. Display-only: the stored message and what the model sees are untouched. Combines MessageDisplayHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'MessageDisplay'.
turn_idDocumentedUUID of the current turn.Type: string.
message_idDocumentedUUID of the assistant message being displayed. Stable across every flush of the same message. Not the API msg_... id.Type: string.
indexDocumentedZero-based index of this delta within the message. Increments by one per flush.Type: number.
finalDocumentedTrue on the message's last flush. Exactly one flush per message has it.Type: boolean.
deltaDocumentedThe newly completed lines since the last flush. Always whole lines, except on the final flush. Treat final as the end-of-message signal.Type: string.

NotificationHookInput​

Combines NotificationHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'Notification'.
messageDocumentedNot described in the type file.Type: string.
titleDocumentedNot described in the type file.Type: string. Optional.
notification_typeDocumentedNot described in the type file.Type: string.

PermissionDeniedHookInput​

Combines PermissionDeniedHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'PermissionDenied'.
tool_nameDocumentedNot described in the type file.Type: string.
tool_inputDocumentedNot described in the type file.Type: unknown.
tool_use_idDocumentedNot described in the type file.Type: string.
reasonDocumentedNot described in the type file.Type: string.
mcp_serverDocumentedNot described in the type file.Type: McpServerProvenance. Optional.

PermissionRequestDecision​

A classic.PermissionRequest answer's decision, as the classic hook's hookSpecificOutput.decision: allow (with a rewrite or rules) or deny.

FieldStatusWhat it is forType and limits
behaviorDocumentedNot described in the type file.Type: 'allow'.
updatedInputDocumentedNot described in the type file.Type: Record<string, unknown>. Optional.
updatedPermissionsDocumentedNot described in the type file.Type: PermissionUpdates. Optional.
behaviorDocumentedNot described in the type file.Type: 'deny'.
messageDocumentedNot described in the type file.Type: string. Optional.
interruptDocumentedNot described in the type file.Type: true. Optional.

PermissionRequestHookInput​

Combines PermissionRequestHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'PermissionRequest'.
tool_nameDocumentedNot described in the type file.Type: string.
tool_inputDocumentedNot described in the type file.Type: unknown.
permission_suggestionsDocumentedNot described in the type file.Type: PermissionUpdate[]. Optional.
mcp_serverDocumentedNot described in the type file.Type: McpServerProvenance. Optional.

PermissionRuleValue​

FieldStatusWhat it is forType and limits
toolNameDocumentedNot described in the type file.Type: string.
ruleContentDocumentedNot described in the type file.Type: string. Optional.

PermissionUpdate​

FieldStatusWhat it is forType and limits
typeDocumentedNot described in the type file.Type: 'addRules'.
rulesDocumentedNot described in the type file.Type: PermissionRuleValue[].
behaviorDocumentedNot described in the type file.Type: PermissionBehavior.
destinationDocumentedNot described in the type file.Type: PermissionUpdateDestination.
typeDocumentedNot described in the type file.Type: 'replaceRules'.
rulesDocumentedNot described in the type file.Type: PermissionRuleValue[].
behaviorDocumentedNot described in the type file.Type: PermissionBehavior.
destinationDocumentedNot described in the type file.Type: PermissionUpdateDestination.
typeDocumentedNot described in the type file.Type: 'removeRules'.
rulesDocumentedNot described in the type file.Type: PermissionRuleValue[].
behaviorDocumentedNot described in the type file.Type: PermissionBehavior.
destinationDocumentedNot described in the type file.Type: PermissionUpdateDestination.
typeDocumentedNot described in the type file.Type: 'setMode'.
modeDocumentedNot described in the type file.Type: PermissionMode.
destinationDocumentedNot described in the type file.Type: PermissionUpdateDestination.
typeDocumentedNot described in the type file.Type: 'addDirectories'.
directoriesDocumentedNot described in the type file.Type: string[].
destinationDocumentedNot described in the type file.Type: PermissionUpdateDestination.
typeDocumentedNot described in the type file.Type: 'removeDirectories'.
directoriesDocumentedNot described in the type file.Type: string[].
destinationDocumentedNot described in the type file.Type: PermissionUpdateDestination.

PostCompactHookInput​

Combines PostCompactHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'PostCompact'.
triggerDocumentedNot described in the type file.Type: 'manual' | 'auto'.
compact_summaryDocumentedThe conversation summary produced by compactionType: string.

PostModelSwitchHookInput​

Combines PostModelSwitchHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'PostModelSwitch'.
from_modelDocumentedResolved model id the session was running before the switchType: string.
to_modelDocumentedResolved model id the session runs after the switchType: string.
requested_modelDocumentedWhat was asked for (alias such as "opus", a full id, or null for "default")Type: string | null.
sourceDocumentedWhy the model changed: command (/model or the /config Model row), picker, sdk (headless set_model), auto (fallback or other change), or resume.Type: 'command' | 'picker' | 'sdk' | 'auto' | 'resume'.
context_tokensDocumentedPrompt tokens that the next request re-sends: the last main-thread response's input, cache read, cache creation, and output tokens. 0 before the first response.Type: number.
prompt_cache_warmDocumentedWhether the current model's prompt cache is likely still warm (a switch then forfeits it)Type: boolean.
cache_ttlDocumentedNot described in the type file.Type: '5m' | '1h'.
estimated_cache_write_usdDocumentedEstimated cost of re-caching context_tokens on to_model at its cache-write rate - the managed modelPricing when set, otherwise list price, excludes the responseType: number.
pricingDocumentedconfigured: priced at the managed modelPricing setting, catalog: list price, default: to_model unknown, the default tier was assumedType: 'configured' | 'catalog' | 'default'.

PostToolBatchHookInput​

Hook input for PostToolBatch. Fires once after every tool call in a batch resolved, before the next model request. PostToolUse fires for each tool. Combines PostToolBatchHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'PostToolBatch'.
tool_callsDocumentedNot described in the type file.Type: PostToolBatchToolCall[].

PostToolBatchToolCall​

FieldStatusWhat it is forType and limits
tool_nameDocumentedNot described in the type file.Type: string.
tool_inputDocumentedNot described in the type file.Type: unknown.
tool_use_idDocumentedNot described in the type file.Type: string.
tool_responseDocumentedNot described in the type file.Type: unknown. Optional.

PostToolUseFailureHookInput​

Combines PostToolUseFailureHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'PostToolUseFailure'.
tool_nameDocumentedNot described in the type file.Type: string.
tool_inputDocumentedNot described in the type file.Type: unknown.
tool_use_idDocumentedNot described in the type file.Type: string.
errorDocumentedNot described in the type file.Type: string.
is_interruptDocumentedNot described in the type file.Type: boolean. Optional.
duration_msDocumentedTool execution time in milliseconds. Excludes permission-prompt and hook time.Type: number. Optional.
mcp_serverDocumentedNot described in the type file.Type: McpServerProvenance. Optional.

PostToolUseHookInput​

Combines PostToolUseHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'PostToolUse'.
tool_nameDocumentedNot described in the type file.Type: string.
tool_inputDocumentedNot described in the type file.Type: unknown.
tool_responseDocumentedNot described in the type file.Type: unknown.
tool_use_idDocumentedNot described in the type file.Type: string.
duration_msDocumentedTool execution time in milliseconds. Excludes permission-prompt and hook time.Type: number. Optional.
mcp_serverDocumentedNot described in the type file.Type: McpServerProvenance. Optional.

PreCompactHookInput​

Combines PreCompactHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'PreCompact'.
triggerDocumentedNot described in the type file.Type: 'manual' | 'auto'.
custom_instructionsDocumentedNot described in the type file.Type: string | null.

PreModelSwitchHookInput​

Combines PreModelSwitchHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'PreModelSwitch'.
from_modelDocumentedResolved model id the session was running before the switchType: string.
to_modelDocumentedResolved model id the session runs after the switchType: string.
requested_modelDocumentedWhat was asked for (alias such as "opus", a full id, or null for "default")Type: string | null.
sourceDocumentedcommand: /model <name>, the /config Model row, or enabling fast mode when that promotes the model, picker: an interactive model picker, sdk: headless set_model (SDK, Remote Control, IDE)Type: 'command' | 'picker' | 'sdk'.
context_tokensDocumentedPrompt tokens that the next request re-sends: the last main-thread response's input, cache read, cache creation, and output tokens. 0 before the first response.Type: number.
prompt_cache_warmDocumentedWhether the current model's prompt cache is likely still warm (a switch then forfeits it)Type: boolean.
cache_ttlDocumentedNot described in the type file.Type: '5m' | '1h'.
estimated_cache_write_usdDocumentedEstimated cost of re-caching context_tokens on to_model at its cache-write rate - the managed modelPricing when set, otherwise list price, excludes the responseType: number.
pricingDocumentedconfigured: priced at the managed modelPricing setting, catalog: list price, default: to_model unknown, the default tier was assumedType: 'configured' | 'catalog' | 'default'.

PreToolUseDecision​

The decision of a classic.PreToolUse result: allow, ask, deny, or none.

FieldStatusWhat it is forType and limits
allowDocumentedLets the call run without a permission prompt (the managed-settings hooks ran first, a deny from them ended the chain above).Type: true.
askDocumentedNever set in this form.Type: undefined. Optional.
denyDocumentedNever set in this form.Type: undefined. Optional.
askDocumentedAsks the user before the call runs, the text is shown as the reason.Type: string.
allowDocumentedNever set in this form.Type: undefined. Optional.
denyDocumentedNever set in this form.Type: undefined. Optional.
denyDocumentedRefuses the call, the model receives the text as the reason.Type: string.
allowDocumentedNever set in this form.Type: undefined. Optional.
askDocumentedNever set in this form.Type: undefined. Optional.
allowDocumentedNever set in this form.Type: undefined. Optional.
askDocumentedNever set in this form.Type: undefined. Optional.
denyDocumentedNever set in this form.Type: undefined. Optional.

PreToolUseHookInput​

Combines PreToolUseHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'PreToolUse'.
tool_nameDocumentedNot described in the type file.Type: string.
tool_inputDocumentedNot described in the type file.Type: unknown.
tool_use_idDocumentedNot described in the type file.Type: string.
mcp_serverDocumentedNot described in the type file.Type: McpServerProvenance. Optional.

PreToolUseResult​

What a classic.PreToolUse hook returns: one of allow, ask, deny, or none of them, which passes the call on to the normal permission flow. Intersection of PreToolUseResult and PreToolUseDecision. The event fires inside tool.call, beneath every plugin's tool.call hook.

FieldStatusWhat it is forType and limits
updatedInputDocumentedReplaces the tool's arguments, validated against the tool's schema before the tool runs.Type: Record<string, unknown>. Optional.
additionalContextDocumentedExtra context handed to the model with the call, one entry per note.Type: string[]. Optional.

SessionEndHookInput​

Combines SessionEndHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'SessionEnd'.
reasonDocumentedNot described in the type file.Type: ExitReason.

SessionStartHookInput​

Combines SessionStartHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'SessionStart'.
sourceDocumentedNot described in the type file.Type: 'startup' | 'resume' | 'clear' | 'compact' | 'fork'.
agent_typeDocumentedNot described in the type file.Type: string. Optional.
modelDocumentedNot described in the type file.Type: string. Optional.
session_titleDocumentedNot described in the type file.Type: string. Optional.
seconds_since_last_responseDocumentedresume/fork: seconds since the resumed transcript's last assistant responseType: number. Optional.
context_tokensDocumentedresume/fork: the resumed transcript's last response input + cache_read + cache_creation + output tokens (for a server-side tool loop, its last iteration's window, not the summed totals)Type: number. Optional.
prompt_cache_likely_expiredDocumentedresume/fork: seconds_since_last_response exceeds the prompt-cache TTL, so the first request re-caches context_tokensType: boolean. Optional.
estimated_cache_write_usdDocumentedresume/fork: estimated cost of re-caching context_tokens on the session model - the managed modelPricing when set, otherwise list price, excludes the responseType: number. Optional.

SetupHookInput​

Combines SetupHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'Setup'.
triggerDocumentedNot described in the type file.Type: 'init' | 'maintenance'.

StopFailureHookInput​

Combines StopFailureHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'StopFailure'.
errorDocumentedNot described in the type file.Type: SDKAssistantMessageError.
error_detailsDocumentedNot described in the type file.Type: string. Optional.
last_assistant_messageDocumentedNot described in the type file.Type: string. Optional.

StopHookInput​

Combines StopHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'Stop'.
stop_hook_activeDocumentedNot described in the type file.Type: boolean.
last_assistant_messageDocumentedText content of the last assistant message before stopping. Avoids the need to read and parse the transcript file.Type: string. Optional.
background_tasksDocumentedIn-flight background work in this session. Lets a hook tell "session is done" from "session is paused for background work". Empty when nothing is in flight.Type: BackgroundTaskSummary[]. Optional.
session_cronsDocumentedSession-scoped cron tasks (CronCreate, ScheduleWakeup, /loop) that will wake this session later. Empty array when none are scheduled.Type: SessionCronSummary[]. Optional.

SubagentStartHookInput​

Combines SubagentStartHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'SubagentStart'.
agent_idDocumentedNot described in the type file.Type: string.
agent_typeDocumentedNot described in the type file.Type: string.

SubagentStopHookInput​

Combines SubagentStopHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'SubagentStop'.
stop_hook_activeDocumentedNot described in the type file.Type: boolean.
agent_idDocumentedNot described in the type file.Type: string.
agent_transcript_pathDocumentedNot described in the type file.Type: string.
agent_typeDocumentedNot described in the type file.Type: string.
last_assistant_messageDocumentedText content of the last assistant message before stopping. Avoids the need to read and parse the transcript file.Type: string. Optional.
background_tasksDocumentedIn-flight background work in this session. Lets a hook tell "session is done" from "session is paused for background work". Empty when nothing is in flight.Type: BackgroundTaskSummary[]. Optional.
session_cronsDocumentedSession-scoped cron tasks (CronCreate, ScheduleWakeup, /loop) that will wake this session later. Empty array when none are scheduled.Type: SessionCronSummary[]. Optional.

TaskCompletedHookInput​

Combines TaskCompletedHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'TaskCompleted'.
task_idDocumentedNot described in the type file.Type: string.
task_subjectDocumentedNot described in the type file.Type: string.
task_descriptionDocumentedNot described in the type file.Type: string. Optional.
teammate_nameDocumentedNot described in the type file.Type: string. Optional.
team_nameDocumentedNot described in the type file.Type: string. Optional. Deprecated: Sessions have a single implicit team, this carries the session-derived team name and will be removed in a future release.

TaskCreatedHookInput​

Combines TaskCreatedHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'TaskCreated'.
task_idDocumentedNot described in the type file.Type: string.
task_subjectDocumentedNot described in the type file.Type: string.
task_descriptionDocumentedNot described in the type file.Type: string. Optional.
teammate_nameDocumentedNot described in the type file.Type: string. Optional.
team_nameDocumentedNot described in the type file.Type: string. Optional. Deprecated: Sessions have a single implicit team, this carries the session-derived team name and will be removed in a future release.

TeammateIdleHookInput​

Combines TeammateIdleHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'TeammateIdle'.
teammate_nameDocumentedNot described in the type file.Type: string.
team_nameDocumentedNot described in the type file.Type: string. Deprecated: Sessions have a single implicit team, this carries the session-derived team name and will be removed in a future release.

UserPromptExpansionHookInput​

Combines UserPromptExpansionHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'UserPromptExpansion'.
expansion_typeDocumentedNot described in the type file.Type: 'slash_command' | 'mcp_prompt'.
command_nameDocumentedNot described in the type file.Type: string.
command_argsDocumentedNot described in the type file.Type: string.
command_sourceDocumentedNot described in the type file.Type: string. Optional.
promptDocumentedNot described in the type file.Type: string.

UserPromptSubmitHookInput​

Combines UserPromptSubmitHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'UserPromptSubmit'.
promptDocumentedNot described in the type file.Type: string.
sourceDocumentedWho wrote the prompt: user (interactive), sdk (-p or Agent SDK), loop_wakeup, schedule_wakeup, system (machine-injected), or poll_event. Payloads may omit it.Type: 'user' | 'sdk' | 'system' | 'loop_wakeup' | 'schedule_wakeup' | 'poll_event'. Optional.
session_titleDocumentedNot described in the type file.Type: string. Optional.

WorktreeCreateHookInput​

Combines WorktreeCreateHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'WorktreeCreate'.
nameDocumentedNot described in the type file.Type: string.

WorktreeRemoveHookInput​

Combines WorktreeRemoveHookInput, BaseHookInput.

FieldStatusWhat it is forType and limits
hook_event_nameDocumentedNot described in the type file.Type: 'WorktreeRemove'.
worktree_pathDocumentedNot described in the type file.Type: string.