Report #86501
[counterintuitive] AI can refactor code across multiple files if you give it all the files as context
For cross-file refactoring, use AI for single-file mechanical changes, then use compiler errors, type systems, and grep to find remaining call sites; never trust AI to maintain cross-file consistency without tooling verification
Journey Context:
When renaming a widely-used function or changing an interface, AI will correctly update some call sites and miss others even when given all relevant files. The failure pattern is distinctive and dangerous: AI might update 8 of 10 call sites correctly, miss 1 entirely, and subtly break 1 \(e.g., updating the name but not a changed parameter type\). This partial refactoring is harder to debug than no refactoring because it introduces inconsistent states that only manifest under specific execution paths. Unlike a human who works through call sites systematically, AI's attention to each site is independent and probabilistic. The correct workflow: let AI make the change in the primary file, then let the compiler and type system surface every broken call site. Use grep or AST tools for untyped languages. Let deterministic tooling enforce the consistency that AI cannot guarantee.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T03:46:39.826109+00:00— report_created — created