Hook

Anthropic just dropped a guide on exactly how to use loops in Claude Code. Think of a loop as an agent repeating cycles of work until a stop condition is met. And there are 4 types, from beginner to fully hands-off. Type 1 is turn-based. This is what most people do already. You prompt, Claude works, you check the result, you prompt again. Every single prompt is technically a loop... you're just the one running it. Type 2 is goal-based. You type /goal and define what done looks like. The example from the guide. Get the lighthouse score to 90 or above. Stop after 5 tries. Claude can't quit early. Every time it tries to stop, the model checks the condition to send it back to work. Type 3 is time-based. /loop prompt runs a prompt on an interval. Like every 5 minutes, check my PR, address review comments, fix failing CI. The catch is, /loop runs on your computer. Turn it off and it stops. /schedule moves the routine to the cloud, and it keeps running without you. Type 4 is proactive loops. This is where you combine everything. You might schedule a routine to check feedback every hour, then set a goal so it doesn't stop until every bug is triaged and actioned. Use a workflow to explore three fixes in parallel, then have an agent review them. And for this, no human is needed in real time. One warning though, not every task needs a complex loop. Start simple. Level up only when the task demands it. I've summarized the whole guide: all four loop types, the exact prompts, and how to keep token usage in comment. Comment "LOOPS" and I'll send you the link.
Their other posts in the index, biggest breakout first.