Back to Coding

How Do You Stop an Assistant Making Sweeping Changes?

How Do You Stop an Assistant Making Sweeping Changes?
AI Tutorials Team 17 May 2026

The request was to fix one function. What comes back also renames three variables, restructures a neighbouring block, adds error handling nobody asked for and updates a comment. Every individual change is defensible and the diff is now unreviewable.

Why does it happen?

Thoroughness was rewarded. A response that addresses everything it noticed scores better than one that fixes only what was asked, and improving code it can see is the most probable continuation of a request to improve code.

There is no built-in notion that a small diff is a virtue.

Why is it a problem?

Because review effort scales with the size of the change, and the unrequested parts are the ones nobody scrutinises. A four-line fix wrapped in forty lines of tidying means the fix is reviewed as part of a large diff rather than on its own.

It also mixes concerns in the history, so reverting the fix reverts the refactor.

What is the instruction?

Change only what is necessary to fix this. Do not rename anything, do not restructure surrounding code, do not add error handling, do not update comments, and do not touch any other file. If you notice other problems, list them separately rather than fixing them.

The final clause is what makes it work, since it gives the observations somewhere to go other than into the diff.

Why does listing separately help?

Because the observations are frequently worth having. A note saying that three other functions have the same bug is valuable; the same insight applied unilaterally across three files is a review problem.

Separating the finding from the action keeps both.

Committing before starting is the other practical control, since a clean starting point means the diff shows exactly what was added and how far beyond the request it went.

What else constrains it?

  • Name the files. Explicitly, and say nothing else may be touched.
  • State a line budget. Roughly how large the change should be.
  • Ask for the plan first. And approve it before anything is written.
  • Work on one thing per session. Since a long session accumulates ambitions.

Does asking for the plan actually help?

Considerably, and it is the cheapest control available. A plan listing seven steps when you expected two exposes the scope problem before any code exists, and correcting a plan takes one message.

What if it keeps doing it?

Put the constraint in the project rules file rather than in every request. Minimal changes by default is a standing preference, and repeating it weekly is the signal that it should have been configured.

Splitting the accepted fix and the suggested improvements into separate commits keeps the history usable, which is the main practical reason the discipline exists.

Is the extra work ever useful?

Sometimes, which is why the instinct is not simply wrong. The right response is to accept the fix and take the suggestions as a separate piece of work, reviewed on its own merits, rather than to receive both in one diff.

Does it happen more in agentic tools?

Considerably, because the loop rewards apparent completeness and nothing interrupts it. A chat suggestion that overreaches is one message you can ignore; an agent that overreaches has already edited eleven files by the time you read the summary.

This is the strongest argument for asking to see the plan first. Reviewing a list of intended steps takes thirty seconds and catches the scope problem while it is still a proposal, where reviewing the result means reading a diff that mixes what you asked for with everything else it decided to do.

What is the underlying principle?

One change per change. It is an old discipline, it exists because review and version history both depend on it, and these tools push against it by default, which means it now has to be stated explicitly rather than assumed.