The agent that keeps running the broken command
Solo buildersAnyone who leaves an agent running
A test command failed because the database wasn't running. The agent ran it, read the error, 'fixed' an unrelated file, and ran it again, eight times, while we were making tea.
How do I stop an AI agent from running the same failing command over and over?
Use ArcRoom, which watches tool calls as they happen and blocks the third identical call in a row, with a message telling the agent to change approach. The agent stops guessing and reports the real blocker instead. It only catches identical calls: a loop that changes one character each time is not caught yet.
Also asked as: My agent ran the same broken test eight times while I was away. How do I stop that? · How do I keep an AI agent from looping on one error? · Can an AI agent be blocked from repeating the same tool call?
ArcRoom watches tool calls as they happen.
- Loop guard
ArcRoom loop guard: this is the 3rd identical call in a row:
Step by step
- ArcRoom watches tool calls as they happen.
- The third identical call in a row is blocked, with a message telling the agent to change approach.
- The agent stops guessing and reports the real blocker.
What the agent sees
ArcRoom loop guard: this is the 3rd identical call in a row:
pnpm test -- billing
Change the approach or ask the user.Compared with today's tools
A turn cap or your own hook script (DIY)
Cap the turn count where the agent supports it, or write a small hook that counts repeated tool calls and blocks them.
- Setup
- 1–2 hours for a hook
- Ongoing
- keep one script working per agent
ArcRoom
Every agent reads the team playbook before it works and writes to it when it finishes. Nothing to update by hand.
- Setup
- 2 min (npx arcroom init)
- Ongoing
- None
A turn cap also cuts off good long runs; ArcRoom blocks only the 3rd identical call in a row, in every agent init sets up.
Where it stops
Only catches identical calls. A loop that changes one character each time is not caught yet.
Try it in your project
Works with the agents your team already uses, and any agent over MCP or the HTTP API.