Foreach & Parallel
Most real workflows decompose work into items and process each one. Gump handles this withforeach and optionally parallel.
Foreach
Theforeach field points to a plan step. Gump iterates over the items produced by that step and runs the child steps for each one.
{item.name}, {item.description}, and {item.files} refer to the current item.
Items are processed sequentially by default. Each item’s sub-steps run in the worktree, results are committed, and the next item starts from the updated state.
Parallel
Addparallel: true to run all items simultaneously:
The MECE requirement
Parallel execution requires items with strictly disjoint blast radii. If two items modify the same file, the merge will create a Git conflict and trigger the circuit breaker — the run stops. Your plan prompt should enforce this:Parallel steps (without foreach)
You can also parallelize steps within a group without foreach:review output (no file changes), there’s no merge conflict risk. Their outputs are available in the state bag once both complete.
Group-level gate and on_failure
An orchestration step (with childsteps) can have its own gate and on_failure:
on_failure retries the entire group (or restarts from a specific step). The worktree is reset to the pre-group state before each retry.