From 51e6057c34f244e4460db44f696b6e9b3e6bcc6e Mon Sep 17 00:00:00 2001 From: sangwook yoo Date: Mon, 18 May 2026 16:15:12 +0900 Subject: [PATCH] chore(codex): Add PreToolUse hook for graphify search context 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. --- .codex/hooks.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .codex/hooks.json diff --git a/.codex/hooks.json b/.codex/hooks.json new file mode 100644 index 00000000..6bf4e05e --- /dev/null +++ b/.codex/hooks.json @@ -0,0 +1,15 @@ +{ + "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" + } + ] + } + ] + } +}