Overview
/loop lets Qoder CLI run the same prompt or slash command over and over. It is ideal for scenarios such as polling status, continuous checking, and periodic repetitive actions, for example, "check deployments every 5 minutes" or "watch the CI pipeline until it turns green".
There are two pacing modes, selected by whether you give an interval:
| Mode | How to trigger it | Timing |
|---|---|---|
| Fixed-interval | Provide an interval (/loop 5m …) | Qoder converts the interval into a periodic schedule and creates a scheduled task. |
| Dynamic-pacing | Omit the interval (/loop monitor CI) | Qoder runs the task, then decides for itself when the next run is worth doing (60s–3600s). The loop ends as soon as it stops scheduling the next wake-up. |
Command Format
interval: Optional time interval. If provided, the loop runs at a fixed interval; if omitted, Qoder paces itself.flags: Optional. Persistence (--durable,--permanent) and budget ceilings (--max-turns,--max-credits). Flags may appear anywhere in the input and are removed from the prompt before it is scheduled.prompt: The prompt or slash command to run repeatedly. If you omit it and a.qoder/loop.mdfile exists, Qoder loops over that task list instead.
Interval Syntax
An interval consists of a number followed by a unit. Four units are supported:
| Unit | Meaning | Example |
|---|---|---|
s | Seconds | 30s |
m | Minutes | 5m |
h | Hours | 2h |
d | Days | 1d |
30s is treated as 1m, and Qoder will inform you of the actual rounded interval.
Interval to Cron conversion rules:
| Interval | Corresponding Schedule | Description |
|---|---|---|
Nm (N ≤ 59) | Every N minutes | |
Nm (N ≥ 60) | Rounded to hours | Must evenly divide 24 hours |
Nh (N ≤ 23) | Every N hours | |
Nd | Midnight every N days (local time) | |
Ns | Rounded up to minutes | Minimum 1 minute |
If the interval does not evenly divide its unit (e.g.,7mwould result in uneven intervals from:56to:00, and90mcannot be expressed in whole hours), Qoder will select the nearest clean interval and inform you of the rounded value before creation.
Two Formats
The interval can be placed at the beginning or expressed using an every clause at the end:
- Interval at the beginning:
/loop 5m check the deploy→ interval5m, promptcheck the deploy. - every clause at the end:
/loop check the deploy every 20m→ interval20m, promptcheck the deploy. Natural expressions likeevery 5 minutesandevery 2 hoursare also supported.
every is treated as an interval only when followed by a time expression. For example, in /loop check every PR, every is not a time expression and will be treated as part of the prompt, so the loop runs in dynamic-pacing mode.
Budget Ceilings
A loop keeps running until it expires or you stop it, which makes it easy to spend more than you intended. Two flags put a ceiling on it:
| Flag | Meaning |
|---|---|
--max-turns N | Stop after N runs. N is a whole number. |
--max-credits N | Stop once N credits have been spent in total. Decimals are allowed, because a single run often costs less than one credit. |
= form (--max-turns=6). Only positive numbers are accepted—a ceiling of zero would retire the loop before its first run.
How the ceilings behave:
- Set both, and whichever is reached first stops the loop.
- Runs are counted over the whole life of the task, not per session. Restarting Qoder CLI does not reset the count, so a restart cannot be used to get past the ceiling.
- The run count is checked before each run, so
--max-turns 2fires exactly twice, never a third time. - Credits are metered after a run finishes, so the final run can end slightly above the ceiling (for example
3.2against a ceiling of3). Qoder does not cut a run off midway, because the work you already paid for would be discarded. - Reaching a ceiling stops the loop for good. The task is removed and you see a message such as
Scheduled task a1b2c3d4 stopped: it used 2 of 2 turns.Qoder receives the same notice, so it reports the stop instead of continuing to reason as though the loop were still running. To keep going, start a new loop with a fresh ceiling. - In dynamic-pacing mode the ceiling sticks to the loop. You only pass it once, on the
/loopthat starts the loop; it stays in effect for every later wake-up. Stopping the loop clears both the ceiling and the usage, so the next/loopstarts from zero.
Viewing and Changing Usage
/crontab opens the scheduled task panel, where the USAGE column shows what each loop has consumed:
t for the run ceiling and b for the credit ceiling. Entering an empty value removes that ceiling.
Persistence, Automatic Expiration, and Cancellation
By default a /loop task lives in the current session only: it fires on schedule while Qoder CLI is running and disappears when the process exits. Recurring tasks also expire automatically 7 days after creation.
Two flags change that:
| Flag | Effect |
|---|---|
--durable | Persist the task to disk so it survives restarts, with no automatic expiry. |
--durable 30d | Persist the task and expire it 30 days from now. |
/crontab panel, or—in dynamic-pacing mode—simply ask Qoder to stop the loop.
For complete parameters, default values, and expiration rules, see the Loop Command Reference.
