Documentation
¶
Overview ¶
Package hook implements the Claude Code hook handlers. This is the hot path: it runs on every prompt the user types.
The two contracts that own this package (see /project-rule):
- C1 fail-open (14.40): any error ⇒ log + empty stdout + exit 0. stdout belongs to the hook JSON protocol; the ONLY stdout write is the single success emit in Run.
- C2 deadline (14.41): all work runs under a context deadline below the settings.json hook timeout; a fired deadline logs a breadcrumb so silent degradation stays observable.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Input ¶
type Input struct {
SessionID string `json:"session_id"`
TranscriptPath string `json:"transcript_path"`
CWD string `json:"cwd"`
Prompt string `json:"prompt"`
HookEventName string `json:"hook_event_name"`
Source string `json:"source"` // SessionStart: startup|resume|clear|compact
}
Input is the normalized hook event. Claude Code's stdin JSON maps directly; other harnesses become adapters onto this struct (ecosystem learning: normalized event seam from day one).
Click to show internal directories.
Click to hide internal directories.