Skip to content

HookEvent

HookEvent = object

Defined in: src/hooks-ingest.ts:28

A normalized hook event after validation — the spike’s observable unit.

optional agentId?: string

Defined in: src/hooks-ingest.ts:60

SubagentStart/Stop: the spawned sub-agent’s stable agent_id (same id in both).


optional agentType?: string

Defined in: src/hooks-ingest.ts:62

SubagentStart/Stop: the sub-agent’s agent_type (e.g. “general-purpose”, “Explore”).


event: "PostToolUse" | "PostToolUseFailure" | "Notification" | "SessionStart" | "Stop" | "SessionEnd" | "SubagentStart" | "SubagentStop" | string

Defined in: src/hooks-ingest.ts:31

Recognized lifecycle event; an unrecognized hook_event_name is still kept, passed through verbatim, and flagged via unknown.


optional exitCode?: number

Defined in: src/hooks-ingest.ts:48

PostToolUse(/Failure): tool exit code when present (logging aid).


optional match?: boolean

Defined in: src/hooks-ingest.ts:71

Route-decided cross-check of the body’s session_id against the resolved session’s claudeSessionId. false ⇒ observe-only (never forwarded to signals).


optional message?: string

Defined in: src/hooks-ingest.ts:52

Notification: the human-readable message string.


optional notificationType?: string

Defined in: src/hooks-ingest.ts:50

Notification: the notification_type string (e.g. permission_prompt / idle_prompt).


optional reason?: string

Defined in: src/hooks-ingest.ts:58

SessionEnd: the termination reason (clear/logout/prompt_input_exit/other).


receivedAt: number

Defined in: src/hooks-ingest.ts:68

Server receive time (ms). CC’s payload carries no reliable client timestamp, so end-to-end latency is measured externally; this anchors per-event ordering + logs.


sessionId: string

Defined in: src/hooks-ingest.ts:42

The hook payload’s session_id (== claude --session-id == claudeSessionId).


optional source?: string

Defined in: src/hooks-ingest.ts:54

SessionStart: the source (startup/resume/clear/compact).


optional status?: "ok" | "error"

Defined in: src/hooks-ingest.ts:46

PostToolUse(/Failure): derived from exit_code / the *Failure event.


optional stopHookActive?: boolean

Defined in: src/hooks-ingest.ts:56

Stop: the stop_hook_active boolean (whether a Stop hook is already active).


optional toolName?: string

Defined in: src/hooks-ingest.ts:44

PostToolUse(/Failure): the tool that ran.


optional unknown?: boolean

Defined in: src/hooks-ingest.ts:65

True when hook_event_name or notification_type was unrecognized — recorded, flagged, and console.warn-ed so a wrong upstream string surfaces in the spike.