Skip to content

Hooks: an end-of-session event (lane-stop output, session-end deferred to the next start) #462

Closed

Description

@7schmiede

Problem

ADR-0094 gives a skill two events: session-start and prompt-submit. A routine that belongs to the end of a session has neither. Our case: a work-session skill stops a time-tracking timer and then runs a short session review as the last action. Today the only mechanical trigger is a prompt-submit hook with match on closing words ("done", "wrap up", "lane stop", in our language). That is a heuristic:

  • a session that ends without such a word (window closed, /exit, Ctrl+C, the user just walks away) gets nothing;
  • a closing word in the middle of a session ("is this done?") fires early.

What would help

Two additive events, in the spirit of ADR-0094 (text only, no commands from the skill):

  1. lane-stop: when the agent itself runs devstack lane stop (CLI or MCP lane_stop) in a working tree, devstack appends the matching hook texts to the command's output. The agent reads that output, so the text arrives exactly at the moment the work is being torn down, without depending on the model choosing a skill. This covers the common "finish ticket, tear down the lane" path, and it needs no agent-side hook support.
  2. session-end, deferred to the next start: Claude Code has a SessionEnd hook (exit, clear, logout); text added there never reaches the model, because the session is over. Instead the dispatcher could only record that a session in this working tree ended (agent, session id/transcript path, time), and the next session-start of the same tree passes on a hook text such as "the previous session ended without closing; review it now", with the recorded reference. A skill opts in with event = "session-end"; its text is given at the following session start, once.

Codex: whether it has an end-of-session event is unchecked; (1) works for it regardless, because it only relies on command output.

Contract sketch

[[hook]]
event = "lane-stop"          # text appended to the output of `devstack lane stop` / MCP lane_stop
upstream = "time-tracking"   # as today
context = "..."

[[hook]]
event = "session-end"        # recorded at the end, given once at the next session-start in the same tree
context = "..."

Both are additive to the ADR-0094 format (event gets two new values), so older coordinators can keep ignoring them.

Activity

  1. added a commit that references this issue on Nov 6, 2026
    366da26
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions