Most people use AI the way they used search: type something, read the answer, type the next thing. You are the loop. You read the output, spot the problem, paste the error back in. Every iteration costs your attention.
The alternative is the goal-based autonomous loop, also known as an agentic loop, or lately "loop engineering." Instead of prompting the AI yourself, you write a small program that hands the AI a goal, checks the result automatically, and feeds the failures back in until the check passes. You're no longer the person who prompts. You're the person who defines done.
This isn't a 2026 epiphany for me. I was reviewing GPT-3 use cases back before ChatGPT existed, and I built my first AI app on the GPT-3 API in 2022, before 3.5, when all you had was a raw completion endpoint and no chat interface to hide behind. Working at that level forces the lesson early: the projects that worked weren't the ones with the cleverest prompts. They were the ones where someone had defined, precisely, what a good output looked like before generating a single token. I applied that principle then because the models were too weak to survive without it. What's new isn't the idea. It's that models can finally run that feedback cycle without a human in the middle.
The whole trick in four lines
Here is the least impressive version of a loop, and it works:
while ! npm test; do
claude -p "Tests are failing. Run npm test, read the errors, fix them."
done
Run it, go make coffee. The script keeps prompting until the tests are green. No babysitting, no "looks good, now fix the next one."
That dashed "fail" arrow is the entire trick. In a chat window, you are that arrow. Here, a script is. That's the big idea everyone is repackaging into paid courses right now. The model didn't get smarter. What changed is who reads the error message: not you, the loop.
Why this works (and where it doesn't)
A loop has three parts: a goal, a check, and a retry. The prompt is the least important one. The check is everything.
A loop only works when success is something a machine can verify without taste or judgment. "All 214 tests pass" loops. "Build compiles with zero warnings" loops. "Make this code cleaner" does not loop, because nothing can tell the script when to stop. Run that filter over your own task list and it sorts itself into two piles: loopable and not. This was true in the GPT-3 era too. The loopable pile was just nearly empty back then.
If you want to find the boundary for yourself, pick the most annoying machine-checkable chore in your backlog (a lint cleanup, a flaky test, a dependency upgrade) and point the four-line loop at it. The output matters less than what you learn writing the check.
The failure modes are real and worth naming, because most posts about this conveniently skip them:
- A loop is only as honest as its check. Weak tests produce code that passes weak tests. The canonical pathological case: the agent "fixes" a failing test by deleting it, and the loop reports success. Serious loops also verify the test suite didn't shrink.
- Unattended retries burn money. A loop stuck on an impossible task at 2am will happily spend your whole budget being wrong in slightly different ways. Cap iterations. Cap tokens. Always.
- You still review everything. The loop removes the typing, not the responsibility. Code nobody has read is code nobody should ship, loop or no loop.
What this changes about the job
Prompting was a transitional skill. The leverage used to be in writing good prompts. Now the leverage is in writing good checks: tests, linters, evals. The check is what lets you walk away. The goal tells the agent what to do; the check is what guarantees the result.
One thing this is not: "AI replaces engineers." If anything, the opposite. Designing a verification harness that an autonomous agent can't cheat is a harder engineering problem than the original task, not an easier one. The people who'll get the most out of this are the ones who were already rigorous about defining done before it became a productivity hack.
My plan from here is slightly unreasonable: I will be looping everything I can. Refactors, dependency updates, report drafts, parts of my inbox. I expect most of it to resist, and not because the agents aren't capable. The hard part is never the loop. It's inventing a check for work I've always judged by feel. That's the open problem on my desk this month.
If you've built a loop that survived contact with a real codebase, I'd genuinely like to compare notes on what your check was. That's the part nobody writes up, and it's the part that matters. You know where to find me.