loopbuilder
← vibecodetools.net

// claude code workflow tool

Stop prompting.
Start looping.

A real agentic loop has a goal, sensors, and a stop condition — not just retries. Build yours in 5 steps.

↻ on fail → loop back to READ

↑ tap any node to see what happens at that stage

// anatomy of a loop

Every loop has 4 parts

Before you build anything, understand what you are building. A working agentic loop needs all four of these. Miss one and the agent either loops forever or stops too early.

The goal is the exit condition for the entire loop. Without a concrete goal the agent does not know when to stop — so it loops forever or quits too early. Your goal must be something a sensor can confirm: a test result, a diff percentage, an HTTP status code.

✓  All Jest tests pass and tsc --noEmit exits clean
✓  Screenshot diff < 1% vs reference at 375px, 768px, 1280px
✓  POST /api/checkout returns 200 with valid cart, 400 with empty

Feedforward is everything you give the agent before iteration 1 — the spec, constraints, stack rules, and file boundaries. Better feedforward means the first attempt is closer to correct, which means fewer total loop cycles. Every iteration you avoid saves tokens and context.

Stack
Next.js 14, TypeScript, Tailwind CSS, Prisma
Boundaries
Only touch /components — do not modify /api routes
Style rules
Tailwind only, match existing component patterns

Sensors are the commands that run after every ACT step to measure whether progress happened. Their output is what the agent reads at the next READ stage. Weak or single sensors create blind spots that lead to doom loops. Use at least two: one broad, one specific.

npm test tsc --noEmit npm run lint npx playwright test npm run build + custom command
Tip:  Combine at least 2 sensors — one weak signal creates doom loops because the agent can pass the sensor without actually solving the problem.

The harness reads sensor output after each VERIFY step and decides what happens next: another iteration, early success exit, or escalation to a human. For Claude Code, the harness is usually the agent itself guided by the loop spec you write here.

Manual: you read sensor output and decide whether to re-prompt or ship
Shell script: a bash loop that re-runs sensors and re-prompts on failure
Claude Code prompt: the loop spec tells the agent when to continue and when to stop and escalate
⚠️
Doom loops

An agent stuck in a failing state without a retry cap will burn tokens indefinitely. Always set a hard cap (3–5 iterations) and an intervention trigger: when the cap is hit, stop, summarize blockers, and ask a human — never keep retrying.

Read each component above, then scroll down to identify your loop type and build your spec ↓
// loop patterns

Which loop are you running?

Click a pattern to read the example — then switch to YOUR TURN to fill in your own project details. Complete the loops you need.

0 of 8 loops configured Fill in only the loops your project needs. Most projects use 3–5.

Understand the real goal before starting. Ask who the audience is, what constraints matter, and what a good result looks like.

User: “Make this presentation better.”

→ “Who is it for? Persuade, teach, or summarize? Fix wording, structure, or both?”

Break a large task into smaller parts completed one at a time. Never finish everything in one pass.

User: “Build a personal finance app.”

→ Login → Income → Expenses → Categories → Summary → Alerts

Decide what should happen before any writing, coding, or editing begins. Show the plan, get approval, then act.

User: “Rewrite this blog post.”

→ “Plan: keep the main idea, clarify opening, cut repeated points, improve headings.”

Do the approved work. Stay inside the defined scope and avoid changing anything that wasn’t asked for.

User: “Only improve the introduction.”

→ Rewrites the introduction. Does not touch the rest of the article.

Check whether what was built actually works. Run tests, confirm errors are gone, verify the output matches the goal.

Does it load? → Can user interact? → Does submit work? → Are errors shown correctly?

Diagnose step by step. Find the issue, identify the cause, make the smallest fix, test again. Never rebuild what isn’t broken.

User: “Contact form isn’t sending.”

→ Button wired? → Backend connected? → Email service configured? → Fix only the broken part.

Review from a defined point of view: teacher, customer, editor, developer, beginner. Find what was missed during the build.

Prompt: “Review as a first-time visitor.”

→ Product clear? → Headline legible? → CTA obvious? → Do I know what to do next?

Turn lessons and corrections into reusable rules. Each saved rule improves the next session. The workflow compounds over time.

User: “Stop making emails formal. Be friendly and direct.”

→ Rule: “Friendly, direct tone. No formal phrases.” Applied from now on.

Click a pattern above to get started
Complete at least 1 pattern to generate
Ready to write your loop spec?

Fill in the loops your project needs above, then use the 5-step wizard to generate a copy-paste ready prompt.

// build your loop

Design your agentic loop

1
2
3
4
5

// step 1 of 5

What kind of loop do you need?

Pick the pattern that matches your task. It pre-fills sensors and examples in later steps.

⚠ Select a loop type to continue.

// step 2 of 5

What does DONE look like?

A measurable definition of done is what separates a loop from endless prompting.

What should the agent build, fix, or change?

⚠ Describe the task before continuing.

When is this task complete? Specific enough that a sensor can confirm it.

⚠ Add a definition of done before continuing.

// step 3 of 5

Shape the first attempt ? Better feedforward = fewer loop iterations. The tighter your constraints, the closer the first attempt is to correct — and the less correction work the loop has to do.

All fields are optional — fill what you know. Every constraint you add reduces wrong-direction iterations.

Scope what the agent is allowed to touch.

Paste a brief spec, link a doc, or describe the reference.

// step 4 of 5

Pick your sensors

After every ACT step the agent runs these commands and reads the output. At least one required.

Tip: Combine at least 2 sensors — one weak signal creates doom loops. A broad test runner plus a strict type check catches different failure classes.
⚠ Check at least one sensor before continuing.

// step 5 of 5

Set your loop rules

Rules prevent doom loops. Set the cap before you start — not after the agent is already stuck.

Maximum iterations before the loop stops. Recommended: 3–5.

Max iterations: (3–5 recommended)

What must be true for the loop to exit successfully?

What should the agent do when it hits the retry cap without passing sensors?

// loop-spec.md

loop-spec.md
// loop library

Want 10 ready-made loop specs?

Write-Test, Bug-Fix, Design, Refactor and more — pre-filled and copy-paste ready. Drop your email and I'll send them when they ship.

No spam. I'll wire this to a real provider soon.

You're in.

I'll send the Loop Library when it ships.

// pre-built loops

Load an example and go

One click fills the entire wizard and generates your loop spec. Edit any step before copying.

Write–Test

New feature with full test coverage

Builds a search filter and loops until Jest tests and TypeScript checks pass.

Load this loop →
Bug-Fix

Fix driven by error logs

Patches a 500 error and loops until logs are clean and tests pass.

Load this loop →
Design

Screenshot comparison loop

Iterates on a layout until Playwright screenshot diffs hit zero regressions.

Load this loop →