Science & Technology

Claude Code /goal vs /loop Explained (When to Use Which)

by CloudYeti | Practical AI Engineering

Share:

📚 Main topics

  • /loop as a scheduled outer loopThe /loop command runs a prompt or command on a recurring schedule, much like a cron job. 0:30
  • /goal as a condition-based inner loopThe /goal command keeps working toward a specified condition, such as completing tasks or reaching 90% test coverage, until it is achieved or blocked. 1:33
  • Combining /loop and /goalA scheduled /loop can repeatedly invoke a /goal, allowing Claude Code to pick up new tasks while giving complex tasks time to finish. 3:35

✨ Key takeaways

  • Choose based on what you needUse /loop for recurring actions and /goal when work should continue until a stated condition is met. 2:35
  • Support long-running tasksGoals can continue for extended periods, while a scheduled loop can check for and start additional work later. 6:18
  • Add verificationVerifiers can help ensure the system is doing the right work rather than simply repeating actions and using tokens. 6:50

🧠 Lessons learned

  • New tasks can be picked up automaticallyWhen a scheduled loop runs again, its goal can find newly added tasks and work on them. 5:46
  • Match the goal to the task’s complexitySimple tasks may not need a goal, but complex work benefits from an inner loop that continues until the goal’s condition is satisfied. 6:18

🏁 Conclusion/next steps

  • Build a verified loop systemCombine scheduled runs, condition-based goals, and verifiers to handle recurring work with clear completion criteria. 6:50
  • Share questions and suggestionsThe speaker invites viewers to ask questions and suggest topics for the next video in the series. 7:22

Transcript excerpt

0:00 So, people are talking about loop engineering right now, but I think one thing is getting mixed up. Some people hear {slash} loop and they just think that loop engineering is just a {slash} loop portion. Other people look at {slash} goal and say, "Wait, isn't that already a loop? And isn't {slash} goal already loop engineering?" And honestly, yes, {slash} goal is a loop. It's just a different kind of loop than {slash} loop.

0:30 In this video, I'll talk about the difference between {slash} goal and {slash} loop and how you can combine them together to do loop engineering, which everyone is talking about on YouTube and Twitter and whatnot. So, {slash} loop is useful when you want to do something on a schedule. Let's say you want to do something every hour, every 30 minutes, every 5 minutes, or every day, every week. You can use {slash} loop to set up a uh loop that Claude Code will run on a

1:02 schedule, right? So, one day or 1 hour. And this is a simple loop. This is just like a cron job, right? It is just following a schedule to run a command or run a prompt or run a {slash} command. So, this is a really simple loop. This is basically a cron job. Now, {slash} goal is interesting, right? With {slash} goal what you get is you get to write a prompt with a condition. You can say

🔒 The full, searchable transcript is available with Pro.

🔒 Unlock Premium Features

This is a premium feature. Upgrade to unlock unlimited Q&A, transcripts, mindmaps, and translations.

🔒 Unlock Premium Features

Access to Chat is a premium feature. Upgrade now to unlock unlimited studying tools.

🔒 Unlock Premium Features

Access to Mindmap is a premium feature. Upgrade now to unlock unlimited studying tools.

🔒 Unlock Premium Features

Access to Translation is a premium feature. Upgrade now to unlock unlimited studying tools.

Suggestions

🔒 Unlock Premium Features

Access to AI Suggestions is a premium feature. Upgrade now to unlock unlimited studying tools.