Level 7Lesson 57โฑ๏ธ 40 min

Should You Even Build a Loop?

Loops cost real money and effort. Before you build one, run a simple test - miss one condition and the loop costs more than it saves

The Most Important Lesson in This Level

Here's a truth most excited tutorials skip: most tasks should NOT be loops.A loop has a setup cost and burns money every time it runs (the AI "thinks" in tokens, and tokens cost money). For a one-time job, a single good prompt is faster and cheaper. Building a loop for the wrong task is the number-one way people waste time and rack up surprise bills.

Plain-terms version: Don't buy a dishwasher to wash one cup. Learn to tell "dishwasher work" from "one-cup work" - that judgment is worth more than any fancy loop.

The 4-Condition Test

A loop only makes sense if it passes all four of these. Miss even one and stay in your chair and prompt by hand.

1 - The task repeats

It happens regularly (say, weekly or more). A loop spreads its setup cost across many runs. If it happens once, you don't have a loop - you have a script you ran once.

2 - Checking is automatic

There's an objective gate that can reject bad work with no human in the room- a test suite, a type checker, a linter, or a successful build. Without this, you're back to reading every result yourself, which defeats the point.

3 - Your budget can absorb waste

Loops explore: they re-read big files, retry dead ends, and burn tokens whether or not they succeed. That's fine on a big company plan; it can be reckless on a small personal one.

4 - The agent has real tools

It can't fix what it can't see. It needs logs, a place to run the code, and the ability to actually execute what it just wrote to see what breaks.

The heart of the test is #2. A loop without an automatic checker is just an agent agreeing with itself on repeat. We'll come back to this idea again and again.

The 30-Second Loop Check

The 4-condition test is your strategy. This checklist is the quick tacticalversion you run on one specific task before handing it to a loop. Can't tick every box? Keep it a manual prompt.

โ˜ This task happens at least once a week.
โ˜ A test, type check, build, or linter can instantly reject bad output.
โ˜ The agent has a live environment to run and test its changes.
โ˜ The loop has a hard stop (token cap, timeout, or max iterations).
โ˜ A human approves before anything merges or ships to production.
Notice the last two boxes. Every safe loop has a hard stop so it can't run forever and drain your wallet, and a human gate before anything real happens. We'll build both later - but they start as a mindset here.

Good First Loops vs. Bad First Loops

Some tasks are perfect to start with. Others will burn you. Know the difference.

GOOD FIRST LOOPS  (repetitive + machine-checkable)
  โœ“ CI failure triage - sort nightly build failures, draft easy fixes
  โœ“ Dependency maintenance - weekly version-bump requests
  โœ“ Lint-and-fix passes - auto-correct style on every change

BAD FIRST LOOPS  (keep a human in the chair)
  โœ— Architecture overhauls / refactoring core systems
  โœ— Authentication, cryptography, or payments code
  โœ— Production deploys
  โœ— Vague feature work where "done" is a judgment call

The pattern: good first loops are tasks a careful junior could do with a checklist, where a strong test suite would catch their mistakes. Bad ones need human judgment about what "right" even means, or are too risky to get wrong.

Who Wins and Who Loses

The economics aren't the same for everyone - and that explains why some people call loops "obvious" while others call them "reckless."

Who benefits: teams with strong test coverage, repetitive machine-checkable chores, and budgets that can absorb the token cost (often big-company plans).

Who should skip it (for now): solo builders on small metered plans (the bill arrives before the gains), codebases with no automated tests (no gate = no safety), and teams whose real bottleneck is human review (a loop just piles more into the jam).

If you're on a small plan with no tests, that's not a failure - it just means your first move is to add tests, not a loop. The loop comes later.

Hands-On: Test Your List

Hands-on (15 min): Take the 3 repetitive tasks you listed last lesson. Run each one through the 30-second check above - literally tick the boxes. Be honest, especially about box 2 ("can something automatically reject a bad result?"). Most of your tasks will probably fail on box 2 or 3 - that's normal and useful to know. Circle the one task that ticks the most boxes; that's your candidate loop for the capstone. If none qualify yet, write down the one missing piece (usually: "no automated test") - that's your real first project.
Lesson 57 Quick Reference
4-condition test

Build a loop only if: it repeats, checking is automatic, the budget absorbs waste, and the agent has real tools

The automatic gate

An objective checker (test/linter/build) that rejects bad work with no human - the make-or-break condition

30-second check

Per-task checklist: weekly, auto-rejectable, live environment, hard stop, human approval before merge

Good first loops

CI triage, dependency updates, lint-and-fix - repetitive and machine-checkable

Bad first loops

Auth/crypto/payments, architecture, production deploys, vague "done" - keep a human in the chair

Economics differ

Loops favor teams with tests and budget; solo/untested/review-bottlenecked setups should wait

โ† From Prompter to Loop Designer
Unlocks in ~10 min of reading