Skip to content

fix(hooks): filter and tag claude-status hook events by source#615

Merged
Wirasm merged 2 commits into
mainfrom
kild/fix-hook-event-filtering
Feb 27, 2026
Merged

fix(hooks): filter and tag claude-status hook events by source#615
Wirasm merged 2 commits into
mainfrom
kild/fix-hook-event-filtering

Conversation

@Wirasm

@Wirasm Wirasm commented Feb 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace per-event message formats ([DONE], [WAITING], [IDLE], [ERROR]) with a unified tagged format: [EVENT] <branch> <tag>: <summary>
  • By default only forward primary agent events (Stop, Notification) to the honryu brain session — SubagentStop, TeammateIdle, and TaskCompleted are dropped as internal lifecycle noise
  • Add KILD_HOOK_VERBOSE=1 env var to forward all events with their semantic tags for debugging

Event tags: agent.stop, subagent.stop, teammate.idle, task.completed, agent.waiting, agent.idle

Closes #611

Test plan

  • All 11 Claude integration tests pass
  • Shell syntax validation (sh -n) passes
  • cargo clippy --all -- -D warnings clean
  • cargo fmt --check clean

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
@Wirasm Wirasm merged commit 1dac77c into main Feb 27, 2026
6 checks passed
@Wirasm Wirasm deleted the kild/fix-hook-event-filtering branch February 27, 2026 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(fleet): filter and tag claude-status hook events by source

1 participant