Hooks
Full language page — every event, condition, action, their params, the templating variables, and verified examples: Hooks.
Always quote YAML "on" (bare on: is YAML boolean true). Condition and
action params are inline (siblings of type), not nested under params:.
Events that fire: turn_start (user_prompt), turn_end, stop
(pre_finish), tool_start (pre_tool_use), tool_end (post_tool_use),
session_start, session_end, pre_compact, error, approval_request.
Declared but not emitted in this build (a hook on them compiles with warning
DGT-W0006 and never fires): agent_spawn, agent_complete (multi-agent not
implemented), activation (declared-only, unrouted).
runtime:
hooks:
- id: auto-compact
"on": turn_end
condition:
type: context_pressure
threshold: 0.80
action:
type: compact_context
cooldown: 60