feat(hooks): add SubagentStop hook to capture subagent memory#210
feat(hooks): add SubagentStop hook to capture subagent memory#210chrisfentiman wants to merge 1 commit intozilliztech:mainfrom
Conversation
|
Thanks for the detailed PR and the real-world testing! The motivation makes sense — subagent findings can be valuable. However, we're keeping memsearch's capture layer lightweight by design. Currently we record at per-turn granularity (one user question → one assistant response), and subagent output is already part of that turn's transcript — the A few thoughts:
We'd love to continue the discussion. If you can provide a concrete example (e.g., what the L2 expand showed, whether L3 transcript drill was attempted, and what was missing), that would help us pinpoint whether the issue is in the summarization prompt, the skill instructions, or something else. |
|
Thanks for the contribution! Unfortunately this PR is based on the old If you're still interested in adding a |
Summary
SubagentStopentry tohooks.jsonpointing to existingstop.sh(async, 120s timeout)stop.shto detect subagent context viaagent_idand useagent_transcript_path(subagent: <agent_id>)in heading and HTML anchorMotivation
Subagent conversations are invisible to memsearch today. The
Stophook onlyfires in the main session, so research agents, code reviewers, test runners,
and anything spawned via the Agent tool produce conversations that are never
summarized or indexed. Valuable context (findings, decisions, tool outputs)
is lost between sessions.
In testing, a research subagent that investigated a project's hook architecture,
PR conventions, and test coverage produced 5 detailed bullet points. None of
this would have been captured without this change. The parent session's summary
only noted "spawned a research agent."
Changes
hooks.json: AddSubagentStopentry pointing to existingstop.shstop.sh: Detect subagent context viaagent_idfield, useagent_transcript_pathinstead of
transcript_path, tag memory entries with(subagent: <agent_id>)No changes to the Python core. The existing
parse-transcript.shand haikusummarization work unchanged on subagent transcripts.
Test plan
(subagent: ...)entryagent:field and correct subagent transcript pathmemsearch searchreturns subagent memory entries alongside main session entries