feat: add PreToolUse search enrichment via code-review-graph enrich#103
feat: add PreToolUse search enrichment via code-review-graph enrich#103gzenz wants to merge 1 commit intotirth8205:mainfrom
Conversation
b7b0403 to
29d232a
Compare
When agents use Grep/Glob/Bash(rg/grep)/Read, a Claude Code PreToolUse hook automatically enriches results with structural context from the graph: callers, callees, execution flows, community membership, and test coverage. Zero-friction adoption -- agents get structural context passively without calling graph tools explicitly. - New enrich.py module with pattern extraction and graph queries - New `enrich` CLI subcommand (reads hook JSON from stdin) - Updated hooks config in skills.py (Grep|Glob|Bash|Read matcher) - 24 new tests in test_enrich.py - Updated all docs: CHANGELOG, CLAUDE.md, COMMANDS, FEATURES, LLM-OPTIMIZED-REFERENCE, ROADMAP, USAGE
29d232a to
622e69a
Compare
…h8205#103 Combine nested hooks format from tirth8205#100 with permissions and enrich hook from tirth8205#103. Rename PreCommit -> PreToolUse, use nested hooks arrays. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
tirth8205
left a comment
There was a problem hiding this comment.
Major feature — passive graph enrichment via PreToolUse hooks is a compelling idea. New enrich.py module + CLI command + 237 lines of tests.
This needs rebase on latest main (has conflicts). We'll review the enrichment pipeline and hook integration in detail once it's rebased.
|
@tirth8205 thanks for your feedback. actually, instead of opening further pr's, i worked locally quite a bit and did many more improvements. for the sake of simplicity, i'll open a new pr based on current master with all of them. |
Review: PR #103 — feat: PreToolUse search enrichmentThis PR is superseded by PR #158. gzenz explicitly confirmed this in the comments: 'instead of opening further prs, i worked locally quite a bit and did many more improvements. for the sake of simplicity, i'll open a new pr based on current master with all of them.' PR #158 includes the enrich.py module, the enrich CLI subcommand, updated hooks config in skills.py, and 24 tests — all from this PR — plus significant additional improvements. Recommendation: Close this PR in favor of #158. The rebase that the owner requested was also never completed. |
|
Superseded by #158. |
Summary
When agents use Grep/Glob/Bash(rg/grep)/Read, a Claude Code PreToolUse hook automatically enriches results with structural context from the graph. Zero-friction adoption -- agents get structural context passively without calling graph tools explicitly.
enrich.pymodule with pattern extraction and graph queriesenrichCLI subcommand (reads hook JSON from stdin)skills.py(Grep|Glob|Bash|Read matcher)test_enrich.pyWhat the hook injects
For each search pattern, the enrichment provides:
For file reads, it provides the same structural context for all functions/classes in the file.
Upgrade note
If upgrading from v2.1.0, delete the
<!-- code-review-graph MCP tools -->section from your CLAUDE.md and re-runcode-review-graph installto get the updated lighter instructions.Test plan