> ## Documentation Index
> Fetch the complete documentation index at: https://gump.build/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Split, Each & Parallel

> Most real workflows decompose work into tasks and process each one.

# Split, Each & Parallel

Most real workflows decompose work into tasks and process each one. Gump handles this with `split` + `each` and optionally `parallel`.

## Split + Each

A step with `type: split` produces tasks. The `each:` block declares the steps to execute per task.

```yaml theme={null}
steps:
  - name: decompose
    type: split
    get:
      prompt: "Decompose {spec} into independent tasks."
    run:
      agent: claude-opus
    gate: [schema]
    each:
      - name: impl
        type: code
        get:
          prompt: |
            Implement: {task.description}
            Files: {task.files}
        run:
          agent: claude-sonnet
        gate: [compile, test]
        retry:
          - exit: 3

      - name: smoke
        type: code
        get:
          prompt: "Run smoke tests and fix any issues."
          session: from: impl
        run:
          agent: {impl.agent}
        gate: [compile, test]
        retry:
          - exit: 2
```

The `each:` block is a mini-workflow executed per task. Steps within `each:` are sequential by default. Each task gives access to `{task.name}`, `{task.description}`, `{task.files}`.

Tasks are processed sequentially by default. Each task's sub-steps run in the worktree, results are committed, and the next task starts from the updated state.

## Parallel tasks

Add `parallel: true` on the split step to process tasks simultaneously:

```yaml theme={null}
- name: decompose
  type: split
  parallel: true
  get:
    prompt: |
      Decompose {spec} into independent tasks with strictly disjoint blast radii.
  run:
    agent: claude-opus
  gate: [schema]
  each:
    - name: impl
      type: code
      ...
```

Each task gets its own worktree. Agents work simultaneously. Merge is sequential in declaration order. File conflict = fatal.

### The MECE requirement

Parallel execution requires tasks with strictly disjoint blast radii. If two tasks modify the same file, the merge creates a Git conflict and the run stops. Your split prompt should enforce this.

## Parallel groups (without split)

You can also parallelize steps without a split:

```yaml theme={null}
- name: reviews
  parallel: true
  steps:
    - name: arch-review
      type: validate
      get:
        prompt: "Review architecture..."
      run:
        agent: claude-opus

    - name: security-review
      type: validate
      get:
        prompt: "Review security..."
      run:
        agent: gemini
```

Each branch gets its own worktree. Merge sequential by order. Conflict = fatal.
