Basics

A Claude Loop is a recurring prompt or slash command inside Claude Code. You invoke it with /loop, and Claude runs the same task on a schedule — fixed interval or self-paced — until you stop it.

No. Loops are built into Claude Code. If you have any version of Claude Code (CLI, IDE, desktop), you already have /loop.

Anywhere you can talk to Claude Code — terminal CLI, the IDE extension chat, or the desktop app. Just type /loop followed by your task.

One loop per active session. If you need two, open two Claude Code sessions, or use /schedule for one of them so it runs in the cloud.

Modes & Pacing

Dynamic mode is what happens when you skip the interval. Instead of running on a clock, Claude decides how long to wait between iterations by calling ScheduleWakeup. It picks the delay based on what it is observing — fast polling when state is changing, longer sleeps when things are idle.

Use a fixed interval when the rate of change is predictable (e.g. a metric updated every minute). Use dynamic mode when the timing is uncertain (a deploy that might take 2 or 20 minutes).

The runtime clamps to a floor (typically 60 seconds). Anything shorter is rounded up. This protects you from runaway token usage.

Anthropic's prompt cache has roughly a 5-minute TTL. Wake-ups under ~270 seconds stay inside the cache window — cheap and fast. Wake-ups around 300s pay a cache miss without amortizing it, so either drop under 270s or commit to 1200s+ instead.

Cost & Safety

No surcharge. Each iteration consumes the same tokens as running the task once manually. There is no per-loop fee. The total cost is simply iterations × per-run cost.

Pick intervals that match the underlying state-change rate. A loop firing every minute for 8 hours is 480 runs — make sure that is what you actually need. For unpredictable timing, dynamic mode usually picks better intervals than humans do.

Loops use the same permission model as any other Claude Code action. Risky operations still require approval according to your permission settings. The loop itself does not bypass any safeguards.

No. Loops are session-bound. Closing the session terminates the loop cleanly. If you need unattended automation, use /schedule to create a cloud routine instead.

Operations

Type /loop stop. Or just close the Claude Code session — both end the loop cleanly.

The loop pauses while Claude Code is not running. When the session resumes, the loop picks up from the next scheduled wake-up.

Stop the loop, edit the prompt, restart. Loops re-fire the original prompt verbatim each iteration, so mid-flight edits are not supported.

Write the state to a scratch file or skill memory at the end of each iteration. Then read it back at the start of the next one. Do not rely on conversation history alone — it gets summarized.

Comparisons

/loop runs inside your active local session and stops when the session ends. /schedule creates a cloud routine that runs unattended on a cron schedule. Use loops while at the keyboard; use schedules for "set and forget" automation.

No. Cron runs the same shell command with no reasoning between runs. Claude Loops run an intelligent agent that can read context, react to what it sees, and adjust its own pacing. Different category.

Webhooks are push (you get notified when something happens). Loops are pull (you ask repeatedly). Loops are simpler to set up but check on a schedule rather than instantly.

Troubleshooting

Add a "only ping me on change" clause to the prompt. For example: "Only tell me if the result is different from the last check." This is one of the highest-leverage improvements you can make.

You probably did not give it a stop condition. Add one: "End the loop when X happens." In dynamic mode Claude will omit the next ScheduleWakeup call.

Type /loop stop. If that does not respond, close the session. Open a new session and check that the task is not waiting on a permission prompt.

The session shows an iteration counter for active loops. You can also have the loop itself log a counter to a scratch file if you need persistent tracking.

Have a question we missed?

Send it our way and we will add it to the FAQ.

Ask a Question →