Skip to content

Add session_start/session_end hook events #9

Description

@aakashrajput

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions