<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>hird — the software factory</title>
<meta name="description" content="A step-by-step walkthrough of hird-server's software factory: builders, reviewers, CI and a human working one release from ready to merged, with every refusal the factory exists to make.">
<link rel="stylesheet" href="style.css">
<style>
:root {
--st-ready: #ffffff; --st-claimed: #fff3b0; --st-built: #dbe9ff;
--st-review: #e8dcff; --st-approved: #d4f0e0; --st-merged: #b6e3c0;
--st-escalated: #f5b7b1; --card-ink: #1c1c1a;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--st-ready: #2a2a26; --st-claimed: #5a4a10; --st-built: #1f3450;
--st-review: #3a2d55; --st-approved: #1f4535; --st-merged: #1f4d2a;
--st-escalated: #5c2222; --card-ink: #ecebe6;
}
}
:root[data-theme="dark"] {
--st-ready: #2a2a26; --st-claimed: #5a4a10; --st-built: #1f3450;
--st-review: #3a2d55; --st-approved: #1f4535; --st-merged: #1f4d2a;
--st-escalated: #5c2222; --card-ink: #ecebe6;
}
.player {
background: var(--bg-raised);
border: 1px solid var(--rule);
border-radius: 10px;
margin: 1.5rem 0;
overflow: hidden;
}
.player .controls {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.5rem 0.75rem;
padding: 0.75rem 1rem;
background: var(--bg-sunken);
border-bottom: 1px solid var(--rule);
font-size: 0.875rem;
}
.player button, .player select {
font: inherit;
font-size: 0.875rem;
color: var(--ink);
background: var(--bg-raised);
border: 1px solid var(--rule);
border-radius: 6px;
padding: 0.25rem 0.6rem;
cursor: pointer;
}
.player button:hover:not(:disabled) { border-color: var(--accent); }
.player button:disabled { opacity: 0.5; cursor: default; }
.player button.go {
background: var(--accent); border-color: var(--accent);
color: var(--bg-raised); font-weight: 500; min-width: 5rem;
}
.player .controls label { color: var(--ink-faint); display: inline-flex; gap: 0.35rem; align-items: center; }
.player .spacer { flex: 1 1 auto; }
.player .clock { font-family: var(--mono); font-size: 0.75rem; color: var(--ink-faint); }
.act {
padding: 0.9rem 1rem 0.2rem;
font-weight: 600;
font-size: 0.9375rem;
}
.act small { display: block; font-weight: 400; color: var(--ink-faint); font-family: var(--mono); font-size: 0.75rem; }
.crew {
display: grid;
grid-template-columns: repeat(6, minmax(0, 1fr));
gap: 0.5rem;
padding: 0.75rem 1rem;
}
.member {
border: 1px solid var(--rule);
border-radius: 8px;
padding: 0.4rem 0.5rem;
font-size: 0.75rem;
line-height: 1.35;
transition: border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
opacity: 0.7;
}
.member b { display: block; font-size: 0.875rem; }
.member .h { color: var(--ink-faint); font-family: var(--mono); }
.member .role {
display: inline-block; margin-top: 0.2rem;
font-family: var(--mono); font-size: 0.6875rem;
border-radius: 999px; padding: 0 0.4rem;
background: var(--bg-sunken); color: var(--ink-soft);
}
.member.on { opacity: 1; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.member.on.no { border-color: var(--red); }
.lanes {
display: grid;
grid-template-columns: repeat(7, minmax(5.25rem, 1fr));
gap: 0.4rem;
padding: 0.25rem 1rem 0.75rem;
overflow-x: auto;
}
.lane {
background: var(--bg-sunken);
border-radius: 8px;
min-height: 11rem;
padding: 0.35rem;
}
.lane h4 {
margin: 0 0 0.35rem;
font-size: 0.6875rem;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--ink-faint);
font-weight: 600;
text-align: center;
}
.lane.escalated h4 { color: var(--red); }
.tcard {
position: relative;
border-radius: 6px;
border: 1px solid var(--rule);
padding: 0.35rem 0.45rem;
margin-bottom: 0.35rem;
font-size: 0.75rem;
line-height: 1.3;
color: var(--card-ink);
background: var(--st-ready);
}
.tcard .n { font-family: var(--mono); font-weight: 600; }
.tcard .meta { display: block; margin-top: 0.2rem; font-family: var(--mono); font-size: 0.6875rem; opacity: 0.8; }
.tcard.moved { box-shadow: 0 0 0 2px var(--accent); }
.tcard[data-stage="claimed"] { background: var(--st-claimed); }
.tcard[data-stage="built"] { background: var(--st-built); }
.tcard[data-stage="in_review"] { background: var(--st-review); }
.tcard[data-stage="approved"] { background: var(--st-approved); }
.tcard[data-stage="merged"] { background: var(--st-merged); }
.tcard[data-stage="escalated"] { background: var(--st-escalated); }
.wire {
margin: 0;
padding: 0.75rem 1rem 1rem;
border-top: 1px solid var(--rule);
font-family: var(--mono);
font-size: 0.75rem;
line-height: 1.5;
min-height: 7.5rem;
}
.wire .call { color: var(--ink); }
.wire .call .who { color: var(--accent); font-weight: 600; }
.wire .ok { color: var(--green); padding-left: 2.2rem; }
.wire .no { color: var(--red); padding-left: 2.2rem; }
.wire .why {
font-family: var(--sans); font-size: 0.8125rem; color: var(--ink-soft);
margin-top: 0.5rem; border-left: 2px solid var(--rule); padding-left: 0.6rem;
}
@media (max-width: 48rem) {
.crew { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.pipeline {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.35rem;
margin: 1.25rem 0;
font-family: var(--mono);
font-size: 0.8125rem;
}
.pipeline span.s {
border: 1px solid var(--rule);
border-radius: 999px;
padding: 0.1rem 0.6rem;
color: var(--card-ink);
}
.pipeline .arrow { color: var(--ink-faint); }
ol.beats { margin: 1rem 0; padding: 0; list-style: none; counter-reset: beat; }
ol.beats li {
counter-increment: beat;
display: grid;
grid-template-columns: 2rem minmax(0, 1fr);
gap: 0.5rem;
padding: 0.45rem 0.4rem;
border-top: 1px solid var(--rule);
margin: 0;
}
ol.beats li::before {
content: counter(beat);
font-family: var(--mono); font-size: 0.75rem; color: var(--ink-faint); padding-top: 0.15rem;
}
ol.beats li.here { background: var(--accent-soft); }
ol.beats button {
font: inherit; text-align: left; background: none; border: 0; padding: 0;
color: var(--ink); cursor: pointer; font-size: 0.875rem;
}
ol.beats button:hover { color: var(--accent); }
ol.beats .refused { color: var(--red); font-family: var(--mono); font-size: 0.75rem; margin-left: 0.35rem; }
@media (prefers-reduced-motion: reduce) {
.tcard { transition: none !important; }
}
</style>
</head>
<body>
<button id="theme" type="button" aria-label="Toggle colour theme">theme</button>
<div class="shell">
<nav class="toc" aria-label="Contents">
<a class="brand" href="#top">hird</a>
<p class="tagline">Builders build, reviewers who built none of it review it, CI gates it, a human decides.</p>
<details class="nav-body" open>
<summary>Contents</summary>
<ol>
<li><a href="#start">Get started in five minutes</a></li>
<li><a href="#idea">What the factory adds</a></li>
<li><a href="#watch">One release, step by step</a></li>
<li><a href="#beats">The run, in words</a></li>
<li><a href="#roles">Roles</a></li>
<li><a href="#stages">Stages</a></li>
<li><a href="#refusals">The refusals it exists to make</a></li>
<li><a href="#run">Run it yourself</a></li>
</ol>
<div class="away">
<a href="index.html">The usage guide →</a>
<a href="server.html">How the central queue works →</a>
<a href="swarm.html">How a swarm collaborates →</a>
<a href="https://github.com/aoprisan/hird">Source on GitHub →</a>
</div>
</details>
</nav>
<main id="top">
<header class="hero">
<div class="badges">
<span class="badge">four roles</span>
<span class="badge">four more tools</span>
<span class="badge">stages derived, never stored</span>
<span class="badge">done is not merged</span>
</div>
<h1>The software factory</h1>
<p class="lede">
Give the workers in a <strong>hird-server</strong> roster <em>roles</em>
and the central queue becomes the backbone of a software factory.
Builders build. Reviewers who held none of the work review it. CI gates
it. A human decides what nobody else may. Work is finished when it is
<strong>merged</strong>, not when its author says so.
</p>
<div class="cta">
<a class="primary" href="#start">Get started</a>
<a href="#watch">Step through a release</a>
<a href="#run">Run the example</a>
<a href="https://github.com/aoprisan/hird/blob/main/examples/factory.sh">examples/factory.sh</a>
</div>
</header>
<section id="start">
<h2>Get started in five minutes</h2>
<p>
You need two agent harnesses, so that each can review what the other
built, and a Rust toolchain. One command sets up everything else and walks
you through it.
</p>
<pre><code><span class="k">cargo install</span> hird-server --locked
<span class="k">hird-server quickstart</span> <span class="c"># claude-code and codex by default</span>
<span class="k">hird-server quickstart</span> --harness gemini --harness opencode</code></pre>
<p>It writes a <code>hird-factory/</code> directory:</p>
<div class="table-wrap">
<table>
<thead><tr><th>File</th><th>What it is</th></tr></thead>
<tbody>
<tr><td><code>roster.toml</code></td><td>A factory roster with fresh tokens: you as <code>human</code>, one builder-and-reviewer token per agent harness, and <code>ci</code>.</td></tr>
<tr><td><code>connect/<harness>.md</code></td><td>The command or config that connects that harness, with its token filled in.</td></tr>
<tr><td><code>ci</code>, <code>human</code></td><td>Scripts for the moves no agent makes: <code>ci pass 1</code>, <code>ci merge 1</code>, <code>human answer 3 "…"</code>, <code>human board</code>.</td></tr>
<tr><td><code>playground/</code></td><td>A git repository with a sample release already filed: <em>Write fizzbuzz</em>, then <em>Test</em> and <em>Document</em> it, which wait on the first until it is merged.</td></tr>
<tr><td><code>GUIDE.md</code></td><td>The steps, which it also prints before it starts serving.</td></tr>
</tbody>
</table>
</div>
<p>Then it serves, and the guide takes you through one lap of the factory:</p>
<ol class="numbered">
<li><strong>Watch the floor.</strong> Open the <code>/watch</code> link it prints.</li>
<li><strong>Connect your agents.</strong> One snippet each, from <code>connect/</code>.</li>
<li><strong>Put them to work.</strong> Start each in the playground and say <em>work the hird queue</em>. One builds; the other is the only one allowed to review it.</li>
<li><strong>Be CI.</strong> Run the tests, then <code>./ci pass 1</code> or <code>./ci fail 1 "what broke"</code>.</li>
<li><strong>Merge.</strong> <code>./ci merge 1</code> records the playground’s HEAD, and frees the two tasks waiting on it.</li>
<li><strong>Decide.</strong> <code>./human</code> approves, rejects, answers escalations, reopens and cancels.</li>
</ol>
<p>
Run it again to come back: the same tokens and the same board. When you are
ready for real work, <code>hird-server quickstart --dir factory --project /path/to/repo</code>
sets the same thing up for your repository, with nothing filed for you.
</p>
</section>
<section id="idea">
<h2>What the factory adds</h2>
<p>
Core hird is a queue: tasks claimed under leases, dependencies enforced,
reviews filed on completion, verdicts that act. What it never had is a
notion of <em>who may do what</em>, or of work being <em>in</em> rather
than merely done. The factory adds both, on the server only, and the
local queue is unchanged.
</p>
<div class="pipeline" aria-label="The factory pipeline">
<span class="s" style="background:var(--st-ready)">ready</span><span class="arrow">→</span>
<span class="s" style="background:var(--st-claimed)">claimed</span><span class="arrow">→</span>
<span class="s" style="background:var(--st-built)">built</span><span class="arrow">→</span>
<span class="s" style="background:var(--st-review)">in_review</span><span class="arrow">→</span>
<span class="s" style="background:var(--st-approved)">approved</span><span class="arrow">→</span>
<span class="s" style="background:var(--st-merged)">merged</span>
<span class="arrow"> · rejections loop back to ready; the third asks a human:</span>
<span class="s" style="background:var(--st-escalated)">escalated</span>
</div>
<div class="cols">
<div class="card">
<h4>Roles come from the roster</h4>
<p>Each token's <code>roles</code> say what it may do. No client, header or tool argument can grant one, and every claim and finish is checked against them in the same transaction.</p>
</div>
<div class="card">
<h4>Four more tools</h4>
<p><code>factory_gate</code> for CI, <code>factory_merge</code> for CI or a human, <code>factory_decide</code> for the human, and <code>factory_board</code> for anyone — beside the twelve every worker has.</p>
</div>
<div class="card">
<h4>Nothing is assigned</h4>
<p>Roles say who <em>may</em> take work, never who <em>will</em>. Agents still pull with <code>task_next</code>; escalation asks a human rather than retrying.</p>
</div>
</div>
</section>
<section id="watch">
<h2>One release, step by step</h2>
<p>
This is <a href="https://github.com/aoprisan/hird/blob/main/examples/factory.sh"><code>examples/factory.sh</code></a>,
played back. Six workers hold six tokens. The human files three tasks;
<strong>#2</strong> waits on <strong>#1</strong>, and <strong>#3</strong> is a flaky
test that will not go quietly. Every step is one or more real tool calls,
and every refusal shown is the server’s own words.
</p>
<div class="player" id="player">
<div class="controls">
<button class="go" id="play" type="button">Play</button>
<button id="prev" type="button">◀ back</button>
<button id="next" type="button">forward ▶</button>
<button id="restart" type="button">restart</button>
<label>speed
<select id="speed">
<option value="0.5">slow</option>
<option value="1" selected>normal</option>
<option value="2">fast</option>
</select>
</label>
<span class="spacer"></span>
<span class="clock" id="clock"></span>
</div>
<div class="act" id="act" aria-live="polite"></div>
<div class="crew" id="crew"></div>
<div class="lanes" id="lanes"></div>
<div class="wire" id="wire"></div>
</div>
</section>
<section id="beats">
<h2>The run, in words</h2>
<p class="quiet">Click a step to jump the player to it.</p>
<ol class="beats" id="beat-list"></ol>
</section>
<section id="roles">
<h2>Roles</h2>
<div class="table-wrap">
<table>
<thead><tr><th>Role</th><th>May</th><th>May not</th></tr></thead>
<tbody>
<tr><td><code>builder</code></td><td>Claim and finish work tasks. Every finish files a review.</td><td>Take a review; record a merge.</td></tr>
<tr><td><code>reviewer</code></td><td>Claim a review and return <code>upheld</code> or <code>sent_back</code>.</td><td>Review work it, or (under the policy) its harness, ever held.</td></tr>
<tr><td><code>ci</code></td><td><code>factory_gate</code> a test run; <code>factory_merge</code> approved work.</td><td>Claim anything.</td></tr>
<tr><td><code>human</code></td><td><code>factory_decide</code>: approve, reject, answer an escalation, reopen, cancel; and merge.</td><td>—</td></tr>
</tbody>
</table>
</div>
<pre><code><span class="c"># factory-roster.toml — the policy, and one entry per token</span>
[factory]
reviewer_harness_differs = true <span class="c"># no harness that held the work reviews it</span>
max_attempts = 3 <span class="c"># the third rejection asks a human</span>
require_ci_to_merge = true <span class="c"># merge only what CI last passed</span>
[[worker]]
token = "…"
identity = "ana"
harness = "claude-code" <span class="c"># builders and reviewers must pin a harness</span>
model = "model-id" <span class="c"># recorded on everything this worker does</span>
roles = ["builder"]</code></pre>
</section>
<section id="stages">
<h2>Stages</h2>
<p>
A stage is computed from what the queue already records — status,
reviews, verdicts, attempts, CI reports, merges — and never stored,
so it cannot disagree with them.
</p>
<div class="table-wrap">
<table>
<thead><tr><th>Stage</th><th>Means</th><th>Leaves by</th></tr></thead>
<tbody>
<tr><td><code>ready</code></td><td>Open, no unanswered question, dependencies merged.</td><td>A builder claims it.</td></tr>
<tr><td><code>claimed</code></td><td>A builder holds the lease.</td><td><code>task_complete</code>; or the lease lapses back to ready, with no attempt counted.</td></tr>
<tr><td><code>built</code></td><td>Done, and its review is waiting.</td><td>A reviewer claims the review; CI fails it; a human decides.</td></tr>
<tr><td><code>in_review</code></td><td>A reviewer holds the review.</td><td><code>upheld</code> → approved; <code>sent_back</code> → an attempt, back to ready.</td></tr>
<tr><td><code>approved</code></td><td>Upheld since its latest completion.</td><td><code>factory_merge</code> with a SHA or PR URL, once CI’s latest word is a pass.</td></tr>
<tr><td><code>merged</code></td><td>In. Its dependents are released.</td><td>Only a human reopen.</td></tr>
<tr><td><code>escalated</code></td><td>Rejected <code>max_attempts</code> times, or failed: a question for a human.</td><td><code>factory_decide</code> answer or reopen.</td></tr>
</tbody>
</table>
</div>
</section>
<section id="refusals">
<h2>The refusals it exists to make</h2>
<div class="cols">
<div class="card">
<h4>No one reviews their own work</h4>
<p>Not the builder, not another session of the builder’s harness, and not an earlier holder whose lease lapsed. In the run, <strong>cy</strong> runs codex like <strong>ben</strong> did, so <code>task_next</code> hands cy nothing.</p>
</div>
<div class="card">
<h4>Nothing builds on unmerged work</h4>
<p>A dependency clears only once it is merged. Approved work can still fail CI, so <strong>#2</strong> stays held until <strong>#1</strong> is in.</p>
</div>
<div class="card">
<h4>Approved is not merged</h4>
<p>A builder cannot record a merge, and CI cannot merge work whose latest report is a fail. A merge carries its evidence: a commit SHA or a PR URL.</p>
</div>
<div class="card">
<h4>The queue asks, it never retries</h4>
<p>The third rejection turns into a question for a human. Until it is answered nobody can claim the work, and the answer rides in the next claim along with every attempt.</p>
</div>
</div>
</section>
<section id="run">
<h2>Run it yourself</h2>
<p>
Both examples start a throwaway <code>hird-server</code> on a temporary
database with a generated roster, so nothing touches your real queue.
</p>
<pre><code><span class="c"># a factory of your own, with a guide</span>
<span class="k">hird-server quickstart</span>
<span class="c"># the run on this page: scripted, the same every time</span>
<span class="k">./examples/factory.sh</span> <span class="c"># prints every call and the server's answer</span>
<span class="k">./examples/factory.sh</span> --pause <span class="c"># stops between acts; open the /watch URL it prints</span>
<span class="c"># a crew working at random, for watching the live floor</span>
<span class="k">just floor</span>
<span class="c"># The floor: http://127.0.0.1:7474/watch#token=…</span></code></pre>
<p>
For a real deployment, start from
<a href="https://github.com/aoprisan/hird/blob/main/examples/factory-roster.toml"><code>examples/factory-roster.toml</code></a>.
The design, with every allowed and forbidden transition, is
<a href="https://github.com/aoprisan/hird/blob/main/DESIGN.md">DESIGN.md §33</a>.
</p>
</section>
</main>
</div>
<footer class="page">
<span>hird — a work queue for coding agents</span>
<span><a href="index.html">Usage guide</a> · <a href="server.html">The central queue</a> · <a href="swarm.html">The swarm</a></span>
</footer>
<script>
(function () {
var root = document.documentElement;
var saved = null;
try { saved = localStorage.getItem("hird-theme"); } catch (e) {}
if (saved) root.setAttribute("data-theme", saved);
document.getElementById("theme").addEventListener("click", function () {
var dark = root.getAttribute("data-theme") === "dark" ||
(!root.getAttribute("data-theme") &&
window.matchMedia("(prefers-color-scheme: dark)").matches);
var next = dark ? "light" : "dark";
root.setAttribute("data-theme", next);
try { localStorage.setItem("hird-theme", next); } catch (e) {}
});
})();
(function () {
var nav = document.querySelector("nav.toc .nav-body");
var narrow = window.matchMedia("(max-width: 62rem)");
if (!nav) return;
if (narrow.matches) nav.removeAttribute("open");
nav.addEventListener("click", function (event) {
if (narrow.matches && event.target.closest("a")) nav.removeAttribute("open");
});
})();
</script>
<script>
(function () {
"use strict";
var $ = function (id) { return document.getElementById(id); };
var CREW = [
{ id: "ana", harness: "claude-code", role: "builder" },
{ id: "ben", harness: "codex", role: "builder" },
{ id: "cy", harness: "codex", role: "reviewer" },
{ id: "eve", harness: "copilot", role: "reviewer" },
{ id: "ci", harness: "ci", role: "ci" },
{ id: "dee", harness: "human", role: "human" }
];
var STAGES = ["ready", "claimed", "built", "in_review", "approved", "merged", "escalated"];
var LABEL = { in_review: "in review" };
var TITLES = {
1: "Parse the config format",
2: "Wire the config into the server",
3: "Fix the flaky lease-expiry test"
};
var BEATS = [
{ act: "dee files the release",
calls: [["dee", "hird add", "Parse the config format", true, "1"],
["dee", "hird add", "Wire the config into the server --needs 1", true, "2"],
["dee", "hird add", "Fix the flaky lease-expiry test --priority 1", true, "3"]],
why: "Three tasks. #2 waits on #1; in a factory that means until #1 is merged, not merely done.",
set: { 1: { stage: "ready" }, 2: { stage: "ready", waits: [1] }, 3: { stage: "ready" } } },
{ act: "ana claims #1",
calls: [["ana", "task_claim", '{"seq":1}', true, '{"claimed":1,"holder":"ana/claude-code:6bdz"}'],
["ana", "task_update", '{"seq":1,"branch":"feat/parse-config","pr_url":"…/pull/1"}', true, '{"links":{"branch":"feat/parse-config"}}']],
why: "A builder pulls work and records its branch and pull request on the task.",
set: { 1: { stage: "claimed", holder: "ana" } } },
{ act: "ana finishes #1 — the factory files its review",
calls: [["ana", "task_complete", '{"seq":1,"result":"Parser and tests…"}', true, '{"status":"done","review_filed":4}']],
why: "Every completion files a review in a factory, even though the server never sees the working tree.",
set: { 1: { stage: "built", holder: null, review: 4 } } },
{ act: "a builder may not review, nor start on unmerged work",
calls: [["ana", "task_claim", '{"seq":4}', false, "task 4 is recused from task 1 (no agent reviews its own work) — ana/claude-code cannot take it"],
["ana", "task_claim", '{"seq":2}', false, "task 2 depends on work that is not merged yet: 1; in this factory a dependency clears only once it is merged"]],
why: "Two refusals, both inside the claim's own transaction, both leaving no trace.",
set: {} },
{ act: "CI fails #1",
calls: [["ci", "factory_gate", '{"seq":1,"outcome":"fail","output":"test_parse_empty … FAILED"}', true, '{"from":"built","to":"ready","attempts":1}']],
why: "A failure is an attempt: who held it, what model it ran, and the output, kept for the next builder. The pending review is cancelled.",
set: { 1: { stage: "ready", attempts: 1, review: null, ci: "fail" } } },
{ act: "ben picks #1 up, and is handed what went wrong",
calls: [["ben", "task_claim", '{"seq":1}', true, '{"claimed":1,"attempts":[{"n":1,"by":"CI","output":"test_parse_empty … FAILED"}]}'],
["ben", "task_complete", '{"seq":1,"result":"Empty input is now an empty Config"}', true, '{"status":"done","review_filed":5}']],
why: "The claim carries every earlier attempt, with a reminder to fix the latest first.",
set: { 1: { stage: "built", review: 5, holders: ["ana", "ben"] } } },
{ act: "cy runs codex, like ben: no review for cy",
calls: [["cy", "task_next", "{}", false, "idle: 1 task is ready, but every one is a review of work this harness did — they need an agent in another harness"]],
why: "reviewer_harness_differs: no harness that held the work reviews it. ben is codex, so every codex session is barred.",
set: {} },
{ act: "eve (copilot) reviews #1 and upholds it",
calls: [["eve", "task_claim", '{"seq":5}', true, '{"claimed":5,"title":"Review: Parse the config format"}'],
["eve", "task_complete", '{"seq":5,"verdict":"upheld"}', true, '{"verdicts":["task 1 upheld — the work stands"]}']],
why: "Upheld after the latest completion: approved. Not yet merged.",
phases: [{ 1: { stage: "in_review", reviewer: "eve" } }, { 1: { stage: "approved", reviewer: null } }] },
{ act: "approved is not merged",
calls: [["ana", "factory_merge", '{"seq":1,"evidence":"4f2a9c1"}', false, "recording a merge needs one of the ci, human roles, and this connection is builder"],
["ci", "factory_merge", '{"seq":1,"evidence":"4f2a9c1"}', false, "the latest CI report on it is not a pass, and this factory merges only work CI has passed"]],
why: "Roles first, then policy: require_ci_to_merge reads CI's latest word, which is still the fail.",
set: {} },
{ act: "CI passes #1 and merges it — #2 is free",
calls: [["ci", "factory_gate", '{"seq":1,"outcome":"pass"}', true, '{"from":"approved","to":"approved"}'],
["ci", "factory_merge", '{"seq":1,"evidence":"4f2a9c1"}', true, '{"from":"approved","to":"merged"}']],
why: "A merge needs evidence: a SHA or a PR URL. It announces the dependents it frees.",
set: { 1: { stage: "merged", ci: "pass" }, 2: { waits: [] } } },
{ act: "the flaky test, round 1",
calls: [["ana", "task_claim", '{"seq":3}', true, '{"claimed":3}'],
["ana", "task_complete", '{"seq":3,"result":"Raised the timeout to 2s."}', true, '{"review_filed":6}'],
["ci", "factory_gate", '{"seq":3,"outcome":"fail"}', true, '{"from":"built","to":"ready","attempts":1}']],
why: "Built, then failed by CI before anyone reviewed it.",
phases: [{ 3: { stage: "claimed", holder: "ana" } }, { 3: { stage: "built", holder: null } }, { 3: { stage: "ready", attempts: 1 } }] },
{ act: "round 2",
calls: [["ana", "task_claim", '{"seq":3}', true, '{"claimed":3,"attempts":[…1]}'],
["ana", "task_complete", '{"seq":3}', true, '{"review_filed":7}'],
["ci", "factory_gate", '{"seq":3,"outcome":"fail"}', true, '{"from":"built","to":"ready","attempts":2}']],
why: "Same fix, same failure.",
phases: [{ 3: { stage: "claimed", holder: "ana" } }, { 3: { stage: "built", holder: null } }, { 3: { stage: "ready", attempts: 2 } }] },
{ act: "round 3: escalated",
calls: [["ana", "task_claim", '{"seq":3}', true, '{"claimed":3,"attempts":[…2]}'],
["ana", "task_complete", '{"seq":3}', true, '{"review_filed":8}'],
["ci", "factory_gate", '{"seq":3,"outcome":"fail"}', true, '{"from":"built","to":"escalated","attempts":3}']],
why: "max_attempts = 3: the third rejection becomes a question for a human, not a fourth try.",
phases: [{ 3: { stage: "claimed", holder: "ana" } }, { 3: { stage: "built", holder: null } }, { 3: { stage: "escalated", attempts: 3 } }] },
{ act: "nobody takes escalated work until dee answers",
calls: [["ben", "task_claim", '{"seq":3}', false, "task 3 is awaiting an answer: This work has been rejected 3 times… use `hird answer 3` before an agent claims it"],
["dee", "factory_decide", '{"seq":3,"action":"answer","text":"Use a fake clock in the test."}', true, '{"from":"escalated","to":"ready"}']],
why: "The answer rides in the next claim, beside all three attempts.",
set: { 3: { stage: "ready" } } },
{ act: "ben builds #2; ana has another go at #3",
calls: [["ben", "task_claim", '{"seq":2}', true, '{"claimed":2,"built_on":[{"seq":1,"standing":"upheld"}]}'],
["ben", "task_complete", '{"seq":2}', true, '{"review_filed":9}'],
["ana", "task_claim", '{"seq":3}', true, '{"claimed":3,"questions":[…],"attempts":[…3]}'],
["ana", "task_complete", '{"seq":3,"result":"The test drives a fake clock."}', true, '{"review_filed":10}']],
why: "#2's claim is handed what it builds on: #1's result and its standing.",
phases: [{ 2: { stage: "claimed", holder: "ben" } }, { 2: { stage: "built", holder: null, review: 9 } },
{ 3: { stage: "claimed", holder: "ana" } }, { 3: { stage: "built", holder: null, review: 10 } }] },
{ act: "each review goes to a harness that held none of the work",
calls: [["eve", "task_claim", '{"seq":9}', true, '{"claimed":9,"title":"Review: Wire the config…"}'],
["cy", "task_claim", '{"seq":10}', true, '{"claimed":10,"title":"Review: Fix the flaky…"}'],
["eve", "task_complete", '{"seq":9,"verdict":"upheld"}', true, '{"verdicts":["task 2 upheld"]}'],
["cy", "task_complete", '{"seq":10,"verdict":"upheld"}', true, '{"verdicts":["task 3 upheld"]}']],
why: "eve (copilot) reviews ben's codex work; cy (codex) may review ana's, which only claude-code ever held.",
phases: [{ 2: { stage: "in_review", reviewer: "eve" } }, { 3: { stage: "in_review", reviewer: "cy" } },
{ 2: { stage: "approved", reviewer: null } }, { 3: { stage: "approved", reviewer: null } }] },
{ act: "CI passes both; the release is in",
calls: [["ci", "factory_gate", '{"seq":2,"outcome":"pass"}', true, '{"to":"approved"}'],
["ci", "factory_gate", '{"seq":3,"outcome":"pass"}', true, '{"to":"approved"}'],
["ci", "factory_merge", '{"seq":2,"evidence":"9b1e07d"}', true, '{"from":"approved","to":"merged"}'],
["dee", "factory_merge", '{"seq":3,"evidence":"…/pull/3"}', true, '{"from":"approved","to":"merged"}']],
why: "CI or the human may merge. Every move is on the append-only trail with its role, model and evidence.",
phases: [{ 2: { ci: "pass" } }, { 3: { ci: "pass" } }, { 2: { stage: "merged" } }, { 3: { stage: "merged" } }] }
];
function steps(beat) {
if (beat.phases) return beat.phases;
return [beat.set || {}];
}
function stateAt(n, sub) {
var tasks = {};
for (var i = 0; i <= n; i++) {
var ph = steps(BEATS[i]);
var upto = i === n && sub != null ? Math.min(sub, ph.length - 1) : ph.length - 1;
for (var j = 0; j <= upto; j++) {
var set = ph[j];
Object.keys(set).forEach(function (seq) {
tasks[seq] = Object.assign({ attempts: 0, waits: [] }, tasks[seq] || {}, set[seq]);
});
}
}
return tasks;
}
var crewEl = $("crew"), lanesEl = $("lanes"), wireEl = $("wire");
CREW.forEach(function (m) {
var d = document.createElement("div");
d.className = "member";
d.id = "m-" + m.id;
d.innerHTML = "<b>" + m.id + "</b><span class=\"h\">" + m.harness + "</span><br><span class=\"role\">" + m.role + "</span>";
crewEl.appendChild(d);
});
STAGES.forEach(function (s) {
var lane = document.createElement("div");
lane.className = "lane " + s;
lane.id = "lane-" + s;
lane.innerHTML = "<h4>" + (LABEL[s] || s) + "</h4>";
lanesEl.appendChild(lane);
});
function esc(s) {
return String(s).replace(/[&<>"]/g, function (c) {
return { "&": "&", "<": "<", ">": ">", "\"": """ }[c];
});
}
var shown = {};
function render(n, sub) {
var beat = BEATS[n];
var tasks = stateAt(n, sub);
var calls = beat.calls;
var lastCall = beat.phases && sub != null ? sub : calls.length - 1;
$("act").innerHTML = esc(beat.act) + "<small>step " + (n + 1) + " of " + BEATS.length + "</small>";
$("clock").textContent = (n + 1) + " / " + BEATS.length;
CREW.forEach(function (m) {
var el = $("m-" + m.id);
var acted = calls.slice(0, lastCall + 1).filter(function (c) { return c[0] === m.id; });
el.classList.toggle("on", acted.length > 0);
el.classList.toggle("no", acted.some(function (c) { return !c[3]; }));
});
var before = {};
lanesEl.querySelectorAll(".tcard").forEach(function (c) {
before[c.dataset.seq] = c.getBoundingClientRect();
});
lanesEl.querySelectorAll(".tcard").forEach(function (c) { c.remove(); });
Object.keys(tasks).sort().forEach(function (seq) {
var t = tasks[seq];
var card = document.createElement("div");
card.className = "tcard";
card.dataset.seq = seq;
card.dataset.stage = t.stage;
var meta = [];
if (t.holder) meta.push("held by " + t.holder);
if (t.reviewer) meta.push("review: " + t.reviewer);
if (t.waits && t.waits.length) meta.push("waits on #" + t.waits.join(", #"));
if (t.attempts) meta.push("attempts " + t.attempts);
if (t.ci) meta.push("CI " + t.ci);
card.innerHTML = "<span class=\"n\">#" + seq + "</span> " + esc(TITLES[seq]) +
(meta.length ? "<span class=\"meta\">" + esc(meta.join(" · ")) + "</span>" : "");
if (shown[seq] && shown[seq] !== t.stage) card.classList.add("moved");
$("lane-" + t.stage).appendChild(card);
shown[seq] = t.stage;
});
if (!reduce) {
lanesEl.querySelectorAll(".tcard").forEach(function (c) {
var was = before[c.dataset.seq];
if (!was) return;
var now = c.getBoundingClientRect();
var dx = was.left - now.left, dy = was.top - now.top;
if (!dx && !dy) return;
c.style.transition = "none";
c.style.transform = "translate(" + dx + "px," + dy + "px)";
requestAnimationFrame(function () {
requestAnimationFrame(function () {
c.style.transition = "transform 0.45s ease";
c.style.transform = "";
});
});
});
}
var html = "";
calls.slice(0, lastCall + 1).forEach(function (c) {
html += "<div class=\"call\"><span class=\"who\">" + esc(c[0]) + "</span> " + esc(c[1]) + " " + esc(c[2]) + "</div>";
html += "<div class=\"" + (c[3] ? "ok" : "no") + "\">" + (c[3] ? "→ " : "REFUSED: ") + esc(c[4]) + "</div>";
});
if (sub == null || lastCall === calls.length - 1) html += "<div class=\"why\">" + esc(beat.why) + "</div>";
wireEl.innerHTML = html;
document.querySelectorAll("#beat-list li").forEach(function (li, i) {
li.classList.toggle("here", i === n);
});
$("prev").disabled = n === 0 && !sub;
$("next").disabled = n === BEATS.length - 1 && (sub == null || sub >= steps(beat).length - 1);
}
var reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
var idx = 0, sub = null, playing = false, timer = null, speed = 1;
function go(n, s) {
idx = Math.max(0, Math.min(BEATS.length - 1, n));
sub = s;
render(idx, sub);
}
function forward() {
var count = steps(BEATS[idx]).length;
if (sub != null && sub < count - 1) { go(idx, sub + 1); return true; }
if (idx >= BEATS.length - 1) return false;
var nextCount = steps(BEATS[idx + 1]).length;
go(idx + 1, nextCount > 1 ? 0 : null);
return true;
}
function back() {
if (sub != null && sub > 0) { go(idx, sub - 1); return; }
if (idx === 0) return;
go(idx - 1, null);
}
function schedule() {
window.clearTimeout(timer);
if (!playing) return;
var last = sub == null || sub >= steps(BEATS[idx]).length - 1;
timer = window.setTimeout(function () {
if (!forward()) { stop(); return; }
schedule();
}, (last ? 3200 : 1300) / speed);
}
function play() {
if (idx >= BEATS.length - 1 && (sub == null || sub >= steps(BEATS[idx]).length - 1)) go(0, null);
playing = true; $("play").textContent = "Pause"; schedule();
}
function stop() { playing = false; $("play").textContent = "Play"; window.clearTimeout(timer); }
$("play").addEventListener("click", function () { playing ? stop() : play(); });
$("next").addEventListener("click", function () { stop(); forward(); });
$("prev").addEventListener("click", function () { stop(); back(); });
$("restart").addEventListener("click", function () { shown = {}; go(0, null); play(); });
$("speed").addEventListener("change", function () { speed = parseFloat(this.value) || 1; schedule(); });
var list = $("beat-list");
BEATS.forEach(function (b, i) {
var li = document.createElement("li");
var btn = document.createElement("button");
btn.type = "button";
btn.textContent = b.act;
btn.addEventListener("click", function () {
stop(); go(i, null);
$("player").scrollIntoView({ behavior: reduce ? "auto" : "smooth", block: "start" });
});
li.appendChild(btn);
var refused = b.calls.filter(function (c) { return !c[3]; }).length;
if (refused) {
var s = document.createElement("span");
s.className = "refused";
s.textContent = refused === 1 ? "1 refusal" : refused + " refusals";
li.appendChild(s);
}
list.appendChild(li);
});
go(0, null);
if ("IntersectionObserver" in window && !reduce) {
var started = false;
new IntersectionObserver(function (entries) {
if (entries[0].isIntersecting && !started) { started = true; play(); }
else if (!entries[0].isIntersecting && playing) { window.clearTimeout(timer); }
else if (entries[0].isIntersecting && playing) { schedule(); }
}, { threshold: 0.3 }).observe($("player"));
}
})();
</script>
</body>
</html>