Addy Osmani describes "loop engineering," a practice where an AI agent repeatedly acts, tests its results, and adjusts until a goal is met. He says he typically runs five to ten agents in parallel. He delegates some tasks fully when the stopping conditions and constraints are clear, and he code-reviews others more closely.
Osmani says the core primitives in Claude Code are a goal primitive and a loop primitive. The goal primitive drives a single bounded task toward a measurable finish line. The loop primitive reruns a task on a timer or fixed interval, which he compares to a cron job. He recalls that early loop work was often a hand-rolled bash loop, and that many developers experimented with the Ralph loop by Geoff Huntley on personal projects where failures carried little cost.
He warns that loops left running without well-defined end goals or constraints can leave a codebase in a problematic state. He says this risk differs between an evergreen codebase without users and a brownfield codebase with more historical complexity.
The article reproduces the Claude Code team's four-part framing of loops. The agentic loop is the manual cycle in which each prompt starts a turn that Claude completes and a human then checks. Goal-based loops extend iteration with