Skip to content

Hive gallery

Steven Enamakel edited this page Oct 11, 2026 · 2 revisions

Hive gallery

Seven complete hive packages ship in crates/tinyhivemind-lang/examples/hives/. Between them they use every part of the language. Each package's README.md says what it demonstrates, and tests/gallery_packages.rs parses and lowers every one and pins the facts it exists to show.

Package Seats Desks What it shows
review-board 3 1 The minimal hive: blind round, grounded quorum, a replayed script
research-debate 4 1 Goals with subgoals, missions, an itemized context document
incident-response 6 2 Topology, referrals with a hop limit, approval, private asides
memory-guild 4 1 Agent, pool, forked, persistent, and read-only memory; frontmatter
self-improving 3 1 A constitution with permitted edits, canaries, protected namespaces
math-panel 5 1 Five unreliable seats solving exact problems
math-swarm 50 5 Fifty seats in five linked desks on the same problems

Every diagram below is the output of hive_view <dir> --mermaid. Every run command is relative to the repository root, using

H=crates/tinyhivemind-lang/examples/hives

To watch a package in the browser, start the lab viewer (cd examples/lab/viewer && npm install && npm run dev) and open http://localhost:8099/?hive=<name>. Hive language describes the player.

Offline runs have no model behind them. review-board replays its script.json, and the math packages run a seeded simulation from sim.json. The other four use hive_view's seeded default script, in which seats propose option-a, option-b, or option-c blind and then mostly back the leader, so their endings show the protocol at work, not the content of their prompts. A package with several desks runs one floor per desk: each desk has its own journal and episode, and takes its share of the package's quorum and turn budget. Desks reach each other only through core's referral fold, along declared topology and referrals links, in pipeline order (a desk opens once every desk linking forward into it has ended), within the referral policy's max_hops. A converged desk reports its answer down each outgoing link, and the last declared desk's ending is the hive's. The hive_view README has the routing rules. With --live, a real model writes every line instead (Live runs).

review-board

The minimal hive. An author proposes that a retry-policy change merges, and two reviewers deliberate blind and then in the open. The room converges on #merge once two grounded supporters carry it. The episode policy is a blind opening round of three, a nine-turn budget, and a grounded quorum of two. script.json holds the scripted lines, so the run is the same every time: three rounds, seven turns, converged on #merge. Hive language prints the whole episode.

flowchart LR
  subgraph board["Review board"]
    board__author["author<br/><i>author</i>"]
    board__reviewer_a["reviewer-a<br/><i>reviewer</i>"]
    board__reviewer_b["reviewer-b<br/><i>reviewer</i>"]
  end
Loading
cargo run -p tinyhivemind-lang --example hive_view -- $H/review-board --run

Live: http://localhost:8099/?hive=review-board

research-debate

A goal tree, missions, and shared context. The desk decides whether to cache an embedding index. The verdict goal splits into survey and critique, and three missions bind the moderator, librarian, and skeptic roles to the goals they own. context/brief.md holds three items (latency, staleness, prior-work), each patchable on its own. The desk uses responder_mode: auto.

flowchart LR
  subgraph debate["Debate"]
    debate__moderator["moderator<br/><i>moderator</i>"]
    debate__advocate["advocate<br/><i>advocate</i>"]
    debate__skeptic["skeptic<br/><i>skeptic</i>"]
    debate__librarian["librarian<br/><i>librarian</i>"]
  end
Loading
cargo run -p tinyhivemind-lang --example hive_view -- $H/research-debate --run
cargo run -p tinyhivemind-lang --example hive_view -- $H/research-debate --json   # goals and missions

Live: http://localhost:8099/?hive=research-debate

incident-response

Two desks joined by topology and referrals. The triage desk owns the incident and refers concrete fixes to the fixers desk, which can refer back when a fix needs a decision. Referral is enabled with max_hops: 2. The approval policy allows read-only actions, asks before a mutating deploy to prod, and routes approval to oncall-manager, or to release-manager for the fixers desk. Seats may open private asides of two members and at most six messages, and an aside must surface its conclusion. See Cross-desk referral and Private asides.

flowchart LR
  subgraph triage["Triage"]
    triage__incident_lead["incident-lead<br/><i>incident-lead</i>"]
    triage__triager_logs["triager-logs<br/><i>triager</i>"]
    triage__triager_metrics["triager-metrics<br/><i>triager</i>"]
  end
  subgraph fixers["Fixers"]
    fixers__fixer_db["fixer-db<br/><i>fixer</i>"]
    fixers__fixer_net["fixer-net<br/><i>fixer</i>"]
    fixers__release_reviewer["release-reviewer<br/><i>release-reviewer</i>"]
  end
  triage --> fixers
  triage -. refer .-> fixers
  fixers -. refer .-> triage
Loading

Solid arrows are topology; dashed arrows are referral channels.

cargo run -p tinyhivemind-lang --example hive_view -- $H/incident-response --run

Each desk runs on its own floor of three, with a quorum of two and nine turns. Triage decides first and refers its answer to fixers (hop 1); once fixers converge, their report back to triage is refused desk_closed, since triage has ended, and fixers' ending is the hive's.

Live: http://localhost:8099/?hive=incident-response

memory-guild

Every part of the memory declaration, under the root team:guild. The archivist (persists across runs) and the scribe (one run only) each hold private agent memory. The guild shares a lore pool that persists across runs. The charter pool is read-only and pinned by the constitution. Scout-a forks its own memory beneath the lore pool, and scout-b binds the lore pool directly. Each binding sets its reads, recall moments, budget, and the entry kinds it may remember. The archivist's prompt repeats its seat and binding fields as JSON frontmatter, and validation checks them against the manifest.

flowchart LR
  subgraph guild["Guild"]
    guild__archivist["archivist<br/><i>archivist</i>"]
    guild__scribe["scribe<br/><i>scribe</i>"]
    guild__scout_a["scout-a<br/><i>scout</i>"]
    guild__scout_b["scout-b<br/><i>scout</i>"]
  end
Loading

After lowering, scout-a's binding resolves to agent scout-a under root team:guild/project:lore. The archivist resolves to agent archivist under team:guild.

cargo run -p tinyhivemind-lang --example hive_view -- $H/memory-guild           # tree with memory bindings
cargo run -p tinyhivemind-lang --example hive_view -- $H/memory-guild --run

Live: http://localhost:8099/?hive=memory-guild

self-improving

The package the editing guide works on. Its constitution permits prompt, context, and goal edits and nothing else, so an editor can rewrite a seat prompt or a playbook item but can't add a seat or loosen a policy. The held-out namespace team:self/project:heldout is protected, the canary HELDOUT-7F3A guards against leaked answers, and the eval-ledger pool is read-only. Hive language editing walks through patches that are accepted and refused against it, and builds a lineage archive from them.

flowchart LR
  subgraph workbench["Workbench"]
    workbench__solver["solver<br/><i>solver</i>"]
    workbench__critic["critic<br/><i>critic</i>"]
    workbench__editor["editor<br/><i>editor</i>"]
  end
Loading
cargo run -p tinyhivemind-lang --example hive_view -- $H/self-improving --run
cargo run -p tinyhivemind-lang --example self_edit     # propose, guard, record, select

Live: http://localhost:8099/?hive=self-improving

math-panel

Five seats on one desk solving small exact problems: a conjecturer, two solvers, a checker, and a lead. Every seat is unreliable on its own. The panel runs a blind opening round of five, has a fifteen-turn budget, and decides by a grounded quorum of three. The checker objects to advocates of any answer it can't reproduce. The eight problems in sim.json cover lattice paths, modular power sums, a digit sum, multiples of 3 or 5, a square difference, and a prime count. hive_view computes each answer exactly.

flowchart LR
  subgraph panel["Panel"]
    panel__conjecturer["conjecturer<br/><i>conjecturer</i>"]
    panel__solver_a["solver-a<br/><i>solver</i>"]
    panel__solver_b["solver-b<br/><i>solver</i>"]
    panel__checker["checker<br/><i>checker</i>"]
    panel__lead["lead<br/><i>lead</i>"]
  end
Loading
cargo run -p tinyhivemind-lang --example hive_view -- $H/math-panel --run --seed 3
cargo run -p tinyhivemind-lang --example hive_view -- $H/math-panel --run --problem primes-200

Live: http://localhost:8099/?hive=math-panel&seed=3

math-swarm

Fifty seats in five desks of ten, solving the same problems. Conjecturers guess. Computers are exact on one residue slice each. Provers derive the answer in full. Verifiers object to advocates of answers they can't reproduce. Synthesis leads back the best-grounded answer and record it. The topology chains the desks in a ring (conjecture -> compute -> prove -> verify -> synthesis -> conjecture). Referrals run into the verify desk from conjecture, compute, and prove, out of it to synthesis, and from synthesis back to prove. The constitution raises the caps to 200 turns and width 10. Blind rounds run ten seats at a time. The package declares a turn budget of 150 and a grounded quorum of 26 (EpisodePolicy::for_room(50)), which each desk takes its share of: a quorum of 6 of its 10 seats and 30 turns. Referral is enabled with max_hops: 4, the depth of the conjecture -> ... -> synthesis pipeline, so synthesis's feedback reports to conjecture and prove are refused hop_limit_reached. Every seat prompt opens with a distinct persona (You are a "...") that a live model plays, and every seat denies web_search, web_fetch, browser, and http.

The full --mermaid output is 71 lines, one node per seat, which is too large to read here. This diagram is drawn at desk level by hand from the same output: the same desks and the same edges, with each desk's ten seats collapsed into one node.

flowchart LR
  conjecture["Conjecture<br/><i>10 conjecturers</i>"]
  compute["Compute<br/><i>10 computers</i>"]
  prove["Prove<br/><i>10 provers</i>"]
  verify["Verify<br/><i>10 verifiers</i>"]
  synthesis["Synthesis<br/><i>10 synthesizers</i>"]
  conjecture --> compute
  compute --> prove
  prove --> verify
  verify --> synthesis
  synthesis --> conjecture
  conjecture -. refer .-> verify
  compute -. refer .-> verify
  prove -. refer .-> verify
  verify -. refer .-> synthesis
  synthesis -. refer .-> prove
Loading
cargo run -p tinyhivemind-lang --example hive_view -- $H/math-swarm --mermaid   # all 50 seats
cargo run -p tinyhivemind-lang --example hive_view -- $H/math-swarm --run --seed 3

The desks run in pipeline order, each on its own floor with a quorum of six, and synthesis's ending is the hive's answer. Personas are cosmetic offline: the simulation draws behaviour from sim.json. Above 16 seats the live player switches to compact, numbered nodes.

Live: http://localhost:8099/?hive=math-swarm&seed=3

Scale: one seat, a panel of five, a swarm of fifty

--compare runs the same problem for every package on each seed, along with a single-seat baseline: one solve seat on a one-member desk with a quorum of one.

cargo run --release -p tinyhivemind-lang --example hive_view -- \
  crates/tinyhivemind-lang/examples/hives/math-swarm --compare --seeds 50 --table
50 seeds, same problem per seed for every package; correct = exact answer

package      seats accuracy converged deadlocked exhausted   idle  rounds   turns  ms/episode
single-seat      1    0.640     1.000      0.000     0.000  0.000    2.00    2.00       0.009
math-panel       5    0.580     0.720      0.000     0.280  0.000    2.30    8.62       0.044
math-swarm      50    0.980     1.000      0.000     0.000  0.000   12.54   84.90       1.207

ms/episode is wall-clock time and varies between machines. The other columns are deterministic for a given seed set. In the browser, http://localhost:8099/?compare=math-panel,math-swarm&seeds=50 streams the same comparison with a per-seed strip.

The swarm decided correctly on 49 of 50 seeds (0.98), against 0.64 for a single seat. It converged every time, on a mean of 85 of its 150 turns over 12.5 rounds. Before desks were routed, the same fifty seats on one combined floor were right on all 50 seeds in 54 turns. The routed pipeline spends more turns because every desk holds its own blind round, and each desk decides on a quorum of six of its own ten seats instead of 26 of fifty.

The five-seat panel did worse than one seat: 0.58. Adding seats didn't help it, for three reasons:

  • It runs out of turns. 28% of panel episodes exhausted the fifteen-turn budget without converging, with every advocate silenced by an objection. Those seeds count as wrong.
  • Its errors are correlated. A wrong answer is the problem's classic mistake half the time and plus or minus one otherwise, so wrong seats tend to agree on the same wrong answer instead of scattering.
  • A wrong checker silences correct advocates. The checker objects to anyone backing an answer other than its own. When the checker is wrong, its grounded objections take the correct answer's supporters off the board.

The swarm's advantage is partly composition, not size alone. It has ten computer seats. Each one knows the exact answer with its drawn accuracy, and otherwise knows the answer modulo one small number (3, 4, 5, 7, 8, 9, 11, 13, 16, or 25). A computer never claims more than it knows, so unlike every other seat it is never wrong. It objects to advocates of answers its residue rules out, which removes the plus-or-minus-one mistakes. The panel has no seat like it. This comparison doesn't separate the effect of fifty seats from the effect of having those calculators; a fifty-seat swarm without computers, or a panel with one, would.

What this measures

This is an offline simulation, not a model benchmark. No model is called. Each seat draws an accuracy from its role's range with the run's seed, in parts per million, and is right with that probability. A computer that misses falls back to its residue instead of a wrong answer:

Role Behaviour Accuracy range In
conjecturer guess 0.25 – 0.45 panel, swarm
solver / prover solve 0.45 – 0.75 panel, swarm, single-seat baseline
checker / verifier check 0.50 – 0.80 panel, swarm
lead / synthesizer lead 0.45 – 0.75 panel, swarm
computer slice 0.30 – 0.60 swarm only

The ranges are shared by both math packages and were fixed before any run, so a swarm seat is no better than its panel counterpart. What the table shows is how the protocol, meaning quorum, grounded objection, blind rounds, and the turn budget, behaves under this error model. It doesn't show what real models would do. For that, see Live runs.

Live runs

--live makes every seat turn a real chat completion on OpenRouter. Each seat is prompted with its persona and job, its role charter, its desk and linked desks, the trace grammar, and its own projection of its desk's journal, so blind rounds stay blind. Core still decides every round and ending, and the desk router still routes every referral. A reply is reduced to the first valid trace line; one without a valid line is recorded as a note that never votes.

export OPENROUTER_API_KEY=...        # read from the environment, never argv
cargo run --release -p tinyhivemind-lang --example hive_view -- \
  $H/math-swarm --run --live --seed 1 --problem lattice-5x8 --max-calls 300

--model <id> (else OPENROUTER_MODEL, else openai/gpt-oss-120b:nitro) picks the model, --max-calls N (default 300, at most 2000) is a hard cap, and --max-tokens N bounds each call. Add --frames for the NDJSON stream, which ends with a usage frame of calls, tokens, and cost. In the lab viewer, &live=1 (with &model= and &max_calls=) runs the same thing when the server's environment carries the key. Every request body and response, calls.ndjson, frames.ndjson, and usage.json are kept under hive-runs/hive-view/<package>-seed<N>-<ms>/ at the main checkout's root (git-ignored), or under $HIVE_RUNS_DIR.

Live runs deny web access three ways. Every gallery seat denies the web tools. The request body carries no tools, tool_choice, functions, plugins, or web_search_options. And any model id containing online, search, sonar, or web is refused before a call is made, by both the binary and the viewer server.

Seed 1, openai/gpt-oss-120b:nitro:

Package Problem Outcome Calls Tokens Cost Wall
math-panel lattice-5x8 correct 6 4,453 $0.0020 1.6 s
math-swarm lattice-5x8 correct, via synthesis in 13 rounds 58 46,104 $0.0186 14.5 s
math-swarm digitsum-2pow50 correct 55 not recorded $0.0231 not recorded

These are single runs, not a benchmark: three episodes on one seed show the routed pipeline working end to end with a real model, not how often it is right.

Record

The dated record of the comparison, with an update for routed desks and these live runs, is docs/experiments/2026-10-11-math-hive-scale.md. Benchmarks: scale reports the core benchmark harness's separate scale results.

Clone this wiki locally