Most setups run agents once and hand you whatever comes out. A team that runs in loops keeps going until the work actually passes.
Below is the setup in 3 files: the agents, the loop that drives them, and the rules that tell them when to stop.
Here's the full setup 👇
Before we dive in, I share daily notes on AI & vibe coding in my Telegram channel: https://t.me/zodchixquant🧠
Why a one-shot team isn't enough
A team that runs once is a relay race with no finish line check. The writer writes, the tester tests, the reviewer reviews, and then it all lands on you, broken parts included.
A looping team closes that gap. When the tester finds a failure, it doesn't just report it and quit. The loop sends it back to the writer, who fixes it, and the cycle runs again. You only step in when everything actually passes, or when the team hits a wall it can't get past.
The setup is 3 files: the agents, the loop, and the stop rules.
File 1: the agents
Two specialists, each with one job. Drop into .claude/agents/.
builder.md:
checker.md:
File 2: the loop
This is the orchestrator that drives the cycle. Drop into .claude/commands/loop.md:
The loop is the whole idea: build, check, and if it failed, build again.
The orchestrator passes failures from checker to builder automatically, so the team keeps going without you relaying messages.
File 3: the stop rules
A loop without brakes runs forever or fakes a pass. Put these in CLAUDE.md:
These rules are what separate a useful loop from an agent spinning in circles burning tokens.
The "same failure twice" rule is the most important: two identical failures means the team is stuck, and a human should look.
What you actually see when it runs
You type one line:
Then you watch the team cycle on its own:
That's the whole point on screen. You never relayed a single failure. The checker found them, the builder fixed them, and the loop ran to green in 3 cycles without you touching the keyboard.
Common mistakes
No cycle cap. Without "5 cycles max" a stuck team loops until your tokens run out. The cap turns an infinite loop into a clear report.
Letting the builder check itself. Same agent writing and judging means it grades its own work with the same blind spots that made the bug. Keep builder and checker separate.
No "same failure twice" rule. Two identical failures in a row means guessing, not fixing. That's the moment to stop and look, not to spend cycle 4.
Checks the loop can cheat. If the checker can pass by deleting a test, it will eventually. The stop rules forbid weakening checks for a reason.
The 10-minute setup
3 minutes: create builder.md and checker.md in .claude/agents/.
3 minutes: create the loop orchestrator at .claude/commands/loop.md.
2 minutes: add the stop rules to CLAUDE.md.
2 minutes: run /loop on a real task and watch it cycle: build, check, fix, pass.
You stop relaying failures back and forth. The team runs the loop, you read the result. It didn't get smarter, it just stopped quitting before the job was done.
Thanks for reading!
I share daily notes on AI, finance, and vibe coding in my Telegram channel: https://t.me/zodchixquant
