Skip to main content
Reference

Loop Command Reference

The parameter format, interval units, dynamic pacing mode, and cancellation for /loop

/loop makes Qoder CLI CN run a prompt or slash command repeatedly: with an interval specified, it runs at a fixed interval through the scheduled task system; without an interval, it enters dynamic pacing mode, where the Agent decides the timing of each wake-up on its own. This page covers its parameter format, interval conversion, and cancellation. For the usage guide to looped execution, see Repeating Tasks.

Usage

/loop [interval] <prompt>
  • [interval] (optional): the execution interval. Specifying it means fixed-interval mode; omitting it enters dynamic pacing mode, where the Agent decides the timing of the next run based on the task (each between 60 seconds and 1 hour).
  • <prompt> (required): the prompt text or slash command to run repeatedly. Empty input shows the usage message.

Interval units

In fixed-interval mode, an interval consists of a number plus a unit suffix:
SuffixUnitDescription
ssecondsRounded up to the nearest minute (minimum granularity 1 minute).
mminutesEvery N minutes.
hhoursEvery N hours.
ddaysEvery N days (triggered at local midnight).
The minimum granularity is 1 minute. Second-based intervals are rounded up to ceil(N/60) minutes, and you are notified of the rounding.

Parsing rules

/loop parses input in this priority order:
  1. Leading token: if the first word matches ^\d+[smhd]$ (such as 5m, 2h), it is taken as the interval and the rest as the prompt, entering fixed-interval mode.
  2. Trailing every clause: otherwise, if the input ends with every <N><unit> or every <N> <unit-word> (such as every 20m, every 5 minutes), the interval is extracted and removed from the prompt, entering fixed-interval mode. This matches only when every is followed by a time expression — check every PR contains no interval.
  3. Dynamic pacing: otherwise, dynamic pacing mode kicks in with the entire input as the prompt, and the execution rhythm is decided by the Agent; if the Agent no longer schedules the next wake-up, the loop ends.

Examples

/loop 5m /babysit-prs          # Fixed: run /babysit-prs every 5 minutes
/loop 30m check the deploy     # Fixed: check the deployment every 30 minutes
/loop 1h /standup 1            # Fixed: run /standup 1 every hour
/loop monitor CI pipeline      # Dynamic: Agent decides the pacing
/loop run tests every 20m      # Fixed: run tests every 20 minutes

Interval-to-cron conversion

In fixed-interval mode, intervals convert to cron schedules by these rules:
Interval patternCron expressionDescription
Nm (N ≤ 59)*/N * * * *Every N minutes
Nm (N ≥ 60)0 */H * * *Converted to hours (H = N/60, must divide 24)
Nh (N ≤ 23)0 */N * * *Every N hours
Nd0 0 */N * *Every N days at midnight
Nstreated as ceil(N/60)mCron's minimum granularity is 1 minute
If an interval doesn't divide its unit evenly (such as 7m producing uneven gaps, or 90m being inexpressible in cron), the nearest clean interval is chosen and you are told the rounding result before the task is created.

Cancellation and expiry

  • Fixed-interval loop tasks expire automatically 7 days after creation.
  • You can manually delete the corresponding scheduled task before expiry (ask the Agent in natural language, providing the task ID).
  • In dynamic pacing mode, the loop ends when the Agent no longer schedules the next wake-up.
  • After a loop task is created, the prompt runs once immediately without waiting for the first cron trigger.

Next steps