Integrates a PreToolUse hook that provides context from the 'graphify' knowledge graph. When the AI is about to use search commands (e.g., `grep`, `find`, `ripgrep`), it will be prompted to consult `GRAPH_REPORT.md` if a graph exists, guiding it to leverage structured knowledge before searching raw files.
16 lines
679 B
JSON
16 lines
679 B
JSON
{
|
|
"hooks": {
|
|
"PreToolUse": [
|
|
{
|
|
"matcher": "Bash",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "CMD=$(python3 -c \"import json,sys; d=json.load(sys.stdin); print(d.get('tool_input',d).get('command',''))\" 2>/dev/null || true); set -- $CMD; case \"$1\" in grep|egrep|fgrep|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"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|