Skip to main content

Hooks

Full language page: Hooks.

Source of truth:

  • Events / conditions / actions: internal/compiler/schema/hooks.go
  • Evaluation: internal/runtime/hooks
  • Fire sites: internal/runtime/engine.go

Always quote YAML "on". Prefer events actually fired by the engine (turn_*, tool_*, session_start, error, approval_request, stop, ...). Schema marks agent_spawn / agent_complete / activation as not yet routed at the hook layer (NotYetRoutedHookEvents).

yaml
runtime:
hooks:
- id: auto-compact
"on": turn_end
condition:
type: context_pressure
threshold: 0.80
action:
type: compact_context
cooldown: 60