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 program (the *HookInput types of types-2.1.304.d.ts). For what each event means, see Hook Events.
Example
export function 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.
| Item | Status | Input type and fields | Result |
|---|---|---|---|
classic. | Documented | Config: hook_, source, file_ | Base |
classic. | Documented | Cwd: hook_, old_, new_ | Base |
classic. | Documented | Directory: hook_, directory, source | Base |
classic. | Documented | Elicitation: hook_, mcp_, message, mode, url, elicitation_, requested_. Fires when an MCP server asks for user input. Hooks can auto-respond (accept or decline) instead of showing the dialog. | Base |
classic. | Documented | Elicitation: hook_, mcp_, elicitation_, 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. | Documented | File: hook_, file_, event | Base |
classic. | Documented | Instructions: file_, memory_, load_, globs, trigger_, parent_ | Base |
classic. | Documented | Message: hook_, turn_, message_, index, final, delta. Fires with each batch of newly finished lines while an assistant message streams. Display only: the stored message and what the model sees stay as they are. | Base plus display |
classic. | Documented | Notification: hook_, message, title, notification_ | Base |
classic. | Documented | Permission: hook_, tool_, tool_, tool_, reason, mcp_ | Base plus retry |
classic. | Documented | Permission: hook_, tool_, tool_, permission_, mcp_ | Base plus decision |
classic. | Documented | Post: hook_, trigger, compact_ | Base |
classic. | Documented | Post: includes from_, to_, context_, pricing | Base plus additional |
classic. | Documented | Post: hook_, tool_. Fires once after every tool call in a batch has resolved, before the next model request. | Base plus additional |
classic. | Documented | Post: includes tool_, tool_, error, is_ | Base plus additional |
classic. | Documented | Post: includes tool_, tool_, tool_, duration_ | Base plus additional, updated, updated |
classic. | Documented | Pre: hook_, trigger, custom_ | Base |
classic. | Documented | Pre: includes from_, to_, context_, pricing | Base plus permission, permission |
classic. | Documented | Tool (from Pre) | Pre: allow, ask, or deny |
classic. | Documented | Session: hook_, reason | Base |
classic. | Documented | Session: includes source, agent_, model | Base plus additional, initial, session, watch, reload |
classic. | Documented | Setup: hook_, trigger | Base plus additional |
classic. | Documented | Stop: hook_, error, error_, last_ | Base |
classic. | Documented | Stop: includes stop_, last_ | Base plus additional |
classic. | Documented | Subagent: hook_, agent_, agent_ | Base plus additional |
classic. | Documented | Subagent: includes agent_, agent_, last_ | Base plus additional |
classic. | Documented | Task: hook_, task_, task_, task_, teammate_, team_ | Base |
classic. | Documented | Task: same fields as Task | Base |
classic. | Documented | Teammate: hook_, teammate_, team_ | Base |
classic. | Documented | User: includes expansion_, command_, command_, prompt | Base plus additional, suppress |
classic. | Documented | User: includes prompt, source, session_ | Base plus additional, session, suppress |
classic. | Documented | Worktree: hook_, name | Base plus worktree |
classic. | Documented | Worktree: hook_, worktree_ | Base |
In this table, "Base" means block, preventContinuation, and stopReason.
Related Pages
- Mod API Overview
- Hooks and the Hook Chain
- Classic Event Types (the full input and result types)
- Hook Events