> ## 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.

# Anatomy of a Workflow

> A workflow is a YAML file with a name, optional global bounds, and a list of steps.

# Anatomy of a Workflow

A workflow is a YAML file with a name and a list of steps. Here's a minimal example:

```yaml theme={null}
name: simple
max_budget: 3.00

steps:
  - name: implement
    type: code
    prompt: "{spec}"
    agent: claude-sonnet
    guard: { max_turns: 80 }
    gate: [compile]
```

## Root fields

Every workflow has these top-level fields:

* `name` — identifier, used as positional arg: `gump run <name> --spec <file>`.
* `max_budget` — maximum cost in dollars for the entire run. Optional.
* `max_timeout` — maximum wall-clock duration for the entire run (e.g., `"30m"`). Optional.
* `max_tokens` — maximum tokens consumed for the entire run. Optional.
* `steps` — ordered list of steps to execute.

The `description` and `inputs` fields from v0.0.3 have been removed. Workflows are identified by name, described in the playbook, and their inputs are deduced automatically by scanning variables.

## Steps are sequential

Steps execute in order, top to bottom. Each step can read the outputs of previous steps via the state. A step doesn't start until the previous one has completed and passed its gate.

## Where workflows live

Gump looks for workflows in three places, in order:

1. **Project** — `.gump/workflows/my-workflow.yaml`
2. **User** — `~/.gump/workflows/my-workflow.yaml`
3. **Built-in** — shipped with Gump

The first match wins. A project workflow with the same name as a built-in overrides it.

## A real workflow

Here's what a typical workflow looks like with decomposition, retries, and a quality gate:

```yaml theme={null}
name: my-workflow
max_budget: 8.00

steps:
  - name: decompose
    type: split
    get:
      prompt: |
        Decompose {spec} into independent tasks.
        Each task must be implementable and testable in isolation.
    run:
      agent: claude-opus
    gate: [schema]
    each:
      - name: impl
        type: code
        get:
          prompt: |
            Implement: {task.description}
            Files: {task.files}
        run:
          agent: claude-sonnet
          guard:
            max_turns: 60
        gate: [compile, test]
        retry:
          - exit: 3

  - name: quality
    gate: [compile, lint, test]
```

The following pages explain each building block in detail — step types, gates, guards, prompts, the state, and composition.
