Hook Events Reference

Hook Events Reference

Hooks are the internal transport layer between Claude Code and the Athena runtime. Claude Code fires hooks at lifecycle points; Athena's hook-forwarder binary receives them and streams them over a Unix Domain Socket as NDJSON.

Understanding hook events is useful for contributors and for understanding what data flows through the system.

How Hook Registration Works

At startup, Athena generates a temporary settings file that registers athena-hook-forwarder as the handler for all Claude Code hook events. This file is written to the OS temp directory and passed to Claude Code via --setting-sources. On exit, the temp file is cleaned up.

Hook Event Types

Claude Code exposes hook events in two categories based on whether they require a tool matcher.

Tool Events (require a "*" matcher)

These fire around tool invocations. Athena registers a wildcard matcher ("*") to receive all tool calls.

Hook NameWhen it firesCan block?
PreToolUseBefore Claude invokes a toolYes
PostToolUseAfter a tool completes and returns its resultNo
PostToolUseFailureAfter a tool invocation results in an errorNo
PermissionRequestWhen Claude Code requests explicit permissionYes

Non-Tool Events (no matcher required)

Hook NameWhen it fires
SessionStartWhen a new Claude Code session begins
SessionEndWhen a Claude Code session ends
UserPromptSubmitWhen the user submits a prompt
StopWhen Claude Code's stop hook fires
SubagentStartWhen a subagent session starts
SubagentStopWhen a subagent session ends
NotificationInformational notifications from Claude Code
PreCompactBefore context compaction occurs
SetupOn session init or maintenance

Internal Event Kinds

Hook events are translated to Athena's internal RuntimeEventKind type before being processed:

Hook NameRuntimeEventKind
SessionStartsession.start
SessionEndsession.end
UserPromptSubmituser.prompt
PreToolUsetool.pre
PostToolUsetool.post
PostToolUseFailuretool.failure
PermissionRequestpermission.request
Stopstop.request
SubagentStartsubagent.start
SubagentStopsubagent.stop
Notificationnotification
PreCompactcompact.pre
Setupsetup

Events not in this table map to unknown.

Feed Event Kinds

The feed layer further expands runtime events into display events. The full set of FeedEventKind values includes: session.start, session.end, run.start, run.end, user.prompt, tool.pre, tool.post, tool.failure, permission.request, permission.decision, stop.request, stop.decision, subagent.start, subagent.stop, notification, compact.pre, setup, unknown.hook, todo.add, todo.update, todo.done, agent.message, teammate.idle, task.completed, config.change.

Blocking Events

Events that canBlock allow Athena to send a denial or modification decision back to Claude Code through the hook response. The key ones are PreToolUse and PermissionRequest. Athena's isolation policy evaluation runs on these events before responding.

Blocking decisions include: passthrough (allow), block (deny with reason), or json (structured response with intent).