feat: add PreToolUse search enrichment via code-review-graph enrich#103
Open
gzenz wants to merge 1 commit intotirth8205:mainfrom
Open
feat: add PreToolUse search enrichment via code-review-graph enrich#103gzenz wants to merge 1 commit intotirth8205:mainfrom
gzenz 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
gzenz
added a commit
to gzenz/code-review-graph
that referenced
this pull request
Apr 6, 2026
…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
reviewed
Apr 8, 2026
Owner
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.
Contributor
Author
|
@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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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