What
Hooks (.klaatai/hooks.json) currently support four lifecycle events — before_message, after_message, before_tool, after_tool (see type HookEvent in src/screens/repl.ts, search HookEvent =). There's no event that fires once when a session starts or ends, useful for things like "notify me when a long-running session finishes" or "log session start time to a file."
Where to start
Add "session_start" | "session_end" to the HookEvent union, call runHooks("session_start") once during REPL boot (after config/auth load, before the first prompt) and runHooks("session_end") on quit (/exit, ctrl+d, or process exit).
Acceptance criteria
- A hook configured for
session_start fires exactly once per session, at boot.
- A hook configured for
session_end fires on graceful quit.
/hooks command lists these new event types; README/docs mention them.
Why it's a good first issue
Follows an existing 4-event pattern almost exactly — the hard design work (payload shape, blocking semantics, matcher regex) is already done; this just adds two more trigger points.
What
Hooks (
.klaatai/hooks.json) currently support four lifecycle events —before_message,after_message,before_tool,after_tool(seetype HookEventinsrc/screens/repl.ts, searchHookEvent =). There's no event that fires once when a session starts or ends, useful for things like "notify me when a long-running session finishes" or "log session start time to a file."Where to start
Add
"session_start" | "session_end"to theHookEventunion, callrunHooks("session_start")once during REPL boot (after config/auth load, before the first prompt) andrunHooks("session_end")on quit (/exit,ctrl+d, or process exit).Acceptance criteria
session_startfires exactly once per session, at boot.session_endfires on graceful quit./hookscommand lists these new event types; README/docs mention them.Why it's a good first issue
Follows an existing 4-event pattern almost exactly — the hard design work (payload shape, blocking semantics, matcher regex) is already done; this just adds two more trigger points.