Morning Brief
‹ Brief
Matthew Berman · 2d ago · AI & Tech

7 INSANE loops you need to try right now

TLDR

🔁 What a loop actually is, stripped of the theory

Matthew Berman reckons loops are the single biggest unlock for people building software with AI right now. And his gripe is that most folk who bang on about them never tell you what they are or hand you anything you can actually use. So he did both.

A loop is just a way to let your AI coding agent work on its own toward a set goal, with the human pulled out of the middle so it moves fast. That's it. Two ingredients: a trigger and a goal.

The trigger is what kicks it off. Three ways. Manual (you tell it to go). Scheduled (runs at a set time or on repeat). Or action-based (fires when something happens, like opening a PR). Pull the human out entirely and you'd lean on schedule and action, but sometimes manual is just what you need.

The goal is one of two types. Verifiable: something concrete you can test deterministically, like "100% test coverage." Or LLM-as-judge: you let the model decide when it's done, like "refactor until satisfied." Verifiable is the strong one. The judge version is where it gets wobbly, but we'll come back to that.

🛠️ The seven loops, copy-paste ready

Berman's built a free Loop Library (hosted on Vercel, which he kept calling "here.now") with the loops he uses plus ones he's nicked off other people. Here's the actual cargo.

The sub-50ms page load loop is his favorite, and it's the cleanest example going. The prompt: "continue optimizing the code for speed. After each significant change, measure page load performance across every page under the same repeatable test conditions. Continue until every page loads in under 50 milliseconds." You copy it, paste it into Codex, and type `/goal` (Claude Code has the same feature). That tells it to keep working until the condition's met. He manually triggered his, it ran for nearly 50 minutes, walked through every page, and dragged each one under 50ms. Verifiable goal, dead simple.

The overnight docs sweep: each night, review the whole codebase, update docs to match the previous day's changes, then open a PR. Set up as a recurring automation via Codex's automations tab. This one's LLM-as-judge because there's no clean way to verify "complete docs."

The architecture satisfaction loop, which Peter Steinberger himself uses: "refactor until you are happy with the architecture." Trigger and goal in one line. You can sharpen it ("be very strict about simplicity," "make sure every line is DRY"), have it live-test and run auto-review after each step, and track progress in a markdown file so it logs its own looping. Run nightly to keep things clean.

The logging coverage loop: "review the system's logging and add missing coverage until every important path produces useful, tested logs." LLM-as-judge, since "important" is non-deterministic. The LLM decides what matters.

Then the clever bit. The production error sweep builds straight on top of logging. Every night, review production logs for errors, trace any actionable issue to root cause, fix it, verify, open a PR, then ping him in Slack with findings and the PR link (or ping to say nothing's wrong). Two loops stacked: one fills the logs, the next acts on them. That's where the power shows.

The SEO GEO visibility loop: run an audit across crawlability, indexation, page intent, titles, internal links, structured data, source citations, answer-first content. Rank the gaps, fix the highest-leverage ones, rerun the crawl, repeat until no critical issues remain. Good weekly job.

And the full product evaluation loop, which he calls his most handwavy but swears by. Create N realistic scenarios covering every capability, define success criteria up front, run them all under the same conditions, record evidence, fix root causes of failures, rerun, continue until everything clears the quality bar. Sounds like a test suite, but it's non-deterministic: the LLM judges good enough. It can run 12 hours plus, and produces genuinely good optimizations. He's using a custom version that generates 100 question scenarios for an LLM and judges whether each answer is accurate with sources.

💸 Where loops fall on their face

Right then, the honest part. Two big caveats, and Berman doesn't dodge them.

One: loops aren't for everything yet. The hard part is writing the goal. Verifiable goals are perfect. LLM-as-judge is brittle because you're handing taste to the model. And feature building is the wall. You can't say "loop until you've built a full permissioning system," because you've no idea which direction the thing will wander. He tried cloning Excel feature-for-feature with a loop, it used computer-use to actually open Excel and click through, and it ran for days and days before he killed it. He does not recommend that.

Two: loops are expensive. They churn tokens autonomously until they hit the goal. Ten minutes, or days. Great if you're a token-maxer. If you're on a budget, this isn't your week.

He's offering a few free consulting sessions on loops and AI, and the video had Digital Ocean as sponsor (pitched on cheaper, predictable production inference).

Verifiable goal, leave it running. Vague goal, watch your wallet melt.

Watch on YouTube › ‹ Back to the brief