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
[interval](optional): Execution interval. Defaults to10m(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:
| Suffix | Unit | Description |
|---|---|---|
s | Seconds | Rounded up to the nearest minute (minimum granularity of 1 minute). |
m | Minutes | Every N minutes. |
h | Hours | Every N hours. |
d | Days | Every 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:
- 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. - Trailing every clause: Otherwise, if the input ends with
every <N><unit>orevery <N> <unit>(e.g.,every 20m,every 5 minutes), it is extracted as the interval and removed from the prompt. This only matches wheneveryis followed by a time expression—check every PRdoes not contain an interval. - Default: Otherwise, the interval is
10m, and the entire input is treated as the prompt.
Examples
Interval to cron Conversion
| Interval Pattern | cron Expression | Description |
|---|---|---|
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 |
Nd | 0 0 */N * * | Every N days at midnight |
Ns | Treated as ceil(N/60)m | Minimum cron granularity is 1 minute |
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
- /loop usage guide: Loop Tasks.
- Underlying mechanisms of scheduled tasks: Scheduled Task Reference.