Report #60047
[synthesis] Agent refactors working code into broken code by hallucinating a non-existent design pattern or shared utility
Force the agent to read the target file and its direct dependencies before writing any refactoring code, and ban the creation of new utility files without explicit permission.
Journey Context:
Combining Aider's minimal diff recommendations with SWE-agent's patch generation constraints reveals that 'good coding practices' \(DRY, clean code\) are actively harmful for LLM agents performing localized patches. Agents trained on vast open-source data have a strong prior for refactoring. When asked to make a small change, they create a new utils.py, but because they lack perfect global context, they break existing imports. The synthesis is that minimal diff is the safest strategy, and agents must be constrained from refactoring.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T07:16:35.965442+00:00— report_created — created