How to stop an AI agent's scope creep and keep track of what it finds

An AI coding agent changes things you didn't ask for when the request leaves the edge of the work open and gives the agent nowhere else to put what it notices. To stop the scope creep, say in the request what is out of scope, tell the agent to report other problems and leave them alone, and check the list of changed files against the request before you read any code. To keep track of what the agent finds, give its reports a place outside the chat, because they are a review of your code that you got as a by-product.

Why an agent edits code outside the task

Ask an agent to add a CSV export to an orders page and it reads far more than the export needs: the page, the endpoint behind it, the date helpers, the tests. In that code it finds a date helper that ignores time zones, a test that has been skipped, and an endpoint that returns every order with no page limit. Nothing in the request says what to do with them.

The vendors describe the tendency themselves. Anthropic's prompting guide says that some Claude models "have a tendency to overengineer by creating extra files, adding unnecessary abstractions, or building in flexibility that wasn't requested". Birgitta Böckeler, testing spec tools in October 2025, watched an agent "go way overboard because it was too eagerly following instructions".

So the export arrives with three more edits inside it. The date helper is corrected, the skipped test is switched back on and the endpoint has a default limit of 100.

What the extra edits cost you

Each of the three edits may be right. None of them was asked for, so none has a requirement to be checked against, and the review of a CSV export is no place to find out that every caller of the orders endpoint receives 100 rows where it used to receive all of them.

The edits also travel together. If the export has to be reverted, the time zone fix goes with it. If the time zone fix breaks a report, the commit that broke it is called "Add CSV export".

Put the boundary in the request

A request with no boundary reads like this:

Add a CSV export to the orders page.

The same request with its edge drawn:

Add a CSV export to the orders page: a button that downloads the orders
listed on screen, with the columns the table shows.

Out of scope: the orders endpoint, the date helpers, existing tests,
anything outside src/orders/export and the orders page component.

If you notice a problem outside this scope, don't fix it. At the end, list
each one under "Noticed" with the file, what is wrong and why it matters.

The last paragraph matters as much as the list above it. An instruction that only forbids leaves the agent holding a defect it has found and no permitted way to act on it. Asking for a report gives the finding somewhere to go.

For a change larger than one request, the boundary belongs in a written specification (spec), and checking the result against that spec is the core of spec-driven development. How to write a spec for an AI coding agent has a template with an out-of-scope section, and how to break down a spec explains why small specs have edges that are easier to hold.

Check the changed files before you read the code

Run this before the review:

git diff --stat

For the export you expect the page component, one or two new files under src/orders/export and their tests. A date helper in that list is the finding, and you have it in ten seconds. Ask the agent to move that edit out of the change before you read a line of the export.

A second agent session can do the same check on a longer change. Anthropic's best practices for Claude Code give a review prompt that asks a fresh session to confirm that "nothing outside the task's scope changed". A fresh session helps because it sees the diff and the request without the reasoning that produced the edits.

For the few places an agent must never touch, an instruction is too weak. The same guide separates instructions, which are advisory, from hooks, which "are deterministic and guarantee the action happens", and gives a hook that blocks writes to a migrations folder as its example. Use a hard block for generated code, migrations and secrets, and a stated scope for everything else.

Where to keep what the agent noticed

The "Noticed" list at the end of the session is worth keeping. An agent has read your code closely and told you what is wrong with it, and the list needs a place to live after the chat is closed.

Place Survives the session The next agent session sees it What it costs
The chat transcript No No Nothing, and it is lost
A TODO comment at the code Yes Only when it reads that file An edit outside the scope
A file in the repository, such as FOLLOWUPS.md Yes Yes, if your rules point to it Merge conflicts between branches, and no way to mark an item done except deleting it
Your issue tracker Yes Yes, with a connection to the tracker A ticket per finding, among tickets written for people
A backlog the agent can write to and read Yes Yes One more tool

I'd use the file for a project I work on alone and the tracker when other people have to see the findings. A TODO comment contradicts the scope you set a moment ago, and the transcript is the same as throwing the list away.

The last row is what some spec-driven development tools provide. BMAD Method writes what its build step leaves aside to a file of follow-ups, as the comparison of BMAD Method and Athenode describes. In Athenode, the local console for AI coding agents I make, the backlog is a set of ToDo cards, short notes of work to do later. When the agent has finished implementing a spec, it lists what it noticed outside the spec and you choose which items become cards. An agent later carries out the cards that need no answer from you.

A note that still makes sense next month

Wherever the list lives, each item has to be readable without the session that produced it. That takes the place, the defect and the consequence:

## Orders endpoint returns every order with no page limit

Where: src/orders/api/list.ts, GET /api/orders
Found while: adding the CSV export
What is wrong: the handler has no limit, so the orders page loads every
order the account has. An account with 40,000 orders gets all of them.
Why it matters: page load time grows with the account, and the export
inherits the same query.
Open question: should the default page size be 50 or 100?

The open question tells you at a glance which items an agent can do alone and which are waiting for you.

Sort the list into fixes, specs and nothing

Go through the list at a fixed moment, such as the end of each working day, while you remember the session each item came from. Each item gets one of these outcomes:

  • A fix that needs no decision, such as the skipped test, goes to an agent as its own request and its own commit.
  • A change with a decision in it, such as the page limit, becomes a spec once the question is answered.
  • An item that isn't worth doing is deleted.

When fixing it in place is the right call

The strongest objection to all of this is that a separate round for a two-line fix wastes time. For a finding that stands apart from the task, I think the separate commit is still worth it, because the fix is then reviewed for its own sake and can be reverted without the export.

One case is different. If the export can't be correct while the date helper ignores time zones, the helper is part of the task and the first scope was wrong. Stop, widen the scope in the request or the spec, and say so in the commit. The scope changed because you decided it, and the diff matches the scope you stated.

Sources

Start with one mind map

Install Athenode, run athenode init in your repository and answer your agent's questions about the next thing you want to build.

Install for free

Free on your machine, with no account.