fix(hooks): filter and tag claude-status hook events by source#615
Merged
Conversation
The claude-status hook was forwarding all Claude Code lifecycle events (SubagentStop, TeammateIdle, TaskCompleted) to the honryu brain session, making subagent noise indistinguishable from the primary agent finishing. Replace per-event message formats ([DONE], [WAITING], [IDLE], [ERROR]) with a unified tagged format: [EVENT] <branch> <tag>: <summary> Tags: agent.stop, subagent.stop, teammate.idle, task.completed, agent.waiting, agent.idle By default only primary agent events (Stop, Notification) are forwarded. SubagentStop, TeammateIdle, and TaskCompleted are dropped unless KILD_HOOK_VERBOSE=1 is set in the session environment. Closes #611
Review agents found a bug: in verbose mode, TeammateIdle can write the .idle_sent gate file before Stop fires, silently suppressing the primary completion signal to the brain. Fix: introduce WRITE_GATE flag so only primary events (Stop, idle_prompt) write the gate. Verbose-only events (SubagentStop, TeammateIdle, TaskCompleted) forward but never touch the gate. Also: - Update doc comment to describe event tagging and forwarding behavior - Strengthen test assertions: verify KILD_HOOK_VERBOSE conditional expression (not just name), include TaskCompleted in forward block check, assert Stop is not gated on KILD_HOOK_VERBOSE, assert WRITE_GATE presence
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
[DONE],[WAITING],[IDLE],[ERROR]) with a unified tagged format:[EVENT] <branch> <tag>: <summary>Stop,Notification) to the honryu brain session — SubagentStop, TeammateIdle, and TaskCompleted are dropped as internal lifecycle noiseKILD_HOOK_VERBOSE=1env var to forward all events with their semantic tags for debuggingEvent tags:
agent.stop,subagent.stop,teammate.idle,task.completed,agent.waiting,agent.idleCloses #611
Test plan
sh -n) passescargo clippy --all -- -D warningscleancargo fmt --checkclean