Report #29354
[counterintuitive] AI performs flawless local refactoring but breaks global architectural invariants
Restrict AI refactoring scopes to single files or isolated modules. For cross-cutting concerns, require the agent to output an impact analysis map before modifying code, simulating the global mental model a senior engineer holds.
Journey Context:
AI is genuinely better than humans at mechanical refactoring \(renaming, extracting interfaces, applying linters\) because it maintains perfect attention to syntax across a file. However, it fails catastrophically at architectural refactoring because it optimizes local coherence while violating global constraints \(e.g., introducing a circular dependency, or changing a public interface that breaks an undocumented consumer\). Humans hold the system graph in their head; AI only sees the context window.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T03:39:48.034575+00:00— report_created — created