DOCS · REFERENCE · COMMANDS · BUILD

cancel-loop/synthex:cancel-loop

Build

Cancel a loop by id, or every running loop with --all. Idempotent.

Invocation

Run from inside Claude Code in any project where Synthex is installed:

/synthex:cancel-loop

Some commands accept parameters; see the source-of-truth file linked below for the full parameter list and workflow.

Lifecycle phase

Build. Parallel-executed, peer-reviewed task delivery.

Source

The command's parameters, workflow, and sub-agent invocations are defined in markdown at bluminal/lumenai/blob/main/plugins/synthex/commands/cancel-loop.md.

Last modified:

What it does, end-to-end

cancel-loop/synthex:cancel-loop marks a running loop as cancelled. The cancel is polled at the iteration boundary by the looping command — a loop that's mid-iteration when you cancel it will finish that iteration's work, then exit cleanly on the next boundary check. Worst case: one iteration of latency before the loop stops.

The mutation is atomic: tmp file + mv -f rename, so concurrent reads from list-loops/synthex:list-loops or another session's iteration boundary never see a half-written state.

The command is idempotent. Cancelling an already-cancelled (or completed, or max-iterations-reached, or crashed) loop is a no-op with a single confirmation line — never an error.

Parameters

ParameterDescriptionDefaultRequired
loop_idPositional. The loop-id slug to cancel.Required unless --all
--allCancel every running loop in the project. Mutually exclusive with loop_id.off

Examples

Cancel a single loop

/synthex:cancel-loop release-1
# → Cancelled loop "release-1" (was at iteration 12/30).

Cancel a loop you've already cancelled (idempotent)

/synthex:cancel-loop release-1
# → Loop "release-1" is already cancelled — nothing to do.

Cancel everything running in this project

/synthex:cancel-loop --all
# → Cancelled (3):
#     release-1            was at iter 12/30
#     review-check-7e1d    was at iter 4/10
#     team-plan-4c66       was at iter 6/15

If nothing is running:

/synthex:cancel-loop --all
# → No running loops to cancel.

Refusal paths

  • Neither loop_id nor --all supplied. Prints Usage: /synthex:cancel-loop <loop-id> | --all and exits non-zero.
  • Both loop_id and --all supplied. Mutually exclusive; pick one.
  • loop_id doesn't match an existing state file. Names the slug and suggests list-loops/synthex:list-loops.

If .synthex/loops/ doesn't exist at all (no loop has ever run in this project), the command prints No loops in this project. and exits 0 — not a refusal.

Cancellation timing

--loop-bearing commands check the state file's status at every iteration boundary (per FR-NL14 step 7). The cancel takes effect on that next read. Cancellation never interrupts an iteration that is currently executing — the worst-case latency is one iteration's worth of work before the loop exits.

For workflows where in-flight teammate work needs to be torn down on cancel (rare), the command's own teardown semantics handle it — cancel-loop/synthex:cancel-loop only changes the loop counter contract; the inner workflow's cleanup behavior is unchanged.

What it does not do

  • Delete the state file. Terminal-status state files are archived later by any loop command that touches .synthex/loops/. The cancel leaves the file in place so you can read the iteration history (started_at, iteration, exit_reason) until then.
  • Touch loops in .archive/. Archived loops are historical and immutable.
  • Touch the Ralph plugin's state file. Cancel the Ralph loop through the Ralph plugin if you also have one configured. See Coexistence with Ralph Loop.
  • Prompt the user. No AskUserQuestion — single deterministic mutation + confirmation line.

See also

  • Native looping — the full framework explainer.
  • loop/synthex:loop — start or resume a loop.
  • list-loops/synthex:list-loops — enumerate loops in the project.