Hard stop rules when agents start thrashing
Agents thrash: repeated edits, oscillating fixes, expanding scope. Hard stop rules convert thrash into escalation.
Agents thrash: repeated edits, oscillating fixes, expanding scope. Hard stop rules convert thrash into escalation. Budget attempts, freeze mutations, hand a human an evidence brief. The trap is the “one more try” loop that burns tokens and wrecks the branch overnight.
When to set budgets (and what not to do instead)

When this fits vs when it does not
Define numeric caps per task class before you start: fix attempts, files touched, minutes, or retries on the same failure signature. Related: Agent context budget when thrash is really a context dump problem.
Budget → attempt → same signature? → escalate

Budget
- Set budgets before the first edit (example: 3 fix attempts, ≤8 files, 30 minutes).
- Count retries on the same failure signature. New evidence required to continue.
- On budget hit: freeze code changes. Produce a brief: hypotheses tried, evidence, remaining risks, files touched, commands run.
- Human decides next: narrower task, more context, different approach, or abandon.
- Log thrash incidents for a few weeks to shrink tasks and tighten prompts.
Three traps that show up first

Failure modes to catch early
- One-more-try loop. Diff grows; root cause does not. Fix: same-signature counter + freeze.
- Delete-to-green. Tests removed so the session can claim success. Fix: treat test deletion as an automatic stop.
- Scope inflate. Stuck on A, rewrite B and C. Fix: path allowlist + escalate instead of widening.
A one-week practice loop
Encode budgets in the rules file for two task classes (bugfix, small feature). Run one intentional drill: give the agent a failing test it cannot fix quickly and confirm it stops with a brief. If it keeps mutating, fix permissions and prompts before blaming the model.
Bottom line
Stop rules make failure cheap and reviewable. Budget attempts, freeze on thrash, escalate with evidence. Pair with rules files that agents obey so the budgets are loaded every session.
Share