The 7-Stage Pipeline
The standard_build workflow — 7 stages, 4 quality gates, 2 bounce-back loops.
The canonical workflow is standard_build() in workflow/standard.py (lines 37-89). Every other workflow in Bonfire derives from this reference pipeline.
The stages
SCOUT → KNIGHT → WARRIOR → PROVER → BARD → WIZARD → HERALD
observe contract execute verify publish audit announceQuality gates
Gates are enforced at stage boundaries by engine/gates.py. A stage cannot advance until its gate passes.
| Stage | Gate | On failure |
|---|---|---|
| Scout | — | Advances unconditionally |
| Knight | completion | Advances only if Knight produced test files |
| Warrior | test_pass | Retry up to max_iterations=3; after 3, escalates |
| Prover | verification | Bounces to Warrior for rework |
| Bard | — | Advances unconditionally |
| Wizard | review_approval | Bounces to Warrior for rework |
| Herald | — | Advances unconditionally |
The two bounce-back loops
Prover to Warrior
The Prover re-runs the tests independently. If the Prover finds a regression the Warrior missed, the pipeline bounces back to the Warrior stage. The Prover is an independent auditor — the Warrior cannot skip it.
Wizard to Warrior
The Wizard reviews the pull request. If the Wizard rejects it (quality, style, architecture, accessibility), the pipeline bounces back to the Warrior for rework. This is the structural reason shipped code earns "Wizard-approved" status.
Both loops respect max iteration counts. After exhaustion, the pipeline escalates rather than spinning.
Checkpoint semantics
State persists to disk between stages via engine/checkpoint.py. A crash at stage 4 resumes at stage 4. Combined with gate enforcement, this means:
- A checkpoint after a
test_passgate is a safe resume point — all prior tests are green. - A checkpoint after a
review_approvalgate means the PR has been Wizard-approved.
Pipeline as data
The standard_build() factory returns a WorkflowPlan — a frozen Pydantic model. The plan is:
- Diffable —
git difftwo plans to see what changed - Versionable — commit plans alongside code
- Serializable —
model_dump_json()for wire transport - Introspectable — iterate stages, query gates, check dependencies
This is the foundational difference from graph-based workflow frameworks where the workflow shape is embedded in Python code.