Agent behavior — over-engineering instead of minimal fixes

Where does the bug appear (feature/product)?

Somewhere else…

Describe the Bug

Subject: Agent behavior — over-engineering instead of minimal fixes

Hi,

We use Cursor Agent on a real production codebase. The model often understands when we point out a mistake, agrees it was wrong — and then repeats the same pattern on the next task.

This is not a “model doesn’t know better” issue. It behaves as if finishing quickly with a “complete” solution matters more than following user rules and touching as little code as possible.

The recurring pattern
We ask for a small change: a validation, a field that should clear on load, one extra value in a string, etc.
Instead of fixing one or two lines where the value is already read/written, the agent:
adds a new helper function (often 15–30+ lines),
duplicates logic that already exists elsewhere in the same flow,
wraps simple DOM + state updates in unnecessary abstractions.
When we complain, it apologizes and “fixes” it — sometimes by adding another helper, then removing it after more complaints.
User rules and project rules (including explicit “minimum intervention / minimal diff” instructions) are not applied consistently. They lose against the default habit of expanding scope.
Why this hurts
Larger diffs → more merge conflicts and regressions.
Two sources of truth for the same data (loader + new helper + sync logic).
Refactors become worse, not cleaner.
We spend time removing code we never asked for.
Concrete examples of wrong vs right (same session)
Example A — add an amount to a summary text

Wrong: New calculation helper + extra pre-compute block + second loop over the same items (50+ lines).
Right: Reuse totals already computed in the existing loop; append formatted amount to the string (a few lines).
Example B — empty field still shows previous assignment after load

Wrong: New “apply from load” helper that sets DOM + state (15+ lines).
Right: Fix a single falsy check (“” treated as “no value”) and use the existing field-update mechanism already used for every other form field (2–3 lines).
Example C — block export when dropdown is empty

Wrong: Could have been one validation block; sometimes paired with dead logic from removed UI.
Right: Same validation pattern already used for another step in the same submit path — copy the idea, don’t invent a framework.
What we need from the product / model behavior
Not more tips in docs — enforced behavior:

Read first: Before editing, find where this value is already loaded, synced, validated, or rendered.
Reuse, don’t wrap: Extend the existing path; do not add a new function for a one-off.
Line budget for bugfixes: Target ≤5 lines in the relevant place. If more is needed → ask the user first, do not implement.
Hard ban without explicit user approval:
new function/module/helper for a single field, single validation, or single format string;
second calculation of data already computed in the same request/flow;
“while I’m here” refactors outside the requested scope.
User/project rules must outrank the default “ship a thorough solution” instinct — especially rules marked always-apply.
Suggested product / training changes
RLHF / training: Penalize “new helper for one-field fix”; reward “fixed in existing function with minimal lines.”
Agent planning step: Mandatory “locate existing update site” before “implement”; block “create new function” when there is only one call site and the user did not ask for abstraction.
Rule enforcement: Treat user and project rules as hard constraints, not soft suggestions buried in context.
Optional diff guardrail: Warn or pause when a labeled bugfix grows beyond N lines or adds new functions without user confirmation.
Bottom line
We do not need an agent that writes more code to look competent. We need an agent that reads existing code first, changes less, and obeys rules every time — even when a helper would “feel” cleaner to the model.

Thank you.

Steps to Reproduce

Operating System

Windows 10/11

Version Information

For AI issues: which model did you use?

Cursor 2,5 fast

Does this stop you from using Cursor

No - Cursor works, but with this issue