Documentation
¶
Overview ¶
Package hooks provides lifecycle event hooks for the agentic loop.
Hooks are user-configured shell commands that execute at specific points in the session or tool-use lifecycle. They support environment variable substitution, glob-based tool matching, timeout enforcement, and optional output injection back into the model context.
Only "command" action hooks are supported. All hook execution is sequential in definition order. No LLM-based hooks — intentionally omitted to avoid contaminating evaluation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MatchesEvent ¶
MatchesEvent reports whether h should fire for the given event and tool name. toolName is relevant only for PreToolUse / PostToolUse events; pass "" otherwise.
Types ¶
type Hook ¶
type Hook struct {
Name string
Event Event
Matcher string // tool name or glob; "" = match all events of type
Command string // shell command to execute
Timeout time.Duration // 0 = no timeout (30s default applied at run time)
InjectOutput bool // if true, stdout is returned for context injection
Enabled bool
}
Hook is a parsed, ready-to-execute lifecycle hook.
func HooksFromContext ¶
HooksFromContext retrieves hooks from ctx. Returns nil when absent.