Agent workflows fail for structural reasons, not prompting reasons.
The model call that should have been a function. The retry loop with no ceiling. The check folded into the producer's own turn, where nobody can count it. WorkflowWright makes you assign every step to code, an agent, or a person — then compiles that decision into a diagram and a runnable orchestrator that cannot drift apart.
if.
These three colours are the same ones the tool draws in every diagram it generates, including the one below.
The idea
Most of designing a workflow is assignment
Pick the cheapest resource that can actually do each step, then decide what happens when it fails. Almost everything else follows from that.
Two errors account for most broken pipelines. Over-assigning to agents, because when you have an agent available every step looks like an agent step — including the ones a five-line script does deterministically, for free, the same way every time. And approval gates in the middle, each of which caps throughput at one person's availability no matter how much compute you point at the rest.
WorkflowWright ships a review rubric of twelve such patterns. These are the ones it finds most often:
- Agent-shaped codeA model call whose output is fully determined by its input — and which is therefore right 99% of the time, which is much harder to debug than right always or never.
- Swallowed loop"Run the tests and fix any failures" inside the builder's own turn. You cannot count those attempts, cap them, read the output, or route the failure anywhere else.
- Unbounded retryA failure edge with no ceiling. Unattended, this is the one that produces a surprising invoice.
- Amnesiac retryFailure routed back to a cold invocation, so the agent spends tokens re-deriving what it already knew and often makes a different first mistake instead of fixing the reported one.
- Implicit handoffEdges that carry no named payload. Works until a node is retried, reordered, or isolated — then fails in a way nobody can trace, because the missing thing was never named.
One spec, four outputs
The diagram, the doc, and the code are generated from the same file
Design decisions live in spec.json. Everything else is compiled from
it, so the picture cannot quietly stop matching the code.
// spec.json — one node and its failure edge { "id": "build", "kind": "agent", "model": "sonnet", "reads": ["plan.md", "verify-report.txt"], "max_attempts": 3, "on_exhausted": "human" } { "from": "verify", "to": "build", "when": "fail", "loop": true, "payload": "verify-report.txt" }
A bounded loop: the builder gets three attempts, each one resuming its own session with the verifier's report, then a person decides.
design.mdA design doc someone who missed the conversation can read and act on..mermaidDiagram source, for pasting into a README or a ticket..htmlA self-contained artifact with the diagram pre-rendered — no CDN, works offline.workflow.pyA runnable orchestrator package: driver, retry bounds, routing, prompts, steps.
Real output
This is the tool's own diagram
Not a mockup. The SVG below is extracted from the artifact
render_workflow.py generates for the bundled example spec — a
ticket-to-pull-request workflow — and this page is rebuilt from it.
Shape carries meaning alongside colour: rectangles are code, rounded nodes are agents, hexagons are people. The dashed edge is the bounded retry loop, carrying the verifier's report back to the builder.
- Code — deterministic
- Agent — judgment
- Human — scarce
Three modes
Depending on what already exists
Design
Nothing built yet
Interviews you and writes the spec. It asks for one specific recent run of the process, ideally one that went wrong — because failure paths decide whether a design survives contact with reality, and nobody volunteers them.
Critique
A workflow already exists
Reconstructs a spec from a script, a set of prompts, or a CI config, then reviews it against twelve patterns. The fields it cannot fill in are usually the parts that are broken. It reviews architecture, not the code your workflow produces.
Scaffold
The spec is agreed
Compiles the spec into a Python package where orchestration is deterministic and agents are separate processes. Regenerating overwrites the driver and never touches your prompts or steps.
The validator
It refuses to generate a workflow that will hurt you
Structural problems are far cheaper to fix in a spec than in generated code that has already spent tokens discovering them. So the scaffolder checks first and exits non-zero.
The spec on the right looks reasonable. It has a producer, a checker, and a retry loop. Here is what the validator actually said about it — unedited:
$ python3 scaffold_workflow.py triage.json --out ./triage refusing to scaffold a spec with structural problems: - Edge test -> fix names no payload. An unnamed edge carries an assumption, not data. - Node 'test' has a fail edge but no pass edge — the success path goes nowhere. - No terminal node — every path loops forever. - Node 'fix' is the target of a retry edge but has no max_attempts. Unbounded retries against a paid API are the one design error here that costs real money unattended.
Four real defects, none of which are visible by reading the spec casually, and the last of which bills you while you sleep.
The generated orchestrator
Four things it gets right that are easy to get wrong by hand
Each of these was a bug first. All four are pinned by tests, so regenerating or refactoring cannot quietly undo them.
-
Retries are counted against the node the failure re-enters
Not the checker that failed. A checker failing is the checker doing its job — count attempts there and the first legitimate rejection exhausts the loop.
-
A retried agent resumes its own session
The producer already holds the context of what it attempted; what it lacks is the news that it failed. Starting cold throws away the first to deliver the second.
-
Every payload is a file
So
--only buildreruns one node against the last run's inputs instead of replaying the whole workflow to reach it — and a failed run leaves something readable behind. -
Prompts travel on stdin wherever stdin is read
They carry whole payload files. Windows caps a command line at 8191 characters through
cmd.exeshims, which also truncate at the first newline — silently, so the agent answers a fragment and the run still looks fine. One backend, Antigravity, ignores stdin; there the prompt goes on the command line and an oversized one is refused rather than quietly cut in half.
Terminal or assistant
Two ways to run agent nodes, one set of guarantees
Routing, retry ceilings, and payloads live in the driver, not at the process boundary — so they are identical either way. Only the model call moves.
Subprocess default
Each agent node
spawns the system its backend names — Claude, Codex, Antigravity, or
an OpenAI-compatible endpoint — and the run goes start to finish on its own. What
you want from a terminal, from CI, or from cron.
Delegate --delegate
The run parks at each agent node, writes the composed prompt to the run directory, and continues when you leave the answer beside it. No CLI on PATH, and no nested session spending tokens out of sight — the mode for working inside an assistant rather than a shell.
$ python3 workflow.py --delegate [10:22:14] intake [code] Fetch ticket, create worktree [10:22:14] scout [agent] Locate relevant code and prior art === scout is delegated === This node is specified for model opus, limited to tools: Read, Grep, Glob. Prompt written to : run/scout.prompt.md Write the answer to: run/scout.result.md exit 76 — attempt counts and the retry ceiling are preserved across the pause
Real output from the bundled example. The prompt is fully composed with payloads substituted, so you do exactly the work a model would have done.
Install
Three ways in, depending on where you work
Do not use GitHub's green Code button. That downloads the
source tree, where SKILL.md sits two directories deep, and the
claude.ai uploader rejects it. Use one of these instead — both are one step.
# Claude Code — paste into a session /plugin marketplace add scottconverse/WorkflowWright /plugin install workflowwright@workflowwright # and to remove it /plugin uninstall workflowwright
Claude Code. No clone, no build step, and updates arrive
through /plugin marketplace update.
# Claude desktop or web Settings → Skills → Upload skill workflowwright.zip ← from the release below
Desktop and web read your claude.ai account rather than a marketplace, so they take the packaged archive. Download workflowwright.zip · all releases
# Codex and Antigravity — same format, from a clone
python3 scripts/install.py ~/.codex/skills/workflowwright
python3 scripts/install.py ~/.gemini/config/skills/workflowwright
Other hosts. Both read a skill as a directory with
SKILL.md and frontmatter, which is the shape this already has — no
adapter, no conversion. Use the installer rather than cp -r: copying
merges, so an upgrade leaves behind files the new version dropped, while the
installer mirrors and reports what it added, updated and removed.
AGENTS.md covers the rest.
Then just describe the problem — "every time a bug comes in I read the ticket, write a fix, run the tests, and open a PR; can we automate that?" The skill triggers on natural phrasing, so you never name it. Full install and uninstall guide.
# or drive the tooling directly python3 skill/scripts/render_workflow.py \ spec.json --out ./out python3 skill/scripts/scaffold_workflow.py \ spec.json --out ./my-workflow make test # 211 tests, no network
Nothing here needs an API key. Designing and rendering never call a model.
Status and limits
What this is not, yet
New and openly developed, with a real test suite: 211 stdlib tests covering the validator, the renderer, the backend adapter, and the generated driver's retry and session behaviour, running on Python 3.10–3.14 on Linux and on Windows. Current release is always the latest release - naming a version here only goes stale at the next tag; if you installed an older archive, see the changelog — v0.2.0 fixed security defects in how spec content was handled.
- The scaffold is a skeleton. Every generated step exits 1 with a TODO until you write it — a stub that returned success would be worse than no stub.
- Isolation is a design decision, not an implementation. A spec declares
worktreeorsandboxand the docs reason about the choice, but the generated code does not create worktrees or containers. That belongs in your intake step. - Running a workflow unattended needs whichever CLI its nodes name
on PATH —
claude,codex,agy, or a reachable OpenAI-compatible endpoint. Designing, rendering, critiquing, and scaffolding never call a model at all, and--delegateruns a workflow with no CLI involved. - Offline diagrams need Playwright. Without it, rendered artifacts fall back to loading Mermaid from a CDN and need network access to draw.
- Anything past those four backends means writing code. A node picks its
system with a
backendfield rather than an edit, but reaching a fifth one — an SDK, a bespoke service — still means changingrun_agentinrunner.py, the single place the workflow leaves the Python process.
Start from the example spec
It is a complete ticket-to-pull-request workflow — seven nodes, a bounded loop, humans at both ends. Adapt it rather than starting from an empty file.