feat(code-review): add pattern learning to auto-suggest CLAUDE.md rules#31974
Closed
kpatel513 wants to merge 1 commit into
Closed
feat(code-review): add pattern learning to auto-suggest CLAUDE.md rules#31974kpatel513 wants to merge 1 commit into
kpatel513 wants to merge 1 commit into
Conversation
This was referenced Mar 8, 2026
This was referenced May 22, 2026
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
Every review the plugin runs produces signal that currently disappears. If the same category of issue gets flagged across multiple PRs, that's a gap in the repo's CLAUDE.md — but today nothing surfaces it.
This adds a pattern learning layer that silently tracks validated issues across reviews, detects recurring patterns (3+ occurrences in the last 5 PRs), and proposes targeted CLAUDE.md changes directly in the terminal. The system also checks whether an existing rule already covers the pattern — if so, it suggests strengthening it rather than adding a duplicate.
The result: the plugin gets smarter the more you use it. Each review makes the next one cheaper.
How it works
Storage:
.claude/review-patterns.jsonin the repo root (automatically gitignored). Schema:{ "version": 1, "patterns": [ { "id": "uuid", "summary": "missing error handling in async functions", "occurrences": [ { "pr_number": 123, "pr_title": "feat: add OAuth", "files_affected": ["src/auth.ts"], "issue_description": "OAuth state not cleaned up in finally block", "reviewed_at": "2026-03-07T10:00:00Z" } ] } ] }Threshold: 3 or more occurrences across the last 5 distinct PRs reviewed.
Terminal output when threshold is hit:
If an existing rule already covers the pattern but violations keep occurring, the plugin suggests strengthening it instead of adding a duplicate.
Changes
plugins/code-review/commands/code-review.md.claude/review-patterns.jsonwith new occurrences, detect patterns meeting the threshold, and cross-reference existing CLAUDE.md rulesDesign decisions
Test plan
.claude/review-patterns.jsonis created and gitignored automaticallynto all suggestions — store should still be updated, no CLAUDE.md changesy— CLAUDE.md should be updated with the drafted rule