Skip to content

Pipeline Schema Reference

Pipeline YAML files define multi-step AI workflows. Store pipelines in .wave/pipelines/.

Minimal Pipeline

yaml
kind: WavePipeline
metadata:
  name: simple-task
steps:
  - id: execute
    persona: craftsman
    exec:
      type: prompt
      source: "Execute: {{ input }}"

Copy this to .wave/pipelines/simple-task.yaml and run with wave run simple-task "your task".


Complete Example

yaml
kind: WavePipeline
metadata:
  name: gh-pr-review
  description: "Automated code review pipeline"

input:
  source: cli

steps:
  - id: analyze
    persona: navigator
    memory:
      strategy: fresh
    workspace:
      type: worktree
      branch: "{{ pipeline_id }}"
    exec:
      type: prompt
      source: "Analyze the codebase for: {{ input }}"
    output_artifacts:
      - name: analysis
        path: .wave/output/analysis.json
        type: json
    handover:
      contract:
        type: json_schema
        schema_path: .wave/contracts/analysis.schema.json
        source: .wave/output/analysis.json

  - id: review
    persona: auditor
    dependencies: [analyze]
    memory:
      strategy: fresh
      inject_artifacts:
        - step: analyze
          artifact: analysis
          as: context
    exec:
      type: prompt
      source: "Review the code for security issues."
    output_artifacts:
      - name: findings
        path: .wave/output/findings.md
        type: markdown
    handover:
      contract:
        type: testsuite
        command: "go vet ./..."

Top-Level Fields

FieldRequiredDefaultDescription
kindyes-Must be WavePipeline
metadata.nameyes-Pipeline identifier
metadata.descriptionno""Human-readable description
input.sourcenocliInput source: cli, file, stdin
input.pathno-File path when source: file
stepsyes-Array of step definitions

Step Fields

FieldRequiredDefaultDescription
idyes-Unique step identifier
personayes-Persona from wave.yaml
exec.typeyes-prompt or command
exec.sourceyes-Prompt template or shell command
dependenciesno[]Step IDs that must complete first
memory.strategynofreshMemory strategy (always fresh)
memory.inject_artifactsno[]Artifacts from prior steps
workspace.typeno-worktree for git worktree workspaces
workspace.branchnoautoBranch name for worktree (supports templates)
workspace.mountno[]Source mounts (alternative to worktree)
output_artifactsno[]Files produced by this step
handover.contractno-Output validation
handover.compactionno-Context relay settings
strategyno-Matrix fan-out configuration
validationno[]Pre-execution checks

Step Definition

Basic Step

yaml
steps:
  - id: analyze
    persona: navigator
    exec:
      type: prompt
      source: "Analyze: {{ input }}"

Step with Dependencies

yaml
steps:
  - id: implement
    persona: craftsman
    dependencies: [analyze, plan]
    exec:
      type: prompt
      source: "Implement the feature"

Step with Artifact Injection

yaml
steps:
  - id: review
    persona: auditor
    dependencies: [implement]
    memory:
      strategy: fresh
      inject_artifacts:
        - step: implement
          artifact: code
          as: changes
    exec:
      type: prompt
      source: "Review the changes"

Exec Configuration

Prompt Execution

yaml
exec:
  type: prompt
  source: |
    Analyze the codebase for {{ input }}.
    Report file paths and architectural patterns.

Command Execution

yaml
exec:
  type: command
  source: "go test -v ./..."

Template Variables

VariableScopeDescription
All stepsPipeline input from --input
Matrix stepsCurrent matrix item

Output Artifacts

Declare files produced by a step:

yaml
output_artifacts:
  - name: analysis
    path: .wave/output/analysis.json
    type: json
  - name: report
    path: .wave/output/report.md
    type: markdown
FieldRequiredDescription
nameyesArtifact identifier
pathyesFile path relative to workspace
typenojson, markdown, file, directory

Artifact Injection

Import artifacts from prior steps:

yaml
memory:
  strategy: fresh
  inject_artifacts:
    - step: analyze
      artifact: analysis
      as: context
    - step: plan
      artifact: tasks
      as: task_list
FieldRequiredDescription
stepyesSource step ID
artifactyesArtifact name from source step
asyesName in current workspace

Artifacts are copied to .wave/artifacts/<as>/ in the step workspace.


Workspace Configuration

yaml
workspace:
  type: worktree
  branch: "{{ pipeline_id }}"
FieldRequiredDefaultDescription
typeno-worktree for git worktree workspaces
branchnoautoBranch name for the worktree. Supports template variables. Steps sharing the same branch share the same worktree.

When type is worktree, Wave creates a git worktree via git worktree add on the specified branch. If the branch doesn't exist, it's created from HEAD. Multiple steps with the same resolved branch reuse the same worktree directory.

Mount Workspace

yaml
workspace:
  mount:
    - source: ./src
      target: /code
      mode: readonly
    - source: ./test-fixtures
      target: /fixtures
      mode: readonly
FieldRequiredDefaultDescription
mount[].sourceyes-Source directory
mount[].targetyes-Mount point in workspace
mount[].modenoreadonlyreadonly or readwrite

Contracts

Validate step output before proceeding.

Test Suite Contract

yaml
handover:
  contract:
    type: testsuite
    command: "npm test"

JSON Schema Contract

yaml
handover:
  contract:
    type: json_schema
    schema_path: .wave/contracts/analysis.schema.json
    source: .wave/output/analysis.json
    on_failure: retry
    max_retries: 2

TypeScript Contract

yaml
handover:
  contract:
    type: typescript
    source: .wave/output/types.ts
    validate: true

Contract Fields

FieldRequiredDefaultDescription
typeyes-testsuite, jsonschema, typescript, markdownspec
commanddepends-Test command (for testsuite)
schemadepends-Schema path (for jsonschema)
sourcedepends-File to validate
must_passnotrueWhether failure blocks progression
on_failurenoretryretry or halt
max_retriesno2Maximum retry attempts

Compaction

Configure context relay for long-running steps.

yaml
handover:
  compaction:
    trigger: "token_limit_80%"
    persona: summarizer
FieldDefaultDescription
triggertoken_limit_80%When to trigger relay
personasummarizerPersona for checkpoints

Matrix Strategy

Fan-out parallel execution from a task list.

yaml
steps:
  - id: plan
    persona: philosopher
    exec:
      type: prompt
      source: "Break down into tasks. Output: {\"tasks\": [...]}"
    output_artifacts:
      - name: tasks
        path: .wave/output/tasks.json

  - id: execute
    persona: craftsman
    dependencies: [plan]
    strategy:
      type: matrix
      items_source: plan/tasks.json
      item_key: task
      max_concurrency: 4
    exec:
      type: prompt
      source: "Execute: {{ task }}"
FieldRequiredDefaultDescription
typeyes-Must be matrix
items_sourceyes-Path to JSON task list
item_keyyes-JSON key for task items
max_concurrencynoruntime defaultParallel workers

Pre-Execution Validation

Check conditions before step runs.

yaml
validation:
  - type: file_exists
    target: src/models/user.go
    message: "User model required"
  - type: command
    target: "go build ./..."
    message: "Project must compile"
FieldRequiredDescription
typeyesfile_exists, command, schema
targetyesFile path or command
messagenoCustom error message

DAG Rules

Pipeline steps form a directed acyclic graph (DAG).

Enforced rules:

  • No circular dependencies
  • All dependencies must reference valid step IDs
  • All persona values must exist in wave.yaml
  • Independent steps may run in parallel
yaml
steps:
  - id: analyze        # Runs first
    persona: navigator

  - id: security       # Parallel with quality
    persona: auditor
    dependencies: [analyze]

  - id: quality        # Parallel with security
    persona: auditor
    dependencies: [analyze]

  - id: summary        # Waits for both
    persona: navigator
    dependencies: [security, quality]

Step States

StateDescription
pendingWaiting for dependencies
runningCurrently executing
completedFinished successfully
retryingFailed, attempting retry
failedMax retries exceeded

Next Steps

Released under the MIT License.