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.
| Item | Status | Input type and fields | Result |
|---|---|---|---|
classic. | Documented: An official docs page names this item. | Config: hook_, source, file_ | Base |
classic. | Documented: An official docs page names this item. | Cwd: hook_, old_, new_ | Base |
classic. | Documented: An official docs page names this item. | Directory: hook_, directory, source | Base |
classic. | Documented: An official docs page names this item. | 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: An official docs page names this item. | 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: An official docs page names this item. | File: hook_, file_, event | Base |
classic. | Documented: An official docs page names this item. | Instructions: file_, memory_, load_, globs, trigger_, parent_ | Base |
classic. | Documented: An official docs page names this item. | Message: hook_, turn_, message_, 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 display |
classic. | Documented: An official docs page names this item. | Notification: hook_, message, title, notification_ | Base |
classic. | Documented: An official docs page names this item. | Permission: hook_, tool_, tool_, tool_, reason, mcp_ | Base plus retry |
classic. | Documented: An official docs page names this item. | Permission: hook_, tool_, tool_, permission_, mcp_ | Base plus decision |
classic. | Documented: An official docs page names this item. | Post: hook_, trigger, compact_ | Base |
classic. | Documented: An official docs page names this item. | Post: includes from_, to_, context_, pricing | Base plus additional |
classic. | Documented: An official docs page names this item. | Post: hook_, tool_. Fires once after every tool call in a batch resolves, before the next model request. | Base plus additional |
classic. | Documented: An official docs page names this item. | Post: includes tool_, tool_, error, is_ | Base plus additional |
classic. | Documented: An official docs page names this item. | Post: includes tool_, tool_, tool_, duration_ | Base plus additional, updated, updated |
classic. | Documented: An official docs page names this item. | Pre: hook_, trigger, custom_ | Base |
classic. | Documented: An official docs page names this item. | Pre: includes from_, to_, context_, pricing | Base plus permission, permission |
classic. | Documented: An official docs page names this item. | Tool (from Pre) | Pre: allow, ask, or deny |
classic. | Documented: An official docs page names this item. | Session: hook_, reason | Base |
classic. | Documented: An official docs page names this item. | Session: includes source, agent_, model | Base plus additional, initial, session, watch, reload |
classic. | Documented: An official docs page names this item. | Setup: hook_, trigger | Base plus additional |
classic. | Documented: An official docs page names this item. | Stop: hook_, error, error_, last_ | Base |
classic. | Documented: An official docs page names this item. | Stop: includes stop_, last_ | Base plus additional |
classic. | Documented: An official docs page names this item. | Subagent: hook_, agent_, agent_ | Base plus additional |
classic. | Documented: An official docs page names this item. | Subagent: includes agent_, agent_, last_ | Base plus additional |
classic. | Documented: An official docs page names this item. | Task: hook_, task_, task_, task_, teammate_, team_ | Base |
classic. | Documented: An official docs page names this item. | Task: same fields as Task | Base |
classic. | Documented: An official docs page names this item. | Teammate: hook_, teammate_, team_ | Base |
classic. | Documented: An official docs page names this item. | User: includes expansion_, command_, command_, prompt | Base plus additional, suppress |
classic. | Documented: An official docs page names this item. | User: includes prompt, source, session_ | Base plus additional, session, suppress |
classic. | Documented: An official docs page names this item. | Worktree: hook_, name | Base plus worktree |
classic. | Documented: An official docs page names this item. | 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