StoicBuilder

HandbookIV the PraetoriumBreaking the agent's loop

IVthe Praetorium, Direct the agent

Breaking the agent's loop

1 min readUpdated 28 November

In plain words

An agent loop is when each fix breaks something else or the same error keeps returning, and another "try again" only digs the hole deeper.

Where you see it

Forty minutes of clicking "Try to fix" in Lovable while the same error comes back in a slightly different form. Or Cursor fixes login, which breaks sign-up, and fixing sign-up breaks login again.

Your promptagent
Before: still broken, try again After: We've tried this four times. I've rolled back tothe last working version. Before any code: what do youthink causes the error, and how can we prove it?
Roll back, then ask for a diagnosis instead of another attempt.

What goes wrong

  1. Pressing "Try to fix" for the ninth time

    Each attempt is built on top of the last failed one. Three misses in a row is your signal to stop and try something else.

  2. Saying "still broken" with nothing new

    The agent has the same information as last time, so it makes a similar guess. Add something new: the latest error, a log line, what you clicked.

    still broken
  3. Keeping the pile of failed fixes

    Every attempt leaves code behind. Roll back to the last version that worked, so the next try starts clean.

What to tell your agent

Copy this into Lovable, Bolt, Cursor or any agent
Stop changing code. List three possible causes of this error, what would confirm each one, and add logging to find out which it is. Don't fix anything until we know.

Quick check

Sign in to earn +10 XP for it

The agent has tried to fix the same error five times. What's the best next move?

Got a prompt that touches breaking the agent's loop?

Paste it. You get a better prompt first, then the cards that explain it.

Check your own prompt

Free, no sign-up.