Report #85414
[synthesis] Agent refactors working code into broken abstractions across multiple files
Constrain the agent's refactoring scope to a single file or function per step, and require passing tests before any structural changes are committed.
Journey Context:
When tasked with improving or cleaning up code, LLMs tend to over-abstract \(e.g., adding unnecessary design patterns, splitting a simple script into 5 modules\). Because the agent operates across multiple steps, it updates imports and references, often missing a dependency, which breaks the build. The agent thinks it's doing a good job by following software engineering best practices, but it lacks the holistic project context. Restricting refactoring to localized, test-verified steps prevents cascading import errors and broken dependency chains.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T01:57:15.249723+00:00— report_created — created