Skip to main content

Classic Events

Each settings hook event is also an event named classic.<Event> for a mod. The event e is the stdin JSON of the settings hook, with the base fields. The chain is the managed settings hooks, then the hooks modules, then the other settings hooks as core. A managed block ends the chain above every module.

Remove the on call to turn a hook off. disableAllHooks stops installed mods. The same events come from hooks in settings.

Official pages: Hooks Reference, React to Events. Source: the Mod API type file (the *HookInput types of schemas/claude-code.d.ts, from the 2.1.312 program). For what each event means, see Hook Events.

Example​

export const register = (on) => {
on("classic.PreToolUse", { tool_name: "Bash" }, async ($, e, next) =>
next(e),
);
on("classic.Stop", async ($, e, next) => next(e));
};

Events​

Most results include block, preventContinuation, and stopReason. The table lists extra result fields when there are any.

ItemStatusInput type and fieldsResult
classic.ConfigChange
Documented: An official docs page names this item.
ConfigChangeHookInput: hook_event_name, source, file_pathBase
classic.CwdChanged
Documented: An official docs page names this item.
CwdChangedHookInput: hook_event_name, old_cwd, new_cwdBase
classic.DirectoryAdded
Documented: An official docs page names this item.
DirectoryAddedHookInput: hook_event_name, directory, sourceBase
classic.Elicitation
Documented: An official docs page names this item.
ElicitationHookInput: hook_event_name, mcp_server_name, message, mode, url, elicitation_id, requested_schema. Fires when an MCP server asks for user input. Hooks can auto-respond (accept or decline) instead of showing the dialog.Base
classic.ElicitationResult
Documented: An official docs page names this item.
ElicitationResultHookInput: hook_event_name, mcp_server_name, elicitation_id, mode, action, content. Fires after the user answers an MCP elicitation. Hooks can observe or override the answer before it goes to the server.Base
classic.FileChanged
Documented: An official docs page names this item.
FileChangedHookInput: hook_event_name, file_path, eventBase
classic.InstructionsLoaded
Documented: An official docs page names this item.
InstructionsLoadedHookInput: file_path, memory_type, load_reason, globs, trigger_file_path, parent_file_pathBase
classic.MessageDisplay
Documented: An official docs page names this item.
MessageDisplayHookInput: hook_event_name, turn_id, message_id, index, final, delta. Fires with each batch of newly finished lines while an assistant message streams. It changes only what the person sees. The stored message and what the model sees stay as they are.Base plus displayContent
classic.Notification
Documented: An official docs page names this item.
NotificationHookInput: hook_event_name, message, title, notification_typeBase
classic.PermissionDenied
Documented: An official docs page names this item.
PermissionDeniedHookInput: hook_event_name, tool_name, tool_input, tool_use_id, reason, mcp_serverBase plus retry
classic.PermissionRequest
Documented: An official docs page names this item.
PermissionRequestHookInput: hook_event_name, tool_name, tool_input, permission_suggestions, mcp_serverBase plus decision
classic.PostCompact
Documented: An official docs page names this item.
PostCompactHookInput: hook_event_name, trigger, compact_summaryBase
classic.PostModelSwitch
Documented: An official docs page names this item.
PostModelSwitchHookInput: includes from_model, to_model, context_tokens, pricingBase plus additionalContext
classic.PostToolBatch
Documented: An official docs page names this item.
PostToolBatchHookInput: hook_event_name, tool_calls. Fires once after every tool call in a batch resolves, before the next model request.Base plus additionalContext
classic.PostToolUseFailure
Documented: An official docs page names this item.
PostToolUseFailureHookInput: includes tool_name, tool_input, error, is_interruptBase plus additionalContext
classic.PostToolUse
Documented: An official docs page names this item.
PostToolUseHookInput: includes tool_name, tool_input, tool_response, duration_msBase plus additionalContext, updatedToolOutput, updatedMCPToolOutput
classic.PreCompact
Documented: An official docs page names this item.
PreCompactHookInput: hook_event_name, trigger, custom_instructionsBase
classic.PreModelSwitch
Documented: An official docs page names this item.
PreModelSwitchHookInput: includes from_model, to_model, context_tokens, pricingBase plus permissionDecision, permissionDecisionReason
classic.PreToolUse
Documented: An official docs page names this item.
ToolCallEnvelope (from PreToolUseHookInput)PreToolUseResult: allow, ask, or deny
classic.SessionEnd
Documented: An official docs page names this item.
SessionEndHookInput: hook_event_name, reasonBase
classic.SessionStart
Documented: An official docs page names this item.
SessionStartHookInput: includes source, agent_type, modelBase plus additionalContext, initialUserMessage, sessionTitle, watchPaths, reloadSkills
classic.Setup
Documented: An official docs page names this item.
SetupHookInput: hook_event_name, triggerBase plus additionalContext
classic.StopFailure
Documented: An official docs page names this item.
StopFailureHookInput: hook_event_name, error, error_details, last_assistant_messageBase
classic.Stop
Documented: An official docs page names this item.
StopHookInput: includes stop_hook_active, last_assistant_messageBase plus additionalContext
classic.SubagentStart
Documented: An official docs page names this item.
SubagentStartHookInput: hook_event_name, agent_id, agent_typeBase plus additionalContext
classic.SubagentStop
Documented: An official docs page names this item.
SubagentStopHookInput: includes agent_id, agent_type, last_assistant_messageBase plus additionalContext
classic.TaskCompleted
Documented: An official docs page names this item.
TaskCompletedHookInput: hook_event_name, task_id, task_subject, task_description, teammate_name, team_nameBase
classic.TaskCreated
Documented: An official docs page names this item.
TaskCreatedHookInput: same fields as TaskCompletedBase
classic.TeammateIdle
Documented: An official docs page names this item.
TeammateIdleHookInput: hook_event_name, teammate_name, team_nameBase
classic.UserPromptExpansion
Documented: An official docs page names this item.
UserPromptExpansionHookInput: includes expansion_type, command_name, command_args, promptBase plus additionalContext, suppressOriginalPrompt
classic.UserPromptSubmit
Documented: An official docs page names this item.
UserPromptSubmitHookInput: includes prompt, source, session_titleBase plus additionalContext, sessionTitle, suppressOriginalPrompt
classic.WorktreeCreate
Documented: An official docs page names this item.
WorktreeCreateHookInput: hook_event_name, nameBase plus worktreePath
classic.WorktreeRemove
Documented: An official docs page names this item.
WorktreeRemoveHookInput: hook_event_name, worktree_pathBase

In this table, "Base" means block, preventContinuation, and stopReason.