[Feature Request] Cross-file consistency: auto-grep repo after fixing a pattern

Resolved 💬 2 comments Opened Apr 10, 2026 by 2tbmz9y2xt-lang Closed Apr 10, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single report
  • [x] I am using the latest version of Claude Code

Summary

Follow-up to #45731 (cross-file consistency) and #45738 (Pattern 3).

When Claude fixes a bug in one file, it does not check the rest of the repository for the same pattern. This happened 3 times in a single session for 3 different bug classes:

  • Fixed path traversal in file A, same vulnerability existed in file B
  • Removed unused import in file A, same unused import existed in file B
  • Fixed error handling in layer 3, same broken handling in layer 2

Each time Claude wrote a reflection saying 'next time I will check both layers.' Each time it did not.

Proposed Solution

After every bug fix, automatically run:

grep -rn "FIXED_PATTERN" --include="*.ext" .

If the same pattern exists in other files → fix all occurrences in the same commit. One-file fix when the pattern is multi-file = half-work.

This could be a PostToolUse hook on file writes: extract the changed pattern, grep the repo, warn if found elsewhere.

Why This Matters

150+ review threads in #45731 — many were the exact same bug class appearing in parallel files. Cross-file grep before commit would have caught these in round 1 instead of round 5.

Environment

  • Claude Code CLI (latest)
  • Model: Claude Opus (Max plan)
  • macOS

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗