Skip to main content
A build-from-scratch workflow takes a high-level goal, expands it into a spec, then implements the application in phases — each phase followed by an independent verification node and a conditional gate that either advances or retries. A final review with goal_gate=true ensures the result meets the spec before the workflow can succeed. This pattern is useful when you want an agent to build something non-trivial from zero — a CLI tool, a game, a library — where the implementation naturally decomposes into layers that build on each other.

The workflow

Build Solitaire workflow: Start → Spec → Setup → OK? → Data → OK? → Logic → OK? → UI → OK? → Integrate → OK? → Review → OK? → Exit, with Retry arcs from each gate back to its phase, and a Fix arc from the review gate back to UI
build-solitaire.fabro

Key patterns

Phased implementation with verification gates

The workflow decomposes the build into six phases, each building on the previous one:
Each phase follows the same three-node pattern: implement, verify, gate. The implement node builds the code, a separate verify node checks it independently, and a conditional gate routes to the next phase on success or back to retry on failure. This separation matters. The verify node runs with a different prompt and (via the .verify class) a cheaper model. It acts as an independent check — not just “did the implementation node think it succeeded?” but “does an independent evaluation confirm the phase is complete?”

Graph-level retry targets

The graph sets two levels of retry targets:
If a node fails and has no local retry target, Fabro jumps back to impl_setup to re-attempt from project setup. If that target itself can’t recover, Fabro falls back further to impl_logic. This creates a cascading recovery strategy without cluttering every node with retry configuration.

Three-tier model routing

The stylesheet assigns models by role:
  • Sonnet handles routine phases: expanding the spec, setting up the project, wiring integration
  • Opus handles the hard phases: implementing game logic and terminal UI where correctness and complexity demand the strongest model
  • Haiku handles all verification gates: these are straightforward “run the tests, check the output” tasks that don’t need a frontier model
This keeps costs down. Verification runs after every phase — using Haiku instead of Opus for those checks saves significant tokens across a full run.

Goal gate on final review

The review node has goal_gate=true:
This means the workflow cannot succeed unless the review passes. Even if execution reaches the exit node through some edge routing path, Fabro checks all goal gates and fails the run if any are unsatisfied. The review is the quality bar — it reads the original spec and verifies the implementation against it. If the review fails, execution routes back to impl_ui rather than to the beginning. The assumption is that by the time you reach review, the foundation (data structures, game logic) is solid and only the UI or integration needs fixing.

Progressive layering

Each phase reads the spec and builds on the artifacts from prior phases. The data structures phase defines Card, Deck, and Pile types. The game logic phase reads those types and implements rules on top of them. The UI phase reads the game logic and renders it. Each layer has its own tests, so failures are caught at the right level of abstraction. This is more reliable than a single “implement everything” node because:
  • Earlier phases are validated before later phases begin
  • Failures are localized — a broken data structure is caught before game logic tries to use it
  • Retries target the right phase, not the entire build

Run configuration

Pair the workflow with a run config for repeatable execution:
run.toml

Adapting this pattern

The phased build pattern generalizes to any project that decomposes into layers:
  • CLI tool — argument parsing → core logic → output formatting → integration tests
  • REST API — data models → route handlers → middleware → end-to-end tests
  • Library — type definitions → core algorithms → public API → documentation
  • Compiler — lexer → parser → type checker → code generator → test suite
The structure is always the same: decompose into phases that build on each other, verify each one independently, gate advancement on verification, and enforce overall quality with a goal gate on the final review.

Further reading

Failures

Retry policies, goal gates, retry targets, and circuit breakers.

Model Stylesheets

CSS-like rules for assigning models to workflow nodes.

Nodes & Stages

All node types, shapes, and their attributes.

Run Configuration

TOML configs for repeatable, parameterized runs.