Addy Osmani breaks down how he uses Claude Code's loop engineering primitives - goal (a bounded task driven to a measurable finish line by an evaluator model) and loop/schedule (recurring or interval-based reruns) - to manage 5-10 parallel agents daily. He walks through the Claude Code team's four loop categories (agentic, goal-based, time-based, proactive), shares real prompt examples for refactoring performance and triaging PRs/issues on his 80k-star Agent Skills repo, and stresses that developers must never delegate judgment or taste to the agent, only the task. He also notes fine print: recurring loops expire seven days after creation (not three, as he'd previously stated), are session-scoped unless resumed, and /schedule is needed for tasks that must survive beyond a session.
Table of contents
Before the primitives were primitivesHow the Claude Code team frames loopsGoalLoopWhat I delegate, and what I watchThe workflow I run every dayCombining loops and goalsWhat the triage system actually doesWhat loops don’t buy youThe fine printQuestions this post answers
How long do recurring loops last in Claude Code before they expire?
Recurring loops created with /loop expire seven days after creation, not three days as was previously believed. Loops are also session-scoped, meaning they stop when a new conversation starts, though resuming the original session with --resume or --continue restores any recurring task still inside its seven-day window. For tasks that need to outlive a session entirely, /schedule runs them in the cloud instead. Track nuances like this loop expiration behavior by following daily.dev coverage of Claude Code agent workflows.
What is the difference between the goal and loop primitives in Claude Code?
The goal primitive drives a single bounded task forward until a measurable finish line is met, using an evaluator model that checks a defined success condition each time Claude tries to stop, such as a Lighthouse score threshold or number of tests passing. The loop primitive instead reruns a prompt on a fixed interval like a cron job, suited for polling logs, monitoring external state, or checking a PR for new CI failures. Compare agent primitives like goal and loop on daily.dev before deciding how to structure an automation.
What kinds of tasks are a bad fit for AI agent loop engineering?
Loop engineering fails when there is no clear, measurable definition of done, such as vague goals like keep going until this UI design is good. Tasks requiring human taste, subjective design judgment, or open-ended creative exploration are not a good fit, because an evaluator model can only check whether stated hard rules were met, not whether the output is actually good. Weigh where agent autonomy helps versus where human judgment matters using discussions curated on daily.dev.
80.8K Impressions1 Comment