Entrypoint format
Hook entrypoints can be:- Markdown (
.md) — with YAML frontmatter describing the event and hook type - YAML (
.yaml) — a descriptor with event and type fields - Executable script — any regular executable file
- The entrypoint file exists and is a regular file.
- The descriptor declares or implies a canonical lifecycle event from the vocabulary below.
- The descriptor declares one of the three valid hook types:
command,script, ormodule.
Lifecycle events
Hooks can fire on any of the following canonical lifecycle events:Session events
SessionStart, SessionEnd, SetupUser interaction events
UserPromptSubmit, Stop, StopFailureTool events
PreToolUse, PostToolUse, PostToolUseFailure, PostToolBatchAgent events
SubagentStart, SubagentStop, TaskCreated, TaskCompletedContext events
InstructionsLoaded, PreCompact, PostCompactEnvironment events
ConfigChange, CwdChanged, FileChangedHook types
Three hook types define how the hook executes:Required descriptor fields
For Markdown and YAML hook entrypoints, the descriptor must include:Markdown hook with frontmatter
YAML hook descriptor
Declaring a hook in volume.toml
Add a [[components]] entry with type = "hook" and point entrypoint to your hook file.
Common hook patterns
- SessionStart
- PreToolUse
- PostToolUse
- FileChanged
Run setup logic when a new session begins — initialize state, load configuration, or log the session.
Validation requirements
A hook entrypoint fails portable validation if any of these conditions are true:- The file does not exist or is not a regular file.
- The descriptor cannot be parsed.
- The
eventfield declares a lifecycle event outside the canonical vocabulary. - The
typefield declares a hook type other thancommand,script, ormodule.