Put /goal inside /loop, and Claude Code works through your task file
One command makes Claude Code wake up on a timer, read tasks.md, and keep working until each pending task is done. You add tasks to the file instead of typing prompts.
Why it matters
/loop runs a prompt or a slash command on a recurring interval, like every 2 minutes.
/goal sets a goal, and Claude keeps working until the goal is reached.
Put /goal inside /loop, and each wake-up turns the next pending task in tasks.md into a goal.
Do this
- Create a tasks.md file in your project and write one task per line.
- In Claude Code, start the loop with the command below.
- Add new tasks to tasks.md from any other window; the next wake-up picks them up.
- Swap tasks.md for a Notion board or GitHub issues later, through MCP or a skill.
The one command
/loop 2m /goal check tasks.md and implement every pending task
One thing to keep in mind: The loop keeps running and keeps using tokens while it works. Write tasks small and clear, and stop the loop when the file is empty.
From Saurav's YouTube video on agent loops in Claude Code. The interval and the file name are examples; use any interval and any task list. Source: CloudYeti on YouTube: Stop Prompting Claude Code: Agent Loops in 5 Minutes.
Free live lesson · Nov 24Stop Measuring AI by Tokens. Measure What It EarnsOne hour, live, with Saurav. Bring your own bill. Free.Save my free seat → Learn it live, then run it yourselfLoop and harness engineering, AI agents on AWS, AI cost and ROI.See the workshops →
All tips in: Claude Code tips from the team that builds Claude Code