In Claude Code, what do `/loop 5m check the deploy`, `/loop check the deploy` and a bare `/loop` each do?
answer
- what you leave out matters
- interval becomes a cron expression
- no interval: Claude self-paces
- no prompt: maintenance prompt or loop.md
- Esc clears the pending wakeup
basics
~20 s/loop 5m check the deploy runs on a fixed cron schedule; /loop check the deploy lets Claude choose a one-minute-to-one-hour delay after each run; a bare /loop self-paces through loop.md or the built-in maintenance prompt.
solid answer
~40 s`/loop` is a bundled skill whose interval and prompt are both optional. With an interval, Claude converts it to a cron expression and confirms the cadence and job ID; awkward values like `7m` are rounded to the nearest clean cron step. With a prompt but no interval, Claude **self-paces**: after each iteration it picks a delay between one minute and one hour and says why, and `Esc` clears the pending wakeup. With no prompt, it runs the built-in maintenance prompt — finish unfinished work, tend the branch's PR, run cleanup passes — unless a `loop.md` exists; `.claude/loop.md` beats `~/.claude/loop.md`, it is one default prompt rather than a task list, and it is ignored whenever you type a prompt.
code
markdown · 6 linesCheck the open pull request for the current branch.
If CI failed, read the failing job's log, find the cause and push
the smallest fix that makes it pass.
If there are new review comments, address each one.
If CI is green and nothing new has arrived, reply with one line
saying so and do nothing else.go deeper
Remember the three forms: interval and prompt is a fixed schedule, prompt alone lets Claude pick the gap, nothing at all runs loop.md or the maintenance prompt.
Explain how an interval becomes a cron expression and gets rounded, how self-pacing chooses one minute to one hour, and the precedence and limits of loop.md.
Know how a loop ends: Esc for a pending wakeup, ScheduleWakeup stop, the 20-minute fallback, and why some skills passed as the prompt arrive as plain text.
Judge when an open-session loop is the right tool at all versus a durable scheduler, and what a team's shared loop.md should and should not authorise.
## What /loop is `/loop` is a **bundled skill** in the Claude Code CLI (alias `/proactive`) that re-runs a prompt while the session stays open. Its signature is `/loop [interval] [prompt]`, and **both arguments are optional**. What you leave out decides how it behaves, which is why the three forms in the question do three different things. | What you type | What happens | | :- | :- | | `/loop 5m check the deploy` | Your prompt runs on a **fixed schedule** | | `/loop check the deploy` | Your prompt runs at an interval **Claude chooses** each iteration | | `/loop` or `/loop 15m` | The **built-in maintenance prompt** runs, or your `loop.md` if one exists | ## Fixed interval When you give an interval, Claude converts it to a **cron expression**, schedules the job and confirms the cadence and the job ID. The interval can lead as a bare token (`5m`) or trail as a clause (`every 2 hours`). Units are `s`, `m`, `h` and `d`. - Seconds are **rounded up to a minute**, because cron has one-minute granularity. - Intervals that don't map to a clean cron step, such as `7m` or `90m`, are **rounded to the nearest one that does**, and Claude tells you what it picked. - A fixed loop keeps running until you cancel it like any scheduled task or until the **seven-day expiry** of recurring tasks. ## Self-paced: prompt but no interval Without an interval, Claude **self-paces**. After each iteration it picks a delay **between one minute and one hour** based on what it saw — short while a build is finishing, longer once things go quiet — and prints the delay and its reason. Under the hood it calls the `ScheduleWakeup` tool, which you don't call yourself. A self-paced loop still shows in the task list, the jitter rules don't apply to it, and the seven-day expiry does. In sessions where the Monitor tool is available, Claude may stream a background script's output instead of re-running a prompt. To stop it: 1. Press **`Esc`** while it waits; that clears the pending wakeup. Tasks you scheduled by asking Claude directly are not affected by `Esc`. 2. Claude can end the loop itself by calling `ScheduleWakeup` with `stop: true` once the task is done. 3. If an iteration neither reschedules nor stops, Claude Code schedules one fallback wakeup about 20 minutes later, and ends the loop if that iteration doesn't reschedule either. ## No prompt: the maintenance prompt and loop.md A bare `/loop` runs a **built-in maintenance prompt**: continue unfinished work from the conversation, tend the current branch's pull request (review comments, failed CI, merge conflicts), and run cleanup passes when nothing else is pending. It does not start new initiatives, and irreversible actions such as pushing or deleting proceed only when they continue something the transcript already authorised. Bare `/loop` is self-paced; `/loop 15m` runs the same default on a fixed schedule. `loop.md` **replaces** that default with your own instructions: - `.claude/loop.md` (project) takes precedence over `~/.claude/loop.md` (user). - It is a **single default prompt**, plain Markdown, not a list of separate tasks. - It is **ignored** whenever you type a prompt on the command line. - Edits apply on the **next iteration**, so you can refine it mid-loop. - Content beyond **25,000 bytes** is truncated. ## Skills as the prompt You can pass a skill, for example `/loop 20m /review-pr 1234`. A scheduled fire only runs skills Claude is allowed to invoke on its own. These reach Claude as **plain text** instead of executing: built-in commands such as `/model` or `/clear`, skills with `disable-model-invocation: true`, skills withheld by `skillOverrides` or a `Skill` deny rule, and MCP prompts. ## Common mistakes - Assuming a bare `/loop` needs a prompt to do anything. - Writing several jobs into `loop.md` and expecting each to be scheduled. - Expecting `/loop 7m` to fire on an exact seven-minute step. - Thinking `Esc` cancels every scheduled task in the session.
- What happens with `/loop 20m /review-pr 1234` in Claude Code?The skill is re-run every 20 minutes, but only if Claude may invoke it on its own. Built-in commands such as `/model`, skills with `disable-model-invocation: true`, skills withheld by `skillOverrides` or a `Skill` deny rule, and MCP prompts arrive as plain text and do not execute.
- How does a self-paced /loop end without you pressing Esc?Claude calls `ScheduleWakeup` with `stop: true` once the task is complete, cancelling the pending wakeup. If an iteration ends without rescheduling or stopping, Claude Code schedules one fallback wakeup about 20 minutes later and ends the loop if that iteration doesn't reschedule either. A fixed-interval loop instead runs until cancelled or until seven days pass.
- A bare /loop does nothing until you give it a prompt.
- loop.md can list several jobs and each one is scheduled separately.
- ~/.claude/loop.md takes precedence over the project's .claude/loop.md.
- /loop 7m fires on an exact seven-minute step.
- Pressing Esc cancels every scheduled task in the session.