Repository navigation
feat: hooks for the end of a session, lane-stop and session-end (ADR-0094 addendum) - #478
Merged
Merged
Conversation
A pool's skill can give text at the end of the work. A lane-stop text follows the output of `devstack lane stop` and the MCP tool lane_stop, for the lane's worktree. A session-end text is kept when Claude Code ends a session and given once at the next start of the same agent in the same working tree, with a line naming the ended session. Codex reports no end of a session and gets none. A hub now skips a hook of an event it does not know instead of all hooks of the skill; the coordinator stays strict. Closes #462 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7schmiede
force-pushed
the
feat/hooks-session-end
branch
from
November 6, 2026 14:58
943d61d to
366da26
Compare
This was referenced Nov 6, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
A routine that belongs to the end of a session (stop a time-tracking timer, review the session) had only a
prompt-submithook matching closing words. A session that ends without one (window closed,/exit, Ctrl+C) got nothing, and a closing word mid-session fired early. Two new hook events, additive to thehooks.tomlformat:lane-stop: afterdevstack lane stop(CLI) or the MCP toollane_stopsucceeded, the texts of thelane-stophooks that apply to the lane's worktree (skill on, repository bound, upstream accepted) follow the output, every time, whoever ran it. The lane's worktree comes fromGET /v1/lanes; any error gives no text and the stop stands.session-end: the hub writes an entry for Claude Code'sSessionEnd.devstack hook session-endprints nothing; where asession-endhook applies, it keeps that the session ended (hook-ended/in the hub's state: session id, transcript path, time). The nextsession-startof the same agent in the same working tree (nearest folder with.git) gives the texts once, after a line naming the ended session and its transcript. Records not touched for seven days go.a-zand-) and keeps the skill's other hooks; until 0.41.0 it left out all hooks of such a skill. The coordinator stays strict (check_files), so an author's typo still leaves the skill out, with why.session-endentry, anddevstack doctornames the agents that get hooks but nosession-endones.docs/pool.mddocuments both events and the advice to keep them in a skill of their own while members run releases before 0.42.0; ADR-0094 has an addendum; CHANGELOG under Added.Review card
eventgets two values,lane-stopandsession-end; a hub from 0.42.0 skips a hook of an event it does not know instead of leaving out the skill's hooks, a hub before it still leaves them out, so the documentation advises a skill of their own while members run older releases.lane-stop: afterdevstack lane stop(CLI) or MCPlane_stopsucceeded, devstack appends the texts of thelane-stophooks that apply to the lane's worktree to the output, every time, whichever agent ran it.PostToolUseonly).session-end: the hub writes an entry for Claude Code'sSessionEnd; the dispatcher only records the end (agent, session id, transcript path, working tree, time), and the nextsession-startof the same agent in the same working tree gives the texts once, with a line naming the ended session; a record older than seven days is dropped.SessionEnd(it never reaches the model); the closing-words heuristic.Approved by the owner in the conversation on 2026-11-06: points 1, 2 and 3.
Decided on my own: Codex gets no
session-end(it documents no end of a session;doctorsays so);lane-stopgives its texts on every stop (oncedoes not apply); the end is recorded only where asession-endhook applies; the coordinator stays strict about unknown events.Verified
LOCALAPPDATApointed at a temp folder, anagent-hooks.jsonwith asession-startand asession-endhook):devstack hook session-end --agent claude-codefromrepo/apps/webprinted nothing and wrote one record;devstack hook session-startinrepoprinted the start text, thenThe previous session in this working tree (sessions1, transcriptC:/t/s1.jsonl) ended at 2026-11-06T15:33:40+01:00. What follows was meant for its end:and the end text; a second start printed only the start text.lane-stopis covered by unit tests (texts_for), not run against a reallane stop.cargo fmt --check,cargo clippy --workspace --all-targets -D warnings, tests of devstack-node, devstack-hub, devstack-skills and the devstack binary green.Note: #477 changes how
lane stopfinds its lane indispatch/lane.rs;client::lane_stopkeeps its signature, so the two merge without a conflict in logic.Closes #462
🤖 Generated with Claude Code