Skip to content

Run Watch-and-Act Workflows with /loop

Use /loop when Claude should repeat a prompt while the session stays open.

Terminal window
/loop 5m check if the deploy finished

The interval can lead the prompt (5m) or trail it (every 2 hours). The minimum is one minute. Leave the interval out and Claude paces itself, waiting between one minute and one hour per iteration. A bare /loop runs a built-in maintenance prompt, or your own .claude/loop.md if you have one.

This is useful for watch-and-act tasks where the next step depends on a condition changing.

  • Wait for CI to pass, then report status.
  • Check a deployment until it is healthy.
  • Poll a queue or dashboard.
  • Retry a flaky external check with a cap.
  • Monitor a long-running background process.
/loop 5m check whether CI has finished.
If it passes, summarize the result and stop.
If it fails, inspect the failure and tell me the likely root cause.
Do not merge or deploy without approval.
  • Loops are session-scoped. They fire only while Claude Code is running.
  • Recurring tasks expire 7 days after creation.
  • A session can hold up to 50 scheduled tasks.
  • Press Esc to stop a self-paced loop while it waits. Ask Claude to cancel a fixed-interval one.

For a schedule that must outlive the session, use Routines (/schedule), Desktop scheduled tasks, or GitHub Actions. To keep working toward a condition instead of on a timer, use /goal.

Keep loop prompts narrow. Avoid giving broad write or deploy permissions to an unattended loop unless you have explicit safeguards.