Skip to main content
Reference

Loop Command Reference

Parameter format, interval units, default values, and cancellation methods for /loop loop execution.

/loop Enables Qoder CLI to repeatedly execute a prompt or slash command at fixed intervals, powered under the hood by the scheduled task system. This page explains its parameter format, interval conversion, and cancellation methods. For a usage guide on loop execution, see Loop Tasks.

Usage

/loop [interval] <prompt>
  • [interval] (optional): Execution interval. Defaults to 10m (10 minutes) if omitted.
  • <prompt> (required): The prompt text or slash command to be executed repeatedly. Displays a usage prompt if empty.

Interval Units

An interval consists of a number and a unit suffix:
SuffixUnitDescription
sSecondsRounded up to the nearest minute (minimum granularity of 1 minute).
mMinutesEvery N minutes.
hHoursEvery N hours.
dDaysEvery N days (triggers at midnight local time).
The minimum granularity is 1 minute. Intervals in seconds are rounded up to ceil(N/60) minutes, and you will be notified of the rounding.

Parsing Rules

/loop parses the input with the following priority:
  1. Leading token: If the first word matches ^\d+[smhd]$ (e.g., 5m, 2h), it is treated as the interval, and the rest as the prompt.
  2. Trailing every clause: Otherwise, if the input ends with every <N><unit> or every <N> <unit> (e.g., every 20m, every 5 minutes), it is extracted as the interval and removed from the prompt. This only matches when every is followed by a time expression—check every PR does not contain an interval.
  3. Default: Otherwise, the interval is 10m, and the entire input is treated as the prompt.

Examples

/loop 5m /babysit-prs          # Run /babysit-prs every 5 minutes
/loop 30m check the deploy     # Check the deployment every 30 minutes
/loop 1h /standup 1            # Run /standup 1 every hour
/loop check the deploy         # Default is every 10 minutes
/loop run tests every 20m      # Run tests every 20 minutes

Interval to cron Conversion

Interval Patterncron ExpressionDescription
Nm (N ≤ 59)*/N * * * *Every N minutes
Nm (N ≥ 60)0 */H * * *Converted to hours (H = N/60, must be divisible by 24)
Nh (N ≤ 23)0 */N * * *Every N hours
Nd0 0 */N * *Every N days at midnight
NsTreated as ceil(N/60)mMinimum cron granularity is 1 minute
If the interval cannot evenly divide its unit (e.g., 7m would produce uneven intervals, 90m cannot be expressed in cron), the closest clean interval is selected, and you will be informed of the rounding result before the task is created.

Cancellation and Expiration

  • Recurring tasks automatically expire 7 days after creation.
  • You can manually delete the corresponding scheduled task before expiration (request the Agent to delete it using natural language and provide the task ID).
  • After creating a recurring task, the current prompt is executed immediately once, without waiting for the first cron trigger.

Next Steps