Documentation
¶
Overview ¶
Package hooks — user-defined hooks loaded from disk (master plan §6.3).
Layout: ~/.overkill/hooks/<point>/<name>.sh on Unix, or .ps1/.exe on Windows.
point ∈ {before_tool_call, after_tool_call, on_session_start,
on_session_end, on_error, before_compaction, after_compaction,
after_turn}
Each script is invoked with the JSON-serialized Event piped to stdin. Scripts have 5 seconds to finish; non-zero exit codes are logged but do NOT block the agent (hooks are observability, not gating). Make scripts executable (`chmod +x`) on Unix. Windows hooks must be owned by the current user, with modification rights limited to that user, Administrators and SYSTEM. PowerShell hooks run without profiles and retain the machine execution policy. Unsafe or unsupported files are skipped. Timeout cancellation kills the hook process group on Unix and its entire Job Object on Windows.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Event ¶
type Event struct {
Point HookPoint `json:"point"`
ToolName string `json:"tool_name,omitempty"`
ToolInput json.RawMessage `json:"tool_input,omitempty"`
ToolOutput json.RawMessage `json:"tool_output,omitempty"`
Error error `json:"-"`
SessionID string `json:"session_id,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
type HookPoint ¶
type HookPoint string
const ( BeforeToolCall HookPoint = "before_tool_call" AfterToolCall HookPoint = "after_tool_call" AfterTurn HookPoint = "after_turn" OnSessionStart HookPoint = "on_session_start" OnSessionEnd HookPoint = "on_session_end" OnError HookPoint = "on_error" BeforeCompaction HookPoint = "before_compaction" AfterCompaction HookPoint = "after_compaction" )
type MetricsHook ¶
type MetricsHook struct {
Hook
// contains filtered or unexported fields
}
func NewMetricsHook ¶
func NewMetricsHook() *MetricsHook
func (*MetricsHook) Counts ¶
func (m *MetricsHook) Counts() map[HookPoint]int64
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *Registry
func NewRegistryFromDir ¶
NewRegistryFromDir loads only the application owner's hooks directory, never scripts from a workspace supplied by an agent or remote peer. Each session receives its own registry; changes take effect for newly constructed sessions.