hooks

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package hooks implements auto-capture hooks for coding agents. Hooks are invoked by the agent at key lifecycle events and automatically capture observations into the Yaad memory graph.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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.

func ReadInput

func ReadInput(r io.Reader) (*HookInput, error)

ReadInput reads HookInput from stdin (agents pipe JSON to hooks).

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner executes hook logic.

func New

func New(eng *engine.Engine, project string) *Runner

New creates a hook runner.

func (*Runner) PostToolUse

func (r *Runner) PostToolUse(in *HookInput) error

PostToolUse is called after each tool use. Captures the observation.

func (*Runner) SessionEnd

func (r *Runner) SessionEnd(in *HookInput) error

SessionEnd is called when a session ends. Compresses and stores summary.

func (*Runner) SessionStart

func (r *Runner) SessionStart(in *HookInput) error

SessionStart is called when an agent session begins. Outputs hot-tier context to stdout for injection into the session.

func (*Runner) StoreToolEvent

func (r *Runner) StoreToolEvent(in *HookInput, store *storage.Store) error

StoreToolEvent stores a raw tool event for session replay.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL