feat: restructure hook output for subagent pipeline (DOJ-2436)#12
Open
feat: restructure hook output for subagent pipeline (DOJ-2436)#12
Conversation
Implements Option 5 (Hybrid) from ADR hook-subagent-spike.md:
- Hook scripts now write structured JSON lessons to ~/.code-sensei/pending-lessons/
(one file per lesson, atomic writes, no race conditions)
- additionalContext shortened from verbose teaching prompts to minimal
delegation hints ("use Task tool to invoke sensei agent")
- session-stop.sh archives pending lessons to lessons-archive/ and cleans queue
- sensei agent updated to read pending lessons when invoked via delegation
- recap command updated to drain pending lessons queue
- 16 regression tests covering JSON validity, delegation hints, lesson
creation, first-encounter detection, and session cleanup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
@greptileai review this again |
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.
Summary
Implements Option 5 (Hybrid) from the ADR (
docs/architecture/hook-subagent-spike.md):~/.code-sensei/pending-lessons/(one file per lesson — atomic, no race conditions)additionalContextshortened from verbose teaching prompts (~100 tokens) to minimal delegation hints (~30 tokens): "use Task tool to invoke sensei agent"session-stop.sharchives pending lessons tolessons-archive/and cleans the queuesensei.mdupdated with instructions for reading pending lessons when invoked via delegationrecap.mdupdated to drain pending lessons queue before generating session summaryFiles changed
scripts/track-code-change.shscripts/track-command.shscripts/session-stop.shagents/sensei.mdcommands/recap.mdtests/test-hooks.shTest plan
bash tests/test-hooks.sh— 16/16 tests pass| jq .passes)additionalContextcontains delegation hint, not teaching contentmicro-lesson+firstEncounter=trueinline-insight+firstEncounter=falsesession-stoparchives lessons and cleans queue🤖 Generated with Claude Code