Documentation
¶
Overview ¶
Package hooks implements auto-capture hooks for lifecycle events. Hooks are invoked at key lifecycle events and automatically capture observations into the Yaad memory graph.
Index ¶
- func ScoreRelevance(toolName, input, output, toolError string) float64
- func ShouldCapture(toolName, input, output, toolError string) bool
- type HookInput
- type Runner
- func (r *Runner) PostToolUse(ctx context.Context, in *HookInput) error
- func (r *Runner) SessionEnd(ctx context.Context, in *HookInput) error
- func (r *Runner) SessionStart(ctx context.Context, in *HookInput) error
- func (r *Runner) StoreToolEvent(ctx context.Context, in *HookInput, store storage.Storage) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ScoreRelevance ¶
ScoreRelevance determines if a tool observation is worth storing. Returns a score 0.0-1.0 where higher = more worth remembering. No LLM needed — heuristic-based on content signals.
func ShouldCapture ¶
ShouldCapture returns true if the observation passes the relevance threshold.
Types ¶
type HookInput ¶
type HookInput struct {
// Common
SessionID string `json:"session_id"`
Project string `json:"project"`
Agent string `json:"agent"`
// PostToolUse
ToolName string `json:"tool_name"`
ToolInput string `json:"tool_input"`
ToolOutput string `json:"tool_output"`
ToolError string `json:"tool_error"`
// UserPromptSubmit
Prompt string `json:"prompt"`
// SessionEnd
Summary string `json:"summary"`
}
HookInput is the JSON payload passed to hooks via stdin.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner executes hook logic.
func (*Runner) PostToolUse ¶
PostToolUse is called after each tool use. Captures the observation.
func (*Runner) SessionEnd ¶
SessionEnd is called when a session ends. Compresses and stores summary.
func (*Runner) SessionStart ¶
SessionStart is called when an agent session begins. Outputs hot-tier context to stdout for injection into the session.