four roles four more tools stages derived, never stored done is not merged

The software factory

Give the workers in a hird-server roster roles 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 merged, not when its author says so.

Get started in five minutes

You need two agent harnesses, so that each can review what the other built. Install hird-server from a release binary (Linux or Apple silicon, no Rust needed) or with Cargo, and one command sets up everything else and walks you through it.

curl -fsSL https://raw.githubusercontent.com/aoprisan/hird/main/scripts/get.sh | sh -s -- --server
# or, with a Rust toolchain: cargo install hird-server --locked
hird-server quickstart --tour                # set up, then a guided tour of the sample
hird-server quickstart --harness gemini --harness opencode

It writes a hird-factory/ directory:

FileWhat it is
roster.tomlA factory roster with fresh tokens: you as human, one builder-and-reviewer token per agent harness, and ci.
connect/<harness>.mdThe command or config that connects that harness, with its token filled in.
ci, humanScripts for the moves no agent makes: ci pass 1, ci merge 1, human answer 3 "…", human board.
playground/A git repository with a sample release already filed: Write fizzbuzz, then Test and Document it, which wait on the first until it is merged.
GUIDE.mdThe steps, which it also prints before it starts serving.

With --tour, it first plays the sample’s first task from ready to merged in your terminal, as the two agents, CI and you would, and stops after each step to say what happened and why. Press Enter for the next one, and keep the /watch link open to see the cards move:

  1. The board. Three tasks; two wait on the first.
  2. A builder asks for work and claims #1. The other agent is refused #2: #1 is not merged.
  3. It builds, commits fizzbuzz.py, and completes. The factory files a review the builder may not take.
  4. CI fails it. Back to ready, with the output kept.
  5. The rebuild is handed the failure, fixes it, and completes again.
  6. The other harness reviews and upholds it: approved.
  7. Approved is not merged. The builder may not merge, and CI may not until its last run passes. Pass, then merge.
  8. Your turn. #2 and #3 are free, and are for your own agents.

Then it serves, and the guide takes you through a lap of your own:

  1. Watch the floor. Open the /watch link it prints.
  2. Connect your agents. One snippet each, from connect/.
  3. Put them to work. Start each in the playground and say work the hird queue. One builds; the other is the only one allowed to review it.
  4. Be CI. Run the tests, then ./ci pass 1 or ./ci fail 1 "what broke".
  5. Merge. ./ci merge 1 records the playground’s HEAD, and frees the two tasks waiting on it.
  6. Decide. ./human approves, rejects, answers escalations, reopens and cancels.

Run it again to come back: the same tokens and the same board. When you are ready for real work, hird-server quickstart --dir factory --project /path/to/repo sets the same thing up for your repository, with nothing filed for you.

What the factory adds

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 who may do what, or of work being in rather than merely done. The factory adds both, on the server only, and the local queue is unchanged.

ready→ claimed→ built→ in_review→ approved→ merged  ·  rejections loop back to ready; the third asks a human: escalated

Roles come from the roster

Each token's roles 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.

Four more tools

factory_gate for CI, factory_merge for CI or a human, factory_decide for the human, and factory_board for anyone — beside the twelve every worker has.

Nothing is assigned

Roles say who may take work, never who will. Agents still pull with task_next; escalation asks a human rather than retrying.

One release, step by step

This is examples/factory.sh, played back. Six workers hold six tokens. The human files three tasks; #2 waits on #1, and #3 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.

The run, in words

Click a step to jump the player to it.

    Roles

    RoleMayMay not
    builderClaim and finish work tasks. Every finish files a review.Take a review; record a merge.
    reviewerClaim a review and return upheld or sent_back.Review work it, or (under the policy) its harness, ever held.
    cifactory_gate a test run; factory_merge approved work.Claim anything.
    humanfactory_decide: approve, reject, answer an escalation, reopen, cancel; and merge.—
    # factory-roster.toml — the policy, and one entry per token
    [factory]
    reviewer_harness_differs = true   # no harness that held the work reviews it
    max_attempts = 3                  # the third rejection asks a human
    require_ci_to_merge = true        # merge only what CI last passed
    
    [[worker]]
    token = "…"
    identity = "ana"
    harness = "claude-code"           # builders and reviewers must pin a harness
    model = "model-id"                # recorded on everything this worker does
    roles = ["builder"]

    Stages

    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.

    StageMeansLeaves by
    readyOpen, no unanswered question, dependencies merged.A builder claims it.
    claimedA builder holds the lease.task_complete; or the lease lapses back to ready, with no attempt counted.
    builtDone, and its review is waiting.A reviewer claims the review; CI fails it; a human decides.
    in_reviewA reviewer holds the review.upheld → approved; sent_back → an attempt, back to ready.
    approvedUpheld since its latest completion.factory_merge with a SHA or PR URL, once CI’s latest word is a pass.
    mergedIn. Its dependents are released.Only a human reopen.
    escalatedRejected max_attempts times, or failed: a question for a human.factory_decide answer or reopen.

    The refusals it exists to make

    No one reviews their own work

    Not the builder, not another session of the builder’s harness, and not an earlier holder whose lease lapsed. In the run, cy runs codex like ben did, so task_next hands cy nothing.

    Nothing builds on unmerged work

    A dependency clears only once it is merged. Approved work can still fail CI, so #2 stays held until #1 is in.

    Approved is not merged

    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.

    The queue asks, it never retries

    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.

    Run it yourself

    Both examples start a throwaway hird-server on a temporary database with a generated roster, so nothing touches your real queue.

    # a factory of your own, with a guided tour
    hird-server quickstart --tour
    
    # the run on this page: scripted, the same every time
    ./examples/factory.sh              # prints every call and the server's answer
    ./examples/factory.sh --pause      # stops between acts; open the /watch URL it prints
    
    # a crew working at random, for watching the live floor
    just floor
    #   The floor:  http://127.0.0.1:7474/watch#token=…

    For a real deployment, start from examples/factory-roster.toml. The design, with every allowed and forbidden transition, is DESIGN.md §33.