I made two short videos on loop engineering in Claude Code, and this post is the written version so you do not have to pause and rewind to catch the commands. The reason I bothered: Boris Cherny, who runs Claude Code at Anthropic, said he does not prompt Claude anymore, his job now is to write loops. Peter Steinberger, creator of open claw, said the same, stop prompting coding agents and start designing loops that prompt them. There are hundreds of articles on this with 14-step roadmaps. You need two commands to start.
One file, one command
The first video is a small live demo. A tasks.md file holds pending work, and one command runs the show:
/loop 2m /goal Check tasks.md and implement every pending task
Claude wakes every two minutes, sets a goal from whatever is in the file, and works until it is done. On camera I keep a second session open and just add tasks, build a simple coffee shop site, then a consulting site, and the loop picks each one up on its next pass. When a task was already marked complete it skipped it instead of rebuilding. I am not prompting at that point, only adding to the list.
Why /goal and /loop are not the same
People mix these up because both are loops. The second video draws the line, and here it is in text.
/goal is the inner loop
/goal takes one bounded task with a condition and repeats until the condition is met, then stops. You can say “write unit tests for each file and don’t stop until coverage is 90%,” and Claude tracks coverage with a library like pytest and keeps working until it hits the number. It holds the line even if your tokens expire or the internet drops mid-run. I had one goal run for eight hours straight.
/loop is the outer loop
/loop is a cron job. It runs a command on a schedule, every minute, every hour, every 12 hours, and never assumes the job is done. Point it at /goal and the outer loop keeps checking for new work while the inner loop finishes each piece. That is the whole of loop engineering: a scheduler watching for work, a goal completing it. On longer runs I add exit conditions and a verifier so it does real work instead of spinning and burning tokens.
Beyond a text file
tasks.md is the simplest possible queue. The same loop can read from Notion, GitHub Issues, Linear, or Slack through MCP or an API, with a human review step wherever the output ships.
Codex note
You can run the same pattern in Codex, but /loop is not available there. The outer loop has to be a shell script on cron calling Codex, while the goal logic stays the same.
Starter repo
Grab it here: https://github.com/ravsau/ai-tutorials/tree/main/loop-engineering-starter
Watch both videos for the full walkthrough and subscribe for more.
I specialize in setting up agent loops and automation for engineering teams. Book a call at cloudyeti.io/meet.