From 858e7a7fc7d44bc482a613545729e045c0d6ec90 Mon Sep 17 00:00:00 2001 From: bastien Date: Wed, 6 May 2026 17:08:57 +0200 Subject: [PATCH] fix(settings): scope graphify pretool hook to Bash search commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Matcher was Glob|Grep — those tool inputs have no `command` field, so the hint never fired. Switch to Bash matcher and gate on the actual command substring (grep, rg, ripgrep, find, fd, ack, ag) so the graphify hint only injects when Claude is about to scan raw files. Co-Authored-By: Claude --- .claude/settings.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.claude/settings.json b/.claude/settings.json index f69c7c6..eb18c34 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -2,11 +2,11 @@ "hooks": { "PreToolUse": [ { - "matcher": "Glob|Grep", + "matcher": "Bash", "hooks": [ { "type": "command", - "command": "[ -f graphify-out/graph.json ] && echo '{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"additionalContext\":\"graphify: Knowledge graph exists. Read graphify-out/GRAPH_REPORT.md for god nodes and community structure before searching raw files.\"}}' || true" + "command": "CMD=$(python3 -c \"import json,sys; d=json.load(sys.stdin); print(d.get('tool_input',d).get('command',''))\" 2>/dev/null || true); case \"$CMD\" in *grep*|*rg\\ *|*ripgrep*|*find\\ *|*fd\\ *|*ack\\ *|*ag\\ *) [ -f graphify-out/graph.json ] && echo '{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"additionalContext\":\"graphify: Knowledge graph exists. Read graphify-out/GRAPH_REPORT.md for god nodes and community structure before searching raw files.\"}}' || true ;; esac" } ] }