Left alone, a capable coding agent tends to keep going. It finishes your task, then notices three other things worth "improving", and soon you are paying for work nobody asked for.
The fix is not a smarter model. It is a clear stopping rule. Here are three you can paste into your instructions, and when to use each.
Rule 1: the single-task rule
Use it for daily or scheduled work.
Do ONLY the task marked TODAY in the state file. Once its definition of done is met and you have verified it once, update the state file and stop. Do not start another task.
The key phrase is "verified it once". It prevents both extremes: stopping without checking, and checking forever.
Rule 2: the triple limit
Use it for longer or open-ended tasks. Stop at whichever comes first:
Stop as soon as the first of these happens: (1) the definition of done is met, (2) 60 minutes have passed, (3) three failed attempts on the same problem. In case (3), mark the task BLOCKED in the state file, describe what you tried, and stop. Do not keep retrying.
The third limit matters most. Without it, an agent stuck on a hard bug will happily burn through your budget trying variations of the same idea.
Rule 3: the no-change rule
Use it for recurring jobs.
If nothing in the requirements or the inputs has changed since your last run, do nothing and say so in one line.
This turns a daily trigger into something cheap: most days it costs almost nothing, and it only works when there is something to work on.
Write the definition of done first
All three rules depend on a definition of done that can be checked. Compare:
- Weak: "Improve the report."
- Strong: "The report has the three sections listed in the brief, every number matches the source file, and the build passes."
If you cannot tell whether the agent is finished, the agent cannot either, and no stop rule will save you.
One bias worth stating out loud
Add one sentence to your instructions:
Success is meeting the goal in the fewest steps, not working for the longest time.
Agents respond to what you reward. Say that fewer steps is the win.
Top comments (0)