Free playbooks in your inbox
Cover of Claude Code Loops
From the youcanbuildthings catalog · ▸ Build-tested

Claude Code Loops

Stop Prompting, Start Shipping

eBook: $12.99 186 pages

You are the bottleneck. You prompt, you wait, you read the diff, you prompt again, and the agent stops the second you stop typing. This book hands you the fleet that ships without you. Your first loop runs on a real repository in Chapter 1, in ten minutes. By Chapter 4 you have built the same task four ways and priced each one, so you reach for the right loop instead of the loud one. By Chapter 6 a separate verifier signs off before code reaches your branch, and the working agent cannot talk its way past it. By Chapter 9 a night of agent work has a price you knew before you pressed enter. By Chapter 12 your loops run on a thirty-day schedule, wired so one loop's verified output becomes the next one's input.

Loop engineering is not a rebrand of the software development lifecycle. It is iterative development where the iteration is executed by something that cannot be trusted to report its own results, and that one difference changes every piece of the engineering around it.

This book refuses to print numbers it cannot verify. The four-bill comparison table in Chapter 4 ships blank on purpose, the rate sheet in Chapter 9 ships with underscores, and the most-quoted dollar-per-hour figure on the internet is named and then left unprinted. You fill those in from your own runs, because a printed rate is a wrong rate eventually.

Every loop, hook, gate, and receipt ships in a free companion GitHub repo: one folder per chapter, and one command that installs the whole set into a project you already own. Every command is tested on Linux, WSL, and macOS.

What You'll Build

01
The Loop That Stopped While You Read This

Run a complete loop on your own repository in ten minutes, with a hard cap and a dollar ceiling set before the first iteration.

02
The Ladder, and Where Each Rung Breaks

Measure which rung you are actually on from your own session transcripts, not your own opinion.

03
The Contract Comes Before the Loop

Write the four contract files your loop reads every iteration, then watch it refuse work outside the scope boundary.

04
Four Loops, One Task, Four Bills

Build the same task four ways and record iterations, wall clock, and dollars for each. The cost spread is the lesson.

05
Defining Done

Replace 'loop until done' with an exit condition a computer evaluates, plus four enforced invariants that halt a runaway.

06
Never Let It Grade Its Own Homework

Stand up a separate verifier that gates on evidence on disk, then make the working agent lie on purpose and watch it get refused.

07
Recovery Is the Job

Build the four-rung escalation ladder so a stuck run climbs instead of replaying the same prompt into the same context.

08
What Survives Between Iterations

Build the state store and harness, then measure re-fetched tokens before and after on your own run.

09
The Ceiling and the Receipt

Instrument the loop to meter itself, enforce a hard dollar ceiling that halts mid-run, and print a per-iteration receipt.

10
Loops That Pay for Themselves

Build a break-even model from your real rate and your metered cost, then reconcile it against one overnight run.

11
Every Way a Loop Fails

Ship loop-doctor: a diagnostic that reads a run's logs and names which failure mode fired and which guard would have caught it.

12
Fleets, Graphs, and the Next Thirty Days

Wire two loops into a dependency graph where the second refuses to start if the first fails its gate, then schedule the fleet.

Free Articles from this Book

analysis

Are Your Overnight Claude Agents Making You Money?

Work out in dollars whether an overnight Claude Code run made you money, using its own result files and your hourly rate. In a worked example the tokens cost $6.40 either way, but checking the work line by line takes the cost per usable change from $13.63 to $43.71.

from: Claude Code Loops

how-to

What to Do When Claude Code Gets Stuck in a Loop

When Claude Code gets stuck in a loop overnight, make it try something different each time and stop with a note after 4 tries. Wrong API keys, blocked files and an empty budget are never retried, and each try gets its own slice of the budget.

from: Claude Code Loops

how-to

Why Claude Code Fails Overnight

Find out in one command why last night's Claude Code loop failed and what to do about it. There are 6 ways a loop fails, each leaves a trace in the loop's own result files, and the most common fake success comes from a check that exits 1.

from: Claude Code Loops

tutorial

How to Build a Multi-Step Loop With Claude

Run two Claude Code loops back to back every night, where the second only starts if the first one's work passed its check. It takes four checks in shell, and the schedule has to live somewhere other than /loop, whose recurring tasks expire 7 days after creation.

from: Claude Code Loops

analysis

Are You a Loop Engineer or Still Babysitting Claude Code?

Find out whether you are doing loop engineering or still babysitting Claude Code, with two numbers from your own sessions. The rung audit scores turns per finished task and how often you repeat yourself, and it never parses a transcript file.

from: Claude Code Loops