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.
Pages
| Page | What is in it |
|---|---|
| Classic Result, Config, and Elicitation Types | Background to Message: the base hook input, the result types, and the config, cwd, directory, elicitation, file, instructions, and message inputs. |
| Classic Permission, Compact, and Tool Batch Types | Notification to Pre: notification, permission, compact, model switch, tool batch, and post tool use types. |
| Classic Tool Use, Session, and Task Types | Pre to Worktree: pre tool use, session, setup, stop, subagent, task, teammate, prompt, and worktree types. |
Example
This hook on classic.Stop passes the event on without a change. Its e is the same data that 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.
| Type | Status | What it is for | Shape and limits |
|---|---|---|---|
Classic | Documented: An official docs page names this item. | The name of a classic hook event as a function-hooks event: the own name of the settings hook under classic (classic., classic.). | Alias of `classic.. Each fires wherever the engine runs the classic hook, even when no settings hook is configured. |
Classic | Documented: An official docs page names this item. | The name of a classic hook event: Pre, Stop, and the rest. | Alias of Hook. |
Classic | Documented: An official docs page names this item. | What a classic hook receives on stdin for each event, by event name: the Agent SDK's <Event>Hook. | Alias of { [I in Hook. |
Exit | Documented: An official docs page names this item. | Why a session ended, as Session reports it. | Alias of 'clear' | 'resume' | 'logout' | 'prompt_. |
Hook | Documented: An official docs page names this item. | Any classic hook input, for code that handles the input of several events. | Alias of the union of every hook input type, such as Pre, Post, Session, and Stop. |
Permission | Documented: An official docs page names this item. | What a permission rule does: allow, deny, or ask. | Alias of 'allow' | 'deny' | 'ask'. |
Permission | Documented: An official docs page names this item. | How tool runs are handled: default, accept, bypass, plan, dont, or auto. bypass needs allow. | Alias of 'default' | 'accept. |
Permission | Documented: An official docs page names this item. | Where a permission update is saved: user, project, or local settings, the session only, or the CLI argument. | Alias of 'user. |
Permission | Documented: An official docs page names this item. | The permission rules that a PermissionRequest allow may add. It is the shape of the own permission_ of the request (the PermissionUpdate list of the SDK). | Alias of Non. |
SDKAssistant | Documented: An official docs page names this item. | The error that a failed assistant turn can carry, as Stop reports it. | Alias of 13 error names, from authentication_ and billing_ to rate_, overloaded, model_, server_, max_, and unknown. |