Skip to content

Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.

docs(readme): draw how pullboard works [I10,M1]

Corey Olson2e09ef4b755e
diff --git a/README.md b/README.md
index 28427a97..ce4da8c0 100644
--- a/README.md
+++ b/README.md
@@ -6,6 +6,8 @@ Pullboard is a work board that lives in your git repo. Every requirement is a on
It runs locally: no account, nothing hosted, no dependencies. The board is one SQLite file inside `.git`. It works with Claude Code, Codex and any agent you can run from a shell, and it never calls a model.
+![How work moves. You decide the rows of SPEC.md. An item freezes its bar when an agent claims it. Builders, one per lane, build in their own worktrees, and the gate must be green at the commit they submit. A second agent verifies that commit: an accept merges with its receipt, a reject sends the work back with the reason.](docs/img/loop.svg)
+
## Why
Coding agents are fast, and on day one it feels like magic. Past a demo, the same things go wrong on every project:
@@ -61,10 +63,23 @@ npm i -g @pullboard/local # from the first npm release; until then, run npm
pullboard tour # thirty seconds on a throwaway repo: a reject, the fix, the ledger
```
-## Quick start
+## Start with an agent
+
+![Starting with an agent. You run pullboard init in your git repo, commit what it wrote, open a new Claude Code session in that folder and say what to build. That agent becomes the coordinator: it takes the spec with you, plans lanes and items, runs a builder per lane and a verifier that built none of it, and merges verified work only.](docs/img/agent-start.svg)
In your repo:
+```sh
+pullboard init
+git add -A && git commit -m "chore: set up pullboard"
+```
+
+Then start a new Claude Code session in that folder, so it loads the skills init installed, and say what you want built, for example "use pullboard to build a notes app". The `pullboard-run` skill makes that session the coordinator. It writes the spec with you one question at a time, and only rows you approve get built. It proposes lanes and plans the items, starts a builder subagent in each lane's worktree and a verifier that built none of it, and merges only what was verified. Questions come back to you in the conversation.
+
+## Quick start
+
+By hand, in your repo:
+
```sh
pullboard init # pullboard.json, SPEC.md, PRACTICE.md, AGENTS.md, git hooks, the board
git add -A && git commit -m "chore: set up pullboard"
@@ -120,6 +135,12 @@ pullboard verify 1 reject --reason TEST_FAILURE --note "a 0-byte upload crashes
A reject reopens the item: the builder fixes it, commits, claims it again and submits the new commit.
+## An item's life
+
+![An item's life, drawn from src/machine.js: each state an item can be in, the moves between them, and the refusals every way into a final state can raise.](docs/img/lifecycle.svg)
+
+Every state, move, guard and refusal is declared once, in `src/machine.js`. The commands check it, the board file refuses any move it does not declare, and the help, [docs/lifecycle.md](docs/lifecycle.md), the view and this picture are drawn from it. Every way into `verified` passes the same guards, whatever command gets there. If you change the lifecycle, redraw the figures with `node docs/img/draw.mjs`; a test fails until you do.
+
## See every project at once
```sh
@@ -155,6 +176,8 @@ pullboard view
## What lives where
+![Where things live. The main checkout is the coordinator and holds SPEC.md, PRACTICE.md, pullboard.json, AGENTS.md and the git hooks. Inside .git, shared by every worktree, are the board and the pinned submitted commits. Beside it, each agent works in its own worktree, builders in their lanes and a verifier, all on the same board. pullboard view lists every project on this machine.](docs/img/layout.svg)
+
| Path | What | In git? |
| --- | --- | --- |
| `SPEC.md`, `PRACTICE.md` | What to build, and the house rules for how, one row per id | yes |
diff --git a/docs/img/agent-start.svg b/docs/img/agent-start.svg
new file mode 100644
index 00000000..c4538d0b
--- /dev/null
+++ b/docs/img/agent-start.svg
@@ -0,0 +1,76 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 840 476" width="840" height="476" role="img" aria-labelledby="title desc">
+<title id="title">Starting with an agent</title><desc id="desc">You run pullboard init in your git repo, commit what it wrote, open a new Claude Code session in that folder and say what to build. That agent becomes the coordinator: it takes the spec with you, and only you approve a row; it proposes lanes and plans items with frozen bars; it starts a builder subagent per lane in its own worktree and a verifier that built none of it; it merges verified work only, and reports.</desc>
+<style>
+text { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif; fill: #1f2328; }
+.mono { font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace; }
+.card { fill: #ffffff; stroke: #d1d9e0; }
+.head { font-size: 14px; font-weight: 600; }
+.aside { font-size: 12px; fill: #59636e; }
+.t1 { font-size: 14px; font-weight: 600; }
+.t2 { font-size: 12px; fill: #59636e; }
+.label { font-size: 12px; fill: #59636e; }
+.code { font-size: 11.5px; fill: #59636e; }
+.edge { fill: none; stroke: #8c959f; stroke-width: 1.5; }
+.edge.back { stroke: #bc4c00; stroke-dasharray: 5 4; }
+.edge.leader { stroke-width: 1; stroke-dasharray: 2 3; }
+.tip { fill: #8c959f; }
+.tip.back { fill: #bc4c00; }
+.label.back { fill: #bc4c00; }
+.frame { fill: none; stroke: #d1d9e0; stroke-dasharray: 4 4; }
+.plain rect { fill: #f6f8fa; stroke: #d1d9e0; }
+.person rect { fill: #ddf4ff; stroke: #54aeff; }
+.person .t1 { fill: #0a3069; } .person .t2 { fill: #0550ae; }
+.agent rect { fill: #fbefff; stroke: #c297ff; }
+.agent .t1 { fill: #3e1f79; } .agent .t2 { fill: #6639ba; }
+.check rect { fill: #fff8c5; stroke: #d4a72c; }
+.check .t1 { fill: #4d2d00; } .check .t2 { fill: #7d4e00; }
+.done rect { fill: #dafbe1; stroke: #4ac26b; }
+.done .t1 { fill: #044f1e; } .done .t2 { fill: #116329; }
+@media (prefers-color-scheme: dark) {
+ text { fill: #f0f6fc; }
+ .card { fill: #0d1117; stroke: #3d444d; }
+ .aside, .t2, .label, .code { fill: #9198a1; }
+ .edge { stroke: #6e7681; }
+ .edge.back { stroke: #f0883e; }
+ .tip { fill: #6e7681; }
+ .tip.back, .label.back { fill: #f0883e; }
+ .frame { stroke: #3d444d; }
+ .plain rect { fill: #151b23; stroke: #3d444d; }
+ .person rect { fill: #0c2d6b; stroke: #1f6feb; }
+ .person .t1 { fill: #cae8ff; } .person .t2 { fill: #a5d6ff; }
+ .agent rect { fill: #271052; stroke: #8957e5; }
+ .agent .t1 { fill: #ecdeff; } .agent .t2 { fill: #d2a8ff; }
+ .check rect { fill: #272115; stroke: #9e6a03; }
+ .check .t1 { fill: #f8e3a1; } .check .t2 { fill: #e3b341; }
+ .done rect { fill: #04260f; stroke: #238636; }
+ .done .t1 { fill: #aff5b4; } .done .t2 { fill: #7ee787; }
+}
+</style>
+<defs>
+<marker id="tip" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="9" markerHeight="9" markerUnits="userSpaceOnUse" orient="auto"><path class="tip" d="M0 1 L9 5 L0 9 z"/></marker>
+<marker id="tip-back" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="9" markerHeight="9" markerUnits="userSpaceOnUse" orient="auto"><path class="tip back" d="M0 1 L9 5 L0 9 z"/></marker>
+</defs>
+<rect class="card" x="0.5" y="0.5" width="839" height="475" rx="12"/>
+<text class="head" x="24" y="34">Starting with an agent</text>
+<rect class="frame" x="24" y="52" width="388" height="400" rx="10"/>
+<rect class="frame" x="428" y="52" width="388" height="400" rx="10"/>
+<text class="t1" x="44" y="78">You, once</text>
+<text class="t1" x="448" y="78">The agent, as coordinator</text>
+<g class="person"><rect x="44" y="92" width="348" height="56" rx="8"/><text class="t1" x="218" y="116" text-anchor="middle">pullboard init</text><text class="t2" x="218" y="134" text-anchor="middle">in your project's git repo</text></g>
+<g class="person"><rect x="44" y="188" width="348" height="56" rx="8"/><text class="t1" x="218" y="212" text-anchor="middle">Commit what init wrote</text><text class="t2" x="218" y="230" text-anchor="middle">git add -A, then git commit</text></g>
+<g class="person"><rect x="44" y="284" width="348" height="56" rx="8"/><text class="t1" x="218" y="308" text-anchor="middle">Open a new session</text><text class="t2" x="218" y="326" text-anchor="middle">Claude Code, in that folder</text></g>
+<g class="person"><rect x="44" y="380" width="348" height="56" rx="8"/><text class="t1" x="218" y="404" text-anchor="middle">Say what to build</text><text class="t2" x="218" y="422" text-anchor="middle">&quot;use pullboard to build …&quot;</text></g>
+<path class="edge" d="M 218 148 L 218 184" marker-end="url(#tip)"/>
+<path class="edge" d="M 218 244 L 218 280" marker-end="url(#tip)"/>
+<path class="edge" d="M 218 340 L 218 376" marker-end="url(#tip)"/>
+<g class="agent"><rect x="448" y="92" width="348" height="56" rx="8"/><text class="t1" x="622" y="116" text-anchor="middle">Spec with you</text><text class="t2" x="622" y="134" text-anchor="middle">only you approve a row</text></g>
+<g class="agent"><rect x="448" y="164" width="348" height="56" rx="8"/><text class="t1" x="622" y="188" text-anchor="middle">Lanes and a plan</text><text class="t2" x="622" y="206" text-anchor="middle">items with frozen bars</text></g>
+<g class="agent"><rect x="448" y="236" width="348" height="56" rx="8"/><text class="t1" x="622" y="260" text-anchor="middle">A builder per lane</text><text class="t2" x="622" y="278" text-anchor="middle">subagents in worktrees</text></g>
+<g class="agent"><rect x="448" y="308" width="348" height="56" rx="8"/><text class="t1" x="622" y="332" text-anchor="middle">A verifier</text><text class="t2" x="622" y="350" text-anchor="middle">built none of it, checks each</text></g>
+<g class="done"><rect x="448" y="380" width="348" height="56" rx="8"/><text class="t1" x="622" y="404" text-anchor="middle">Merge and report</text><text class="t2" x="622" y="422" text-anchor="middle">verified work only</text></g>
+<path class="edge" d="M 622 148 L 622 160" marker-end="url(#tip)"/>
+<path class="edge" d="M 622 220 L 622 232" marker-end="url(#tip)"/>
+<path class="edge" d="M 622 292 L 622 304" marker-end="url(#tip)"/>
+<path class="edge" d="M 622 364 L 622 376" marker-end="url(#tip)"/>
+<path class="edge" d="M 392 408 L 420 408 L 420 120 L 444 120" marker-end="url(#tip)"/>
+</svg>
diff --git a/docs/img/draw.mjs b/docs/img/draw.mjs
new file mode 100644
index 00000000..6e4b8503
--- /dev/null
+++ b/docs/img/draw.mjs
@@ -0,0 +1,345 @@
+/**
+ * The README's figures, drawn as SVG (I10). Each one is a card that carries its own light and dark
+ * colors, so it reads on GitHub, on npm and in an editor's preview alike. The lifecycle is drawn
+ * from src/machine.js, the one declaration of every state and move (M1): a state or a pair of
+ * states this file has no place for is refused, never left out.
+ *
+ * After changing a figure or the lifecycle, redraw them from the repo root: node docs/img/draw.mjs
+ * test/readme.test.js fails while a committed figure differs from what this draws.
+ */
+import { writeFileSync } from 'node:fs';
+import { join } from 'node:path';
+import { pathToFileURL } from 'node:url';
+import { MACHINE } from '../../src/machine.js';
+
+const SANS = "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif";
+const MONO = "ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace";
+
+/** One palette for every figure: light first, then the dark block that swaps it. */
+const STYLE = `
+text { font-family: ${SANS}; fill: #1f2328; }
+.mono { font-family: ${MONO}; }
+.card { fill: #ffffff; stroke: #d1d9e0; }
+.head { font-size: 14px; font-weight: 600; }
+.aside { font-size: 12px; fill: #59636e; }
+.t1 { font-size: 14px; font-weight: 600; }
+.t2 { font-size: 12px; fill: #59636e; }
+.label { font-size: 12px; fill: #59636e; }
+.code { font-size: 11.5px; fill: #59636e; }
+.edge { fill: none; stroke: #8c959f; stroke-width: 1.5; }
+.edge.back { stroke: #bc4c00; stroke-dasharray: 5 4; }
+.edge.leader { stroke-width: 1; stroke-dasharray: 2 3; }
+.tip { fill: #8c959f; }
+.tip.back { fill: #bc4c00; }
+.label.back { fill: #bc4c00; }
+.frame { fill: none; stroke: #d1d9e0; stroke-dasharray: 4 4; }
+.plain rect { fill: #f6f8fa; stroke: #d1d9e0; }
+.person rect { fill: #ddf4ff; stroke: #54aeff; }
+.person .t1 { fill: #0a3069; } .person .t2 { fill: #0550ae; }
+.agent rect { fill: #fbefff; stroke: #c297ff; }
+.agent .t1 { fill: #3e1f79; } .agent .t2 { fill: #6639ba; }
+.check rect { fill: #fff8c5; stroke: #d4a72c; }
+.check .t1 { fill: #4d2d00; } .check .t2 { fill: #7d4e00; }
+.done rect { fill: #dafbe1; stroke: #4ac26b; }
+.done .t1 { fill: #044f1e; } .done .t2 { fill: #116329; }
+@media (prefers-color-scheme: dark) {
+ text { fill: #f0f6fc; }
+ .card { fill: #0d1117; stroke: #3d444d; }
+ .aside, .t2, .label, .code { fill: #9198a1; }
+ .edge { stroke: #6e7681; }
+ .edge.back { stroke: #f0883e; }
+ .tip { fill: #6e7681; }
+ .tip.back, .label.back { fill: #f0883e; }
+ .frame { stroke: #3d444d; }
+ .plain rect { fill: #151b23; stroke: #3d444d; }
+ .person rect { fill: #0c2d6b; stroke: #1f6feb; }
+ .person .t1 { fill: #cae8ff; } .person .t2 { fill: #a5d6ff; }
+ .agent rect { fill: #271052; stroke: #8957e5; }
+ .agent .t1 { fill: #ecdeff; } .agent .t2 { fill: #d2a8ff; }
+ .check rect { fill: #272115; stroke: #9e6a03; }
+ .check .t1 { fill: #f8e3a1; } .check .t2 { fill: #e3b341; }
+ .done rect { fill: #04260f; stroke: #238636; }
+ .done .t1 { fill: #aff5b4; } .done .t2 { fill: #7ee787; }
+}`;
+
+const esc = (text) => String(text).replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;').replaceAll('"', '&quot;');
+
+/**
+ * A whole figure: its size, the words a screen reader says for it, and what is drawn on its card.
+ *
+ * @param {{ width: number, height: number, title: string, desc: string, body: string[] }} figure
+ * @returns {string}
+ */
+function figure({ width, height, title, desc, body }) {
+ return [
+ `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${width} ${height}" width="${width}" height="${height}" role="img" aria-labelledby="title desc">`,
+ `<title id="title">${esc(title)}</title><desc id="desc">${esc(desc)}</desc>`,
+ `<style>${STYLE}\n</style>`,
+ '<defs>',
+ '<marker id="tip" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="9" markerHeight="9" markerUnits="userSpaceOnUse" orient="auto"><path class="tip" d="M0 1 L9 5 L0 9 z"/></marker>',
+ '<marker id="tip-back" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="9" markerHeight="9" markerUnits="userSpaceOnUse" orient="auto"><path class="tip back" d="M0 1 L9 5 L0 9 z"/></marker>',
+ '</defs>',
+ `<rect class="card" x="0.5" y="0.5" width="${width - 1}" height="${height - 1}" rx="12"/>`,
+ ...body,
+ '</svg>',
+ '',
+ ].join('\n');
+}
+
+/**
+ * A text line. `anchor` is start, middle or end; `cls` its classes.
+ *
+ * @param {number} x
+ * @param {number} y
+ * @param {string} words
+ * @param {string} cls
+ * @param {string} [anchor]
+ */
+const text = (x, y, words, cls, anchor = 'start') => `<text class="${cls}" x="${x}" y="${y}"${anchor === 'start' ? '' : ` text-anchor="${anchor}"`}>${esc(words)}</text>`;
+
+/**
+ * A box with a title and an optional second line, centred. A stack draws two cards behind it, for
+ * work several agents do at once; `final` draws a second border inside, for a state nothing leaves.
+ *
+ * @param {{ x: number, y: number, w: number, h: number, kind: string, title: string, sub?: string, mono?: boolean, stack?: boolean, final?: string }} box
+ * @returns {string}
+ */
+function box({ x, y, w, h, kind, title, sub, mono = false, stack = false, final }) {
+ const cx = x + w / 2;
+ const behind = stack ? [10, 5].map((d) => `<rect x="${x + d}" y="${y - d}" width="${w}" height="${h}" rx="8"/>`).join('') : '';
+ const inner = final ? `<rect x="${x + 4}" y="${y + 4}" width="${w - 8}" height="${h - 8}" rx="5" fill="none"/>` : '';
+ const lines = sub
+ ? [text(cx, y + h / 2 - 4, title, `t1${mono ? ' mono' : ''}`, 'middle'), text(cx, y + h / 2 + 14, sub, 't2', 'middle')]
+ : [text(cx, y + h / 2 + 5, title, `t1${mono ? ' mono' : ''}`, 'middle')];
+ return `<g class="${kind}"${final ? ` data-final="${esc(final)}"` : ''}>${behind}<rect x="${x}" y="${y}" width="${w}" height="${h}" rx="8"/>${inner}${lines.join('')}</g>`;
+}
+
+/**
+ * A connector: a polyline through `points`, with an arrowhead unless `tip` is false.
+ *
+ * @param {number[][]} points
+ * @param {{ back?: boolean, tip?: boolean, leader?: boolean }} [options]
+ */
+function edge(points, { back = false, tip = true, leader = false } = {}) {
+ const d = points.map(([x, y], i) => `${i ? 'L' : 'M'} ${x} ${y}`).join(' ');
+ const cls = `edge${back ? ' back' : ''}${leader ? ' leader' : ''}`;
+ return `<path class="${cls}" d="${d}"${tip ? ` marker-end="url(#${back ? 'tip-back' : 'tip'})"` : ''}/>`;
+}
+
+/** How a piece of work moves: from the rows the person approves to a merge, and back on a reject. */
+export function drawLoop() {
+ const W = 200;
+ const H = 64;
+ return figure({
+ width: 840,
+ height: 290,
+ title: 'How work moves',
+ desc: 'You approve spec rows. Each item freezes its bar when an agent claims it. Builders, one per lane, build in their own worktrees; the gate must be green at the commit they submit. A second agent verifies that commit: an accept merges with its receipt, a reject sends the work back to the builder with the reason.',
+ body: [
+ text(24, 34, 'How work moves', 'head'),
+ box({ x: 40, y: 62, w: W, h: H, kind: 'person', title: 'You decide', sub: 'the rows of SPEC.md' }),
+ box({ x: 320, y: 62, w: W, h: H, kind: 'plain', title: 'An item', sub: 'its bar frozen at claim' }),
+ box({ x: 600, y: 62, w: W, h: H, kind: 'agent', title: 'Builders', sub: 'one per lane, own worktree', stack: true }),
+ box({ x: 600, y: 200, w: W, h: H, kind: 'check', title: 'The gate', sub: 'tests green at the commit' }),
+ box({ x: 320, y: 200, w: W, h: H, kind: 'agent', title: 'A verifier', sub: 'a second agent checks it' }),
+ box({ x: 40, y: 200, w: W, h: H, kind: 'done', title: 'Merged', sub: 'with its receipt' }),
+ edge([[240, 94], [316, 94]]),
+ edge([[520, 94], [596, 94]]),
+ edge([[700, 126], [700, 196]]),
+ edge([[600, 232], [524, 232]]),
+ edge([[320, 232], [244, 232]]),
+ edge([[440, 200], [440, 166], [650, 166], [650, 140]], { back: true }),
+ text(452, 158, 'a reject sends it back', 'label back'),
+ ],
+ });
+}
+
+/** Where each state sits, by id. A state missing here is refused, never left out. */
+const PLACES = {
+ open: [25, 150],
+ claimed: [235, 150],
+ submitted: [445, 150],
+ verified: [655, 150],
+ withdrawn: [445, 284],
+};
+
+/**
+ * How the moves between each pair of states are drawn: the path, where its verbs go, and whether
+ * it leads back. A pair of states missing here is refused. Moves that keep a state are written in
+ * its box instead, after a ↻.
+ */
+const ROUTES = {
+ 'open>claimed': { points: [[185, 179], [231, 179]], label: [208, 171, 'middle'] },
+ 'claimed>submitted': { points: [[395, 179], [441, 179]], label: [418, 171, 'middle'] },
+ 'submitted>verified': { points: [[605, 179], [651, 179]], label: [628, 171, 'middle'] },
+ 'claimed>open': { points: [[335, 150], [335, 120], [145, 120], [145, 146]], back: true, label: [240, 94, 'middle'], wrap: 2 },
+ 'submitted>open': { points: [[545, 150], [545, 66], [115, 66], [115, 146]], back: true, label: [330, 58, 'middle'] },
+ 'open>withdrawn': { points: [[105, 208], [105, 313], [441, 313]], label: [210, 305, 'middle'] },
+ 'claimed>withdrawn': { points: [[315, 208], [315, 313]], tip: false },
+ 'submitted>withdrawn': { points: [[525, 208], [525, 280]] },
+};
+
+/** Where the guards every move into a final state passes are listed, by state id. */
+const GUARD_NOTES = {
+ verified: { x: 640, y: 26, w: 176, leader: [[735, 122], [735, 146]] },
+ withdrawn: { x: 640, y: 284, w: 176, leader: [[640, 313], [609, 313]] },
+};
+
+/**
+ * Split words joined by ' · ' into `count` lines, as evenly as their order allows.
+ *
+ * @param {string[]} words
+ * @param {number} count
+ * @returns {string[]}
+ */
+function wrapped(words, count) {
+ const size = Math.ceil(words.length / count);
+ return Array.from({ length: Math.ceil(words.length / size) }, (_, i) => words.slice(i * size, (i + 1) * size).join(' · '));
+}
+
+/**
+ * An item's life, drawn from the lifecycle declaration: every state, every move's verb between
+ * each pair of states, the moves that keep a state, the final states, and the refusals every move
+ * into a final state can raise.
+ *
+ * @param {any} [machine]
+ * @returns {string}
+ */
+export function drawLifecycle(machine = MACHINE) {
+ const W = 160;
+ const H = 58;
+ for (const state of machine.states) {
+ if (!PLACES[state.id]) throw new Error(`no place for state ${state.id}: add it to PLACES in docs/img/draw.mjs`);
+ }
+ /** @type {Map<string, string[]>} */
+ const verbs = new Map();
+ for (const move of machine.moves) {
+ for (const from of move.from) {
+ const key = `${from}>${move.to}`;
+ if (from !== move.to && !ROUTES[key]) throw new Error(`no route for ${from} > ${move.to}: add it to ROUTES in docs/img/draw.mjs`);
+ const verb = move.by.includes('clock') ? `${move.verb} (clock)` : move.verb;
+ if (!verbs.get(key)?.includes(verb)) verbs.set(key, [...(verbs.get(key) ?? []), verb]);
+ }
+ }
+ const finals = machine.states.filter((state) => state.final).map((state) => state.id);
+ const body = [text(24, 34, "An item's life", 'head'), text(140, 34, `starts ${machine.initial}; ends ${finals.join(' or ')}`, 'aside')];
+ for (const state of machine.states) {
+ const [x, y] = PLACES[state.id];
+ const keeps = verbs.get(`${state.id}>${state.id}`);
+ body.push(box({ x, y, w: W, h: H, kind: state.id === 'verified' ? 'done' : 'plain', title: state.id, sub: keeps ? `↻ ${keeps.join(' · ')}` : undefined, final: state.final ? state.id : undefined }));
+ }
+ for (const [key, said] of verbs) {
+ const [from, to] = key.split('>');
+ if (from === to) continue;
+ const route = ROUTES[key];
+ body.push(edge(route.points, { back: route.back, tip: route.tip !== false }));
+ if (!route.label) continue;
+ const [x, y, anchor] = route.label;
+ wrapped(said, route.wrap ?? 1).forEach((line, i) => body.push(text(x, y + i * 15, line, `label${route.back ? ' back' : ''}`, anchor)));
+ }
+ for (const id of finals) {
+ const note = GUARD_NOTES[id];
+ if (!note) throw new Error(`no place for the guards into ${id}: add it to GUARD_NOTES in docs/img/draw.mjs`);
+ const codes = machine.exitGuards[id].map((guard) => machine.guards.find((each) => each.id === guard).refuse);
+ body.push(`<g class="plain"><rect x="${note.x}" y="${note.y}" width="${note.w}" height="${30 + codes.length * 16}" rx="8"/></g>`);
+ body.push(text(note.x + 12, note.y + 20, `every way into ${id}`, 'label'));
+ codes.forEach((code, i) => body.push(text(note.x + 12, note.y + 38 + i * 16, code, 'code mono')));
+ body.push(edge(note.leader, { tip: false, leader: true }));
+ }
+ body.push(text(24, 374, '↻ a move that keeps the state · dashed: back to open · double border: final · codes: the refusal each guard raises', 'aside'));
+ return figure({
+ width: 840,
+ height: 392,
+ title: "An item's life",
+ desc: `Drawn from src/machine.js. An item starts ${machine.initial} and ends ${finals.join(' or ')}. ${[...verbs]
+ .filter(([key]) => key.split('>')[0] !== key.split('>')[1])
+ .map(([key, said]) => `${key.replace('>', ' to ')}: ${said.join(', ')}`)
+ .join('. ')}.`,
+ body,
+ });
+}
+
+/** Where things live: the main checkout, the lane worktrees beside it, and the one board they share. */
+export function drawLayout() {
+ const files = [
+ ['SPEC.md', 'what to build, one row per id'],
+ ['PRACTICE.md', 'the house rules'],
+ ['pullboard.json', 'gate, lanes, commit rules'],
+ ['AGENTS.md, .claude/', 'how agents work here'],
+ ['.githooks/', 'commit and push checks'],
+ ];
+ const trees = [
+ ['../repo-web-1', 'builder · web lane'],
+ ['../repo-api-1', 'builder · api lane'],
+ ['../repo-review-1', 'verifier · built none of it'],
+ ];
+ return figure({
+ width: 840,
+ height: 404,
+ title: 'Where things live',
+ desc: 'The main checkout is the coordinator. It holds SPEC.md, PRACTICE.md, pullboard.json, AGENTS.md and the git hooks. Inside .git, shared by every worktree, are the board, board.sqlite, and the pinned submitted commits. Beside it, each agent works in its own worktree: builders in their lanes and a verifier that built none of it, all on the same board. pullboard view lists every project on this machine.',
+ body: [
+ text(24, 34, 'Where things live', 'head'),
+ '<rect class="frame" x="24" y="52" width="400" height="328" rx="10"/>',
+ text(44, 80, 'your repo: the main checkout', 't1'),
+ text(44, 98, 'the coordinator files, merges and talks with you', 'aside'),
+ ...files.flatMap(([name, what], i) => [text(44, 130 + i * 22, name, 'mono label'), text(204, 130 + i * 22, what, 'label')]),
+ '<g class="plain"><rect x="44" y="236" width="360" height="126" rx="8"/></g>',
+ text(60, 260, '.git, shared by every worktree', 't1 mono'),
+ text(60, 288, 'pullboard/board.sqlite', 'mono label'),
+ text(60, 305, 'items, claims, verdicts, shouts', 'aside'),
+ text(60, 333, 'refs/pullboard/items', 'mono label'),
+ text(60, 350, 'every submitted commit, pinned', 'aside'),
+ ...trees.map(([name, role], i) => box({ x: 480, y: 60 + i * 80, w: 336, h: 56, kind: 'agent', title: name, sub: role, mono: true })),
+ ...trees.map((_, i) => edge([[480, 88 + i * 80], [452, 88 + i * 80]], { tip: false })),
+ edge([[452, 88], [452, 300], [408, 300]]),
+ text(470, 300, 'one board: every worktree reads and writes it', 'aside'),
+ box({ x: 480, y: 320, w: 336, h: 56, kind: 'person', title: '~/.pullboard/projects.json', sub: 'pullboard view: every project here', mono: true }),
+ ],
+ });
+}
+
+/** Starting with an agent: four steps for the person, then the agent runs the team. */
+export function drawAgentStart() {
+ const yours = [
+ ['pullboard init', "in your project's git repo"],
+ ['Commit what init wrote', 'git add -A, then git commit'],
+ ['Open a new session', 'Claude Code, in that folder'],
+ ['Say what to build', '"use pullboard to build …"'],
+ ];
+ const theirs = [
+ ['Spec with you', 'only you approve a row', 'agent'],
+ ['Lanes and a plan', 'items with frozen bars', 'agent'],
+ ['A builder per lane', 'subagents in worktrees', 'agent'],
+ ['A verifier', 'built none of it, checks each', 'agent'],
+ ['Merge and report', 'verified work only', 'done'],
+ ];
+ return figure({
+ width: 840,
+ height: 476,
+ title: 'Starting with an agent',
+ desc: 'You run pullboard init in your git repo, commit what it wrote, open a new Claude Code session in that folder and say what to build. That agent becomes the coordinator: it takes the spec with you, and only you approve a row; it proposes lanes and plans items with frozen bars; it starts a builder subagent per lane in its own worktree and a verifier that built none of it; it merges verified work only, and reports.',
+ body: [
+ text(24, 34, 'Starting with an agent', 'head'),
+ '<rect class="frame" x="24" y="52" width="388" height="400" rx="10"/>',
+ '<rect class="frame" x="428" y="52" width="388" height="400" rx="10"/>',
+ text(44, 78, 'You, once', 't1'),
+ text(448, 78, 'The agent, as coordinator', 't1'),
+ ...yours.map(([title, sub], i) => box({ x: 44, y: 92 + i * 96, w: 348, h: 56, kind: 'person', title, sub })),
+ ...yours.slice(1).map((_, i) => edge([[218, 148 + i * 96], [218, 184 + i * 96]])),
+ ...theirs.map(([title, sub, kind], i) => box({ x: 448, y: 92 + i * 72, w: 348, h: 56, kind, title, sub })),
+ ...theirs.slice(1).map((_, i) => edge([[622, 148 + i * 72], [622, 160 + i * 72]])),
+ edge([[392, 408], [420, 408], [420, 120], [444, 120]]),
+ ],
+ });
+}
+
+/** Every figure the README links, by file name under docs/img. */
+export const FIGURES = { loop: drawLoop, lifecycle: drawLifecycle, layout: drawLayout, 'agent-start': drawAgentStart };
+
+if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
+ for (const [name, draw] of Object.entries(FIGURES)) {
+ writeFileSync(join(import.meta.dirname, `${name}.svg`), draw());
+ console.log(`drew docs/img/${name}.svg`);
+ }
+}
diff --git a/docs/img/layout.svg b/docs/img/layout.svg
new file mode 100644
index 00000000..a98dcad6
--- /dev/null
+++ b/docs/img/layout.svg
@@ -0,0 +1,83 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 840 404" width="840" height="404" role="img" aria-labelledby="title desc">
+<title id="title">Where things live</title><desc id="desc">The main checkout is the coordinator. It holds SPEC.md, PRACTICE.md, pullboard.json, AGENTS.md and the git hooks. Inside .git, shared by every worktree, are the board, board.sqlite, and the pinned submitted commits. Beside it, each agent works in its own worktree: builders in their lanes and a verifier that built none of it, all on the same board. pullboard view lists every project on this machine.</desc>
+<style>
+text { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif; fill: #1f2328; }
+.mono { font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace; }
+.card { fill: #ffffff; stroke: #d1d9e0; }
+.head { font-size: 14px; font-weight: 600; }
+.aside { font-size: 12px; fill: #59636e; }
+.t1 { font-size: 14px; font-weight: 600; }
+.t2 { font-size: 12px; fill: #59636e; }
+.label { font-size: 12px; fill: #59636e; }
+.code { font-size: 11.5px; fill: #59636e; }
+.edge { fill: none; stroke: #8c959f; stroke-width: 1.5; }
+.edge.back { stroke: #bc4c00; stroke-dasharray: 5 4; }
+.edge.leader { stroke-width: 1; stroke-dasharray: 2 3; }
+.tip { fill: #8c959f; }
+.tip.back { fill: #bc4c00; }
+.label.back { fill: #bc4c00; }
+.frame { fill: none; stroke: #d1d9e0; stroke-dasharray: 4 4; }
+.plain rect { fill: #f6f8fa; stroke: #d1d9e0; }
+.person rect { fill: #ddf4ff; stroke: #54aeff; }
+.person .t1 { fill: #0a3069; } .person .t2 { fill: #0550ae; }
+.agent rect { fill: #fbefff; stroke: #c297ff; }
+.agent .t1 { fill: #3e1f79; } .agent .t2 { fill: #6639ba; }
+.check rect { fill: #fff8c5; stroke: #d4a72c; }
+.check .t1 { fill: #4d2d00; } .check .t2 { fill: #7d4e00; }
+.done rect { fill: #dafbe1; stroke: #4ac26b; }
+.done .t1 { fill: #044f1e; } .done .t2 { fill: #116329; }
+@media (prefers-color-scheme: dark) {
+ text { fill: #f0f6fc; }
+ .card { fill: #0d1117; stroke: #3d444d; }
+ .aside, .t2, .label, .code { fill: #9198a1; }
+ .edge { stroke: #6e7681; }
+ .edge.back { stroke: #f0883e; }
+ .tip { fill: #6e7681; }
+ .tip.back, .label.back { fill: #f0883e; }
+ .frame { stroke: #3d444d; }
+ .plain rect { fill: #151b23; stroke: #3d444d; }
+ .person rect { fill: #0c2d6b; stroke: #1f6feb; }
+ .person .t1 { fill: #cae8ff; } .person .t2 { fill: #a5d6ff; }
+ .agent rect { fill: #271052; stroke: #8957e5; }
+ .agent .t1 { fill: #ecdeff; } .agent .t2 { fill: #d2a8ff; }
+ .check rect { fill: #272115; stroke: #9e6a03; }
+ .check .t1 { fill: #f8e3a1; } .check .t2 { fill: #e3b341; }
+ .done rect { fill: #04260f; stroke: #238636; }
+ .done .t1 { fill: #aff5b4; } .done .t2 { fill: #7ee787; }
+}
+</style>
+<defs>
+<marker id="tip" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="9" markerHeight="9" markerUnits="userSpaceOnUse" orient="auto"><path class="tip" d="M0 1 L9 5 L0 9 z"/></marker>
+<marker id="tip-back" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="9" markerHeight="9" markerUnits="userSpaceOnUse" orient="auto"><path class="tip back" d="M0 1 L9 5 L0 9 z"/></marker>
+</defs>
+<rect class="card" x="0.5" y="0.5" width="839" height="403" rx="12"/>
+<text class="head" x="24" y="34">Where things live</text>
+<rect class="frame" x="24" y="52" width="400" height="328" rx="10"/>
+<text class="t1" x="44" y="80">your repo: the main checkout</text>
+<text class="aside" x="44" y="98">the coordinator files, merges and talks with you</text>
+<text class="mono label" x="44" y="130">SPEC.md</text>
+<text class="label" x="204" y="130">what to build, one row per id</text>
+<text class="mono label" x="44" y="152">PRACTICE.md</text>
+<text class="label" x="204" y="152">the house rules</text>
+<text class="mono label" x="44" y="174">pullboard.json</text>
+<text class="label" x="204" y="174">gate, lanes, commit rules</text>
+<text class="mono label" x="44" y="196">AGENTS.md, .claude/</text>
+<text class="label" x="204" y="196">how agents work here</text>
+<text class="mono label" x="44" y="218">.githooks/</text>
+<text class="label" x="204" y="218">commit and push checks</text>
+<g class="plain"><rect x="44" y="236" width="360" height="126" rx="8"/></g>
+<text class="t1 mono" x="60" y="260">.git, shared by every worktree</text>
+<text class="mono label" x="60" y="288">pullboard/board.sqlite</text>
+<text class="aside" x="60" y="305">items, claims, verdicts, shouts</text>
+<text class="mono label" x="60" y="333">refs/pullboard/items</text>
+<text class="aside" x="60" y="350">every submitted commit, pinned</text>
+<g class="agent"><rect x="480" y="60" width="336" height="56" rx="8"/><text class="t1 mono" x="648" y="84" text-anchor="middle">../repo-web-1</text><text class="t2" x="648" y="102" text-anchor="middle">builder · web lane</text></g>
+<g class="agent"><rect x="480" y="140" width="336" height="56" rx="8"/><text class="t1 mono" x="648" y="164" text-anchor="middle">../repo-api-1</text><text class="t2" x="648" y="182" text-anchor="middle">builder · api lane</text></g>
+<g class="agent"><rect x="480" y="220" width="336" height="56" rx="8"/><text class="t1 mono" x="648" y="244" text-anchor="middle">../repo-review-1</text><text class="t2" x="648" y="262" text-anchor="middle">verifier · built none of it</text></g>
+<path class="edge" d="M 480 88 L 452 88"/>
+<path class="edge" d="M 480 168 L 452 168"/>
+<path class="edge" d="M 480 248 L 452 248"/>
+<path class="edge" d="M 452 88 L 452 300 L 408 300" marker-end="url(#tip)"/>
+<text class="aside" x="470" y="300">one board: every worktree reads and writes it</text>
+<g class="person"><rect x="480" y="320" width="336" height="56" rx="8"/><text class="t1 mono" x="648" y="344" text-anchor="middle">~/.pullboard/projects.json</text><text class="t2" x="648" y="362" text-anchor="middle">pullboard view: every project here</text></g>
+</svg>
diff --git a/docs/img/lifecycle.svg b/docs/img/lifecycle.svg
new file mode 100644
index 00000000..e4cca59d
--- /dev/null
+++ b/docs/img/lifecycle.svg
@@ -0,0 +1,89 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 840 392" width="840" height="392" role="img" aria-labelledby="title desc">
+<title id="title">An item's life</title><desc id="desc">Drawn from src/machine.js. An item starts open and ends verified or withdrawn. open to claimed: claim. claimed to open: release, lapse (clock), escalate, refreeze. claimed to submitted: submit. submitted to verified: accept. submitted to open: reject, refreeze. open to withdrawn: withdraw. claimed to withdrawn: withdraw. submitted to withdrawn: withdraw.</desc>
+<style>
+text { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif; fill: #1f2328; }
+.mono { font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace; }
+.card { fill: #ffffff; stroke: #d1d9e0; }
+.head { font-size: 14px; font-weight: 600; }
+.aside { font-size: 12px; fill: #59636e; }
+.t1 { font-size: 14px; font-weight: 600; }
+.t2 { font-size: 12px; fill: #59636e; }
+.label { font-size: 12px; fill: #59636e; }
+.code { font-size: 11.5px; fill: #59636e; }
+.edge { fill: none; stroke: #8c959f; stroke-width: 1.5; }
+.edge.back { stroke: #bc4c00; stroke-dasharray: 5 4; }
+.edge.leader { stroke-width: 1; stroke-dasharray: 2 3; }
+.tip { fill: #8c959f; }
+.tip.back { fill: #bc4c00; }
+.label.back { fill: #bc4c00; }
+.frame { fill: none; stroke: #d1d9e0; stroke-dasharray: 4 4; }
+.plain rect { fill: #f6f8fa; stroke: #d1d9e0; }
+.person rect { fill: #ddf4ff; stroke: #54aeff; }
+.person .t1 { fill: #0a3069; } .person .t2 { fill: #0550ae; }
+.agent rect { fill: #fbefff; stroke: #c297ff; }
+.agent .t1 { fill: #3e1f79; } .agent .t2 { fill: #6639ba; }
+.check rect { fill: #fff8c5; stroke: #d4a72c; }
+.check .t1 { fill: #4d2d00; } .check .t2 { fill: #7d4e00; }
+.done rect { fill: #dafbe1; stroke: #4ac26b; }
+.done .t1 { fill: #044f1e; } .done .t2 { fill: #116329; }
+@media (prefers-color-scheme: dark) {
+ text { fill: #f0f6fc; }
+ .card { fill: #0d1117; stroke: #3d444d; }
+ .aside, .t2, .label, .code { fill: #9198a1; }
+ .edge { stroke: #6e7681; }
+ .edge.back { stroke: #f0883e; }
+ .tip { fill: #6e7681; }
+ .tip.back, .label.back { fill: #f0883e; }
+ .frame { stroke: #3d444d; }
+ .plain rect { fill: #151b23; stroke: #3d444d; }
+ .person rect { fill: #0c2d6b; stroke: #1f6feb; }
+ .person .t1 { fill: #cae8ff; } .person .t2 { fill: #a5d6ff; }
+ .agent rect { fill: #271052; stroke: #8957e5; }
+ .agent .t1 { fill: #ecdeff; } .agent .t2 { fill: #d2a8ff; }
+ .check rect { fill: #272115; stroke: #9e6a03; }
+ .check .t1 { fill: #f8e3a1; } .check .t2 { fill: #e3b341; }
+ .done rect { fill: #04260f; stroke: #238636; }
+ .done .t1 { fill: #aff5b4; } .done .t2 { fill: #7ee787; }
+}
+</style>
+<defs>
+<marker id="tip" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="9" markerHeight="9" markerUnits="userSpaceOnUse" orient="auto"><path class="tip" d="M0 1 L9 5 L0 9 z"/></marker>
+<marker id="tip-back" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="9" markerHeight="9" markerUnits="userSpaceOnUse" orient="auto"><path class="tip back" d="M0 1 L9 5 L0 9 z"/></marker>
+</defs>
+<rect class="card" x="0.5" y="0.5" width="839" height="391" rx="12"/>
+<text class="head" x="24" y="34">An item's life</text>
+<text class="aside" x="140" y="34">starts open; ends verified or withdrawn</text>
+<g class="plain"><rect x="25" y="150" width="160" height="58" rx="8"/><text class="t1" x="105" y="175" text-anchor="middle">open</text><text class="t2" x="105" y="193" text-anchor="middle">↻ escalate · refreeze</text></g>
+<g class="plain"><rect x="235" y="150" width="160" height="58" rx="8"/><text class="t1" x="315" y="175" text-anchor="middle">claimed</text><text class="t2" x="315" y="193" text-anchor="middle">↻ claim</text></g>
+<g class="plain"><rect x="445" y="150" width="160" height="58" rx="8"/><text class="t1" x="525" y="175" text-anchor="middle">submitted</text><text class="t2" x="525" y="193" text-anchor="middle">↻ reserve</text></g>
+<g class="done" data-final="verified"><rect x="655" y="150" width="160" height="58" rx="8"/><rect x="659" y="154" width="152" height="50" rx="5" fill="none"/><text class="t1" x="735" y="184" text-anchor="middle">verified</text></g>
+<g class="plain" data-final="withdrawn"><rect x="445" y="284" width="160" height="58" rx="8"/><rect x="449" y="288" width="152" height="50" rx="5" fill="none"/><text class="t1" x="525" y="318" text-anchor="middle">withdrawn</text></g>
+<path class="edge" d="M 185 179 L 231 179" marker-end="url(#tip)"/>
+<text class="label" x="208" y="171" text-anchor="middle">claim</text>
+<path class="edge back" d="M 335 150 L 335 120 L 145 120 L 145 146" marker-end="url(#tip-back)"/>
+<text class="label back" x="240" y="94" text-anchor="middle">release · lapse (clock)</text>
+<text class="label back" x="240" y="109" text-anchor="middle">escalate · refreeze</text>
+<path class="edge" d="M 395 179 L 441 179" marker-end="url(#tip)"/>
+<text class="label" x="418" y="171" text-anchor="middle">submit</text>
+<path class="edge" d="M 605 179 L 651 179" marker-end="url(#tip)"/>
+<text class="label" x="628" y="171" text-anchor="middle">accept</text>
+<path class="edge back" d="M 545 150 L 545 66 L 115 66 L 115 146" marker-end="url(#tip-back)"/>
+<text class="label back" x="330" y="58" text-anchor="middle">reject · refreeze</text>
+<path class="edge" d="M 105 208 L 105 313 L 441 313" marker-end="url(#tip)"/>
+<text class="label" x="210" y="305" text-anchor="middle">withdraw</text>
+<path class="edge" d="M 315 208 L 315 313"/>
+<path class="edge" d="M 525 208 L 525 280" marker-end="url(#tip)"/>
+<g class="plain"><rect x="640" y="26" width="176" height="94" rx="8"/></g>
+<text class="label" x="652" y="46">every way into verified</text>
+<text class="code mono" x="652" y="64">NOT_AT_COMMIT</text>
+<text class="code mono" x="652" y="80">SELF_VERIFY</text>
+<text class="code mono" x="652" y="96">CRITERIA_CHANGED</text>
+<text class="code mono" x="652" y="112">PROOF_REQUIRED</text>
+<path class="edge leader" d="M 735 122 L 735 146"/>
+<g class="plain"><rect x="640" y="284" width="176" height="62" rx="8"/></g>
+<text class="label" x="652" y="304">every way into withdrawn</text>
+<text class="code mono" x="652" y="322">COORDINATOR_ONLY</text>
+<text class="code mono" x="652" y="338">NOTE_REQUIRED</text>
+<path class="edge leader" d="M 640 313 L 609 313"/>
+<text class="aside" x="24" y="374">↻ a move that keeps the state · dashed: back to open · double border: final · codes: the refusal each guard raises</text>
+</svg>
diff --git a/docs/img/loop.svg b/docs/img/loop.svg
new file mode 100644
index 00000000..23b69dd8
--- /dev/null
+++ b/docs/img/loop.svg
@@ -0,0 +1,68 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 840 290" width="840" height="290" role="img" aria-labelledby="title desc">
+<title id="title">How work moves</title><desc id="desc">You approve spec rows. Each item freezes its bar when an agent claims it. Builders, one per lane, build in their own worktrees; the gate must be green at the commit they submit. A second agent verifies that commit: an accept merges with its receipt, a reject sends the work back to the builder with the reason.</desc>
+<style>
+text { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif; fill: #1f2328; }
+.mono { font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace; }
+.card { fill: #ffffff; stroke: #d1d9e0; }
+.head { font-size: 14px; font-weight: 600; }
+.aside { font-size: 12px; fill: #59636e; }
+.t1 { font-size: 14px; font-weight: 600; }
+.t2 { font-size: 12px; fill: #59636e; }
+.label { font-size: 12px; fill: #59636e; }
+.code { font-size: 11.5px; fill: #59636e; }
+.edge { fill: none; stroke: #8c959f; stroke-width: 1.5; }
+.edge.back { stroke: #bc4c00; stroke-dasharray: 5 4; }
+.edge.leader { stroke-width: 1; stroke-dasharray: 2 3; }
+.tip { fill: #8c959f; }
+.tip.back { fill: #bc4c00; }
+.label.back { fill: #bc4c00; }
+.frame { fill: none; stroke: #d1d9e0; stroke-dasharray: 4 4; }
+.plain rect { fill: #f6f8fa; stroke: #d1d9e0; }
+.person rect { fill: #ddf4ff; stroke: #54aeff; }
+.person .t1 { fill: #0a3069; } .person .t2 { fill: #0550ae; }
+.agent rect { fill: #fbefff; stroke: #c297ff; }
+.agent .t1 { fill: #3e1f79; } .agent .t2 { fill: #6639ba; }
+.check rect { fill: #fff8c5; stroke: #d4a72c; }
+.check .t1 { fill: #4d2d00; } .check .t2 { fill: #7d4e00; }
+.done rect { fill: #dafbe1; stroke: #4ac26b; }
+.done .t1 { fill: #044f1e; } .done .t2 { fill: #116329; }
+@media (prefers-color-scheme: dark) {
+ text { fill: #f0f6fc; }
+ .card { fill: #0d1117; stroke: #3d444d; }
+ .aside, .t2, .label, .code { fill: #9198a1; }
+ .edge { stroke: #6e7681; }
+ .edge.back { stroke: #f0883e; }
+ .tip { fill: #6e7681; }
+ .tip.back, .label.back { fill: #f0883e; }
+ .frame { stroke: #3d444d; }
+ .plain rect { fill: #151b23; stroke: #3d444d; }
+ .person rect { fill: #0c2d6b; stroke: #1f6feb; }
+ .person .t1 { fill: #cae8ff; } .person .t2 { fill: #a5d6ff; }
+ .agent rect { fill: #271052; stroke: #8957e5; }
+ .agent .t1 { fill: #ecdeff; } .agent .t2 { fill: #d2a8ff; }
+ .check rect { fill: #272115; stroke: #9e6a03; }
+ .check .t1 { fill: #f8e3a1; } .check .t2 { fill: #e3b341; }
+ .done rect { fill: #04260f; stroke: #238636; }
+ .done .t1 { fill: #aff5b4; } .done .t2 { fill: #7ee787; }
+}
+</style>
+<defs>
+<marker id="tip" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="9" markerHeight="9" markerUnits="userSpaceOnUse" orient="auto"><path class="tip" d="M0 1 L9 5 L0 9 z"/></marker>
+<marker id="tip-back" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="9" markerHeight="9" markerUnits="userSpaceOnUse" orient="auto"><path class="tip back" d="M0 1 L9 5 L0 9 z"/></marker>
+</defs>
+<rect class="card" x="0.5" y="0.5" width="839" height="289" rx="12"/>
+<text class="head" x="24" y="34">How work moves</text>
+<g class="person"><rect x="40" y="62" width="200" height="64" rx="8"/><text class="t1" x="140" y="90" text-anchor="middle">You decide</text><text class="t2" x="140" y="108" text-anchor="middle">the rows of SPEC.md</text></g>
+<g class="plain"><rect x="320" y="62" width="200" height="64" rx="8"/><text class="t1" x="420" y="90" text-anchor="middle">An item</text><text class="t2" x="420" y="108" text-anchor="middle">its bar frozen at claim</text></g>
+<g class="agent"><rect x="610" y="52" width="200" height="64" rx="8"/><rect x="605" y="57" width="200" height="64" rx="8"/><rect x="600" y="62" width="200" height="64" rx="8"/><text class="t1" x="700" y="90" text-anchor="middle">Builders</text><text class="t2" x="700" y="108" text-anchor="middle">one per lane, own worktree</text></g>
+<g class="check"><rect x="600" y="200" width="200" height="64" rx="8"/><text class="t1" x="700" y="228" text-anchor="middle">The gate</text><text class="t2" x="700" y="246" text-anchor="middle">tests green at the commit</text></g>
+<g class="agent"><rect x="320" y="200" width="200" height="64" rx="8"/><text class="t1" x="420" y="228" text-anchor="middle">A verifier</text><text class="t2" x="420" y="246" text-anchor="middle">a second agent checks it</text></g>
+<g class="done"><rect x="40" y="200" width="200" height="64" rx="8"/><text class="t1" x="140" y="228" text-anchor="middle">Merged</text><text class="t2" x="140" y="246" text-anchor="middle">with its receipt</text></g>
+<path class="edge" d="M 240 94 L 316 94" marker-end="url(#tip)"/>
+<path class="edge" d="M 520 94 L 596 94" marker-end="url(#tip)"/>
+<path class="edge" d="M 700 126 L 700 196" marker-end="url(#tip)"/>
+<path class="edge" d="M 600 232 L 524 232" marker-end="url(#tip)"/>
+<path class="edge" d="M 320 232 L 244 232" marker-end="url(#tip)"/>
+<path class="edge back" d="M 440 200 L 440 166 L 650 166 L 650 140" marker-end="url(#tip-back)"/>
+<text class="label back" x="452" y="158">a reject sends it back</text>
+</svg>
diff --git a/docs/proof/harness.mjs b/docs/proof/harness.mjs
index 3839d3d0..1a7ea303 100644
--- a/docs/proof/harness.mjs
+++ b/docs/proof/harness.mjs
@@ -10,7 +10,7 @@ import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
const ROOT = resolve(import.meta.dirname, '..', '..');
-const COPIED = ['src', 'bin', 'test', 'skills', 'package.json', 'PRACTICE.md'];
+const COPIED = ['src', 'bin', 'test', 'skills', 'docs', 'package.json', 'PRACTICE.md', 'README.md'];
/**
* Run an audit and print one line per change. Sets the exit code to 1 if any change comes out other
diff --git a/docs/proof/readme-mutants.mjs b/docs/proof/readme-mutants.mjs
new file mode 100644
index 00000000..64bb9c22
--- /dev/null
+++ b/docs/proof/readme-mutants.mjs
@@ -0,0 +1,33 @@
+/**
+ * The proof that the README's figures hold (item #72: I10, M1). Each change below breaks one of
+ * their rules, and its test must go red. The harness works on a temporary copy, never a real
+ * checkout.
+ *
+ * Run it from the repo root: node docs/proof/readme-mutants.mjs
+ */
+import { audit } from './harness.mjs';
+
+const LINKED = ['test/readme.test.js', 'the README links every figure draw.mjs draws'];
+const CARD = ['test/readme.test.js', 'each figure carries its own light and dark colors'];
+const DECLARED = ['test/readme.test.js', 'the lifecycle figure is drawn from the declaration'];
+const LAYOUT_ALT =
+ '![Where things live. The main checkout is the coordinator and holds SPEC.md, PRACTICE.md, pullboard.json, AGENTS.md and the git hooks. Inside .git, shared by every worktree, are the board and the pinned submitted commits. Beside it, each agent works in its own worktree, builders in their lanes and a verifier, all on the same board. pullboard view lists every project on this machine.](';
+
+/** Row, the change, its edits as [file, from, to], the test that judges it, and the outcome expected. */
+const MUTANTS = [
+ ['I10', 'a committed figure drifts from what draw.mjs draws', [['docs/img/loop.svg', '>a reject sends it back<', '>a reject sends it home<']], LINKED, 'red'],
+ ['I10', 'the README links a figure draw.mjs does not draw', [['README.md', '](docs/img/layout.svg)', '](docs/img/layout.png)']], LINKED, 'red'],
+ ['I10', 'a figure says nothing to a reader who cannot see it', [['README.md', LAYOUT_ALT, '![figure](']], LINKED, 'red'],
+ ['I10', 'the figures have no dark colors', [['docs/img/draw.mjs', '@media (prefers-color-scheme: dark) {', '@media print {']], CARD, 'red'],
+ ['I10', 'the card does not cover the figure', [['docs/img/draw.mjs', '<rect class="card" x="0.5" y="0.5"', '<rect class="card" x="40" y="0.5"']], CARD, 'red'],
+ ['I10', 'a label runs off the card', [['docs/img/draw.mjs', "text(452, 158, 'a reject sends it back', 'label back')", "text(752, 158, 'a reject sends it back', 'label back')"]], CARD, 'red'],
+ ['M1', 'a state is left out of the lifecycle', [['docs/img/draw.mjs', ' for (const state of machine.states) {\n const [x, y] = PLACES[state.id];', " for (const state of machine.states.filter((each) => each.id !== 'withdrawn')) {\n const [x, y] = PLACES[state.id];"]], DECLARED, 'red'],
+ ['M1', 'a move between two states is not named', [['docs/img/draw.mjs', ' if (!route.label) continue;', " if (!route.label || key === 'submitted>open') continue;"]], DECLARED, 'red'],
+ ['M1', 'a move that keeps a state is not named', [['docs/img/draw.mjs', "sub: keeps ? `↻ ${keeps.join(' · ')}` : undefined", 'sub: undefined']], DECLARED, 'red'],
+ ['M1', 'the final states are not marked', [['docs/img/draw.mjs', 'final: state.final ? state.id : undefined', 'final: undefined']], DECLARED, 'red'],
+ ['M1', 'the refusals into a final state are left out', [['docs/img/draw.mjs', " codes.forEach((code, i) => body.push(text(note.x + 12, note.y + 38 + i * 16, code, 'code mono')));\n", '']], DECLARED, 'red'],
+ ['M1', 'a state with no place is left out, not refused', [['docs/img/draw.mjs', ' if (!PLACES[state.id]) throw new Error(', ' if (false) throw new Error(']], DECLARED, 'red'],
+ ['M1', 'a pair of states with no route is left out, not refused', [['docs/img/draw.mjs', ' if (from !== move.to && !ROUTES[key]) throw new Error(', ' if (false) throw new Error(']], DECLARED, 'red'],
+];
+
+audit(MUTANTS);
diff --git a/test/readme.test.js b/test/readme.test.js
new file mode 100644
index 00000000..745d076b
--- /dev/null
+++ b/test/readme.test.js
@@ -0,0 +1,99 @@
+/**
+ * The README's figures (I10): the README links each one, each is committed exactly as
+ * docs/img/draw.mjs draws it, each carries its own light and dark colors on a card that holds its
+ * text, and the lifecycle is drawn from the declaration itself (M1), refusing what it cannot place.
+ */
+import assert from 'node:assert/strict';
+import { readdirSync, readFileSync } from 'node:fs';
+import { join, resolve } from 'node:path';
+import { test } from 'node:test';
+import { FIGURES, drawLifecycle } from '../docs/img/draw.mjs';
+import { MACHINE } from '../src/machine.js';
+
+const ROOT = resolve(import.meta.dirname, '..');
+const README = readFileSync(join(ROOT, 'README.md'), 'utf8');
+const drawn = Object.keys(FIGURES).map((name) => `docs/img/${name}.svg`).sort();
+
+/** Average glyph width, in ems, generous enough for the widest system font each figure may get. */
+const EM = { sans: 0.56, mono: 0.62 };
+const SIZE = { head: 14, t1: 14, t2: 12, label: 12, aside: 12, code: 11.5 };
+
+/**
+ * Every text in a figure with the box it may take up, from its anchor, font size and length.
+ *
+ * @param {string} svg
+ */
+function texts(svg) {
+ return [...svg.matchAll(/<text class="([^"]+)" x="([\d.]+)" y="([\d.]+)"(?: text-anchor="(\w+)")?>([^<]*)<\/text>/g)].map(([, cls, x, y, anchor, words]) => {
+ const classes = cls.split(' ');
+ const size = Math.max(...classes.map((name) => SIZE[name] ?? 0));
+ const plain = words.replaceAll(/&(amp|lt|gt|quot);/g, '.');
+ const width = plain.length * size * (classes.includes('mono') ? EM.mono : EM.sans);
+ const left = Number(x) - (anchor === 'middle' ? width / 2 : anchor === 'end' ? width : 0);
+ return { words: plain, left, right: left + width, top: Number(y) - size, bottom: Number(y) + 4 };
+ });
+}
+
+/**
+ * The tags left open, or closed out of order, in an XML text: empty when it is well formed.
+ *
+ * @param {string} xml
+ * @returns {string[]}
+ */
+function unbalanced(xml) {
+ const open = [];
+ const wrong = [];
+ for (const [, closing, name, selfClosing] of xml.matchAll(/<(\/?)([a-zA-Z][\w:-]*)\b[^>]*?(\/?)>/g)) {
+ if (selfClosing) continue;
+ if (!closing) open.push(name);
+ else if (open.pop() !== name) wrong.push(`</${name}>`);
+ }
+ return [...wrong, ...open.map((name) => `<${name}>`)];
+}
+
+test('the README links every figure draw.mjs draws, each committed exactly as drawn [I10]', () => {
+ const links = [...README.matchAll(/!\[([^\]]*)\]\((docs\/img\/[^)\s]+)\)/g)].map(([, alt, path]) => ({ alt, path }));
+ assert.deepEqual(links.map((link) => link.path).sort(), drawn, 'the README links each drawn figure once, and nothing else under docs/img');
+ for (const { alt, path } of links) assert.ok(alt.trim().length >= 40, `${path} has alt text that says what it shows`);
+ const committed = readdirSync(join(ROOT, 'docs', 'img')).filter((file) => file.endsWith('.svg')).map((file) => `docs/img/${file}`).sort();
+ assert.deepEqual(committed, drawn, 'docs/img holds exactly the figures draw.mjs draws');
+ for (const [name, draw] of Object.entries(FIGURES)) {
+ assert.ok(readFileSync(join(ROOT, 'docs', 'img', `${name}.svg`), 'utf8') === draw(), `docs/img/${name}.svg differs from what draw.mjs draws: run node docs/img/draw.mjs`);
+ }
+});
+
+test('each figure carries its own light and dark colors, on a card that holds all its text [I10]', () => {
+ for (const [name, draw] of Object.entries(FIGURES)) {
+ const svg = draw();
+ const [, width, height] = /^<svg xmlns="http:\/\/www\.w3\.org\/2000\/svg" viewBox="0 0 (\d+) (\d+)"[^>]* role="img"/.exec(svg) ?? [];
+ assert.ok(width, `${name} is an svg with a viewBox and role="img"`);
+ assert.match(svg, /<title id="title">[^<]{3,}<\/title><desc id="desc">[^<]{40,}<\/desc>/, `${name} says what it shows`);
+ assert.match(svg, /<style>[^<]*\ntext \{[^}]*fill: #1f2328;[^<]*@media \(prefers-color-scheme: dark\) \{\n {2}text \{ fill: #f0f6fc; \}/, `${name} has light colors and a dark block`);
+ assert.ok(svg.includes(`</defs>\n<rect class="card" x="0.5" y="0.5" width="${width - 1}" height="${height - 1}" rx="12"/>`), `${name} draws its card first, over the whole figure`);
+ assert.deepEqual(unbalanced(svg), [], `${name} is well formed`);
+ const words = texts(svg);
+ assert.ok(words.length >= 8, `${name} has its words as text`);
+ for (const text of words) {
+ assert.ok(text.left >= 8 && text.right <= width - 8 && text.top >= 8 && text.bottom <= height - 8, `${name}: "${text.words}" stays on the card`);
+ }
+ }
+});
+
+test('the lifecycle figure is drawn from the declaration, and refuses a state or a pair it has no place for [I10, M1]', () => {
+ const svg = drawLifecycle();
+ const shown = texts(svg).map((text) => text.words).join(' \n ');
+ for (const state of MACHINE.states) {
+ assert.ok(svg.includes(`>${state.id}</text>`), `the state ${state.id} is drawn`);
+ assert.equal(svg.includes(`data-final="${state.id}"`), Boolean(state.final), `${state.id} is marked final only if it is`);
+ }
+ for (const move of MACHINE.moves) assert.match(shown, new RegExp(`\\b${move.verb}\\b`), `the move ${move.verb} is named`);
+ for (const [state, guards] of Object.entries(MACHINE.exitGuards)) {
+ for (const guard of guards) assert.ok(shown.includes(MACHINE.guards.find((each) => each.id === guard).refuse), `a refusal into ${state}: ${guard}`);
+ }
+ const parked = { ...MACHINE, states: [...MACHINE.states, { id: 'parked', means: 'set aside', requires: [] }] };
+ assert.throws(() => drawLifecycle(parked), /no place for state parked/);
+ const reopen = { ...MACHINE, moves: [...MACHINE.moves, { verb: 'reopen', from: ['verified'], to: 'open', by: ['coordinator'], guards: [] }] };
+ assert.throws(() => drawLifecycle(reopen), /no route for verified > open/);
+ const bench = { ...MACHINE, moves: [...MACHINE.moves, { verb: 'bench', from: ['claimed'], to: 'open', by: ['coordinator'], guards: [] }] };
+ assert.match(texts(drawLifecycle(bench)).map((text) => text.words).join(' '), /\bbench\b/, 'a new move between drawn states is named without touching draw.mjs');
+});