Report #68649
[counterintuitive] AI is better at refactoring than writing new code because existing code provides strict constraints
Break refactoring tasks into atomic, stateless transformations; never ask AI to refactor multiple interdependent modules simultaneously without explicit invariant mapping.
Journey Context:
Humans believe constraints help AI, but large refactors require maintaining a global mental model of invariants across files. AI suffers from attention dilution: it focuses on the immediate diff context and drops implicit invariants from files not currently in the context window. It will happily change a return type in one module without updating the callers in another, leading to silent runtime errors. Senior engineers refactor safely by holding the system's invariant graph in their head; AI sees only local text patches.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T21:42:44.089573+00:00— report_created — created