From 4cf6518a9f44d035599662f9257f60e30308db23 Mon Sep 17 00:00:00 2001 From: notque Date: Tue, 12 May 2026 03:16:06 +0000 Subject: [PATCH] refactor(hooks): narrow monitoring hook matchers to their signal domains MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three PostToolUse hooks previously fired on Bash|Write|Edit|Agent but only produce signal on a subset of those events: - routing-gap-recorder: scans for GAP DETECTED banners from /do skill output → only meaningful after Skill invocations; moved to Skill|Agent - record-waste: estimates token waste from tool failures → Write/Edit rarely fail with measurable token waste; narrowed to Bash|Agent - completion-evidence-check: scans for completion language in output → Write/Edit outputs never contain "I've implemented" patterns; narrowed to Bash|Agent error-learner.py stays at Bash|Write|Edit|Agent — file system errors ARE worth learning from. Net result: 3 fewer hook fires per Write/Edit operation, which is the most frequent operation class in a session. Semantics now match intent. Evolution cycle 2026-05-12, STRONG consensus (3.0/3.0). --- .claude/settings.json | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.claude/settings.json b/.claude/settings.json index 08250e39..a071a4c8 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -306,6 +306,12 @@ "command": "python3 \"$HOME/.claude/hooks/usage-tracker.py\"", "description": "Record Skill and Agent invocation analytics", "timeout": 3000 + }, + { + "type": "command", + "command": "python3 \"$HOME/.claude/hooks/routing-gap-recorder.py\"", + "description": "Record /do routing gaps to learning DB for pattern tracking", + "timeout": 2000 } ] }, @@ -334,13 +340,12 @@ "command": "python3 \"$HOME/.claude/hooks/error-learner.py\"", "description": "Learn from tool errors and suggest solutions", "timeout": 3000 - }, - { - "type": "command", - "command": "python3 \"$HOME/.claude/hooks/routing-gap-recorder.py\"", - "description": "Record /do routing gaps to learning DB for pattern tracking", - "timeout": 2000 - }, + } + ] + }, + { + "matcher": "Bash|Agent", + "hooks": [ { "type": "command", "command": "python3 \"$HOME/.claude/hooks/record-waste.py\"",