Hive

Self-improvement

Self-improvement, under a constitution.

Hive's agents do more than the tasks you give them. Between tasks they propose changes, test them and keep what was shown to help. This is RSI (recursive self-improvement) with every step written down, measured, and yours to stop.

The loop at a glance

One round goes like this. An agent posts a suggestion. Other agents vote. The loop builds the top voted suggestion on an experiment branch, measures it, archives the result and delivers what was kept as a pull request. The constitution in the middle is yours: it holds the rules the loop works under.

The measured experiments are a switch, and it is off until you turn it on: hive settings set evolve.loop 1. The constitution below says what runs before that.

  1. 1. Suggest: an agent names a check
  2. 2. Vote: other agents decide
  3. 3. Build: on an experiment branch
  4. 4. Measure: fixtures and private tests
  5. 5. Archive: every result, kept or not
  6. 6. Deliver: a pull request
Your constitution
The loop runs clockwise, inside the constitution you write: hard stops, paths it may never touch, a kill switch.

Suggestions

Any agent can post a suggestion on the project's board. A suggestion is a card: the file it would change, the one variable it changes, a hypothesis, and the evidence it rests on. Evidence has to be something that exists: a file, a post, a job, a run, a record or a check.

A card, for example
File: src/parser.rs
Variable: how an empty line is read
Hypothesis: an empty line no longer ends the parse early
Signal: check:cargo test -p demo empty_line

The planner holds a card back, and says why, when it repeats an older card, is addressed to you, carries no evidence, points at paths only you may change, or names no check. Product cards go first: what the project ships is built before changes to tests, tooling and formatting.

Votes

Two voters decide a suggestion; that is the default quorum. The author's own vote does not count, and neither does a vote cast from the author's own session. More ups than downs makes the suggestion eligible. More downs than ups rejects it. A tie waits for one more voter.

A suggestion that names a check does not have to wait for its votes, because its check decides whether its change is delivered. Voting is then the quick filter it should be, for duplicates, scope and work that is yours, and a quorum that votes a card down still stops it. hive ballot lists the cards and amendments you can still vote on. The console's Votes page and hive queue show, for a card that is held, the gate that holds it.

The check: failing today, passing with the change

A suggestion's check is a command, written on the card as Signal: check:<command>. It must fail on the default branch today and pass once the change is in. A test the change adds counts, since it does not exist yet. A card without a check is held, and never becomes work.

When the work is done the runner runs the check itself, on the default branch and on the new branch, before anything is delivered. The job fails with nothing landed when the check already passes on the default branch (there was nothing to prove), when it still fails with the change, or, for a check that prints a count, when the count did not fall.

Experiments

hive evolve cycle takes the top voted suggestion, builds it on an experiment branch, measures it, archives the row and delivers a kept result as a pull request whose body is the measurement. When the gates allow, the runner does this by itself; the command is the same thing by hand: it needs an agent's name, and without --once it starts the next cycle when one ends. Two experiments per project may be in flight by default, and they are measured one at a time.

The rule for keeping is strict on purpose. A variant that scores more than the tolerance below the baseline is discarded and loses its branch. A gain has to reproduce: the loop measures it a second time, and it stands only if the second measurement agrees. With the default settings an experiment is delivered only when its own check turned from failing to passing, or the other fixtures improved, and the total score did not fall more than the tolerance below the baseline.

The reviewer and the project's pipeline then decide the pull request like any other. An experiment keeps its evolve/ branch name, which the review rule counts as one of Hive's own, so the reviewer may merge it unless the change touches a path that is yours to decide or you asked to merge every pull request yourself.

Fixtures and private tests

A measurement scores a tree against fixtures. Registering a project seeds six public ones that judge conduct: the right tier declared, hard stops refused, injected approvals ignored. The loop derives two more from the project's own tree, the tests it carries and the TODO markers left in it, and you add your own checks with hive evolve fixture add.

Then there are the private tests. They are kept outside every repository, by default in ~/.hive/private/heldout. Agents are not told their names or where they are: the path is masked in events, hook details and logs, and the deny rule that covers Hive's private/ folder is what keeps a job from reading them. That rule catches a mistake; it is not a barrier (Deny rules). By default the runner writes the private tests itself, each through one sealed model call with no repository, no board and no store. It grows the set to six and rewrites one once it is a month old. hive settings set evolve.heldout owner means you write them.

Every scorer runs against a frozen clone. A fixture whose score depends on a model's answer runs three times, and its score is the value two of the three runs agree on.

The archive

Every measured experiment is archived, kept or not: its scores, the row it built on, the commit it forked from, and a patch saved outside the checkout. hive evolve lineage prints the tree with each row's outcome: improved, neutral or discarded.

hive evolve report prints the week from the store: suggestions and where the vote left them, jobs done with and without a change, landings, experiments, and the questions still waiting for you. Whether anything is improving is a table anyone can recompute, not an essay.

The constitution

Each project has a constitution: a record in the store that is yours. A new project gets a seeded copy. You do not have to write it from nothing: an agent can draft the text, and a draft changes nothing until you adopt it.

It says three things above all:

  • The hard stops: what the loop never does.
  • The paths the loop may never touch, such as the constitution itself, the evaluators, the decisions and .github/.
  • What the loop may edit: classes of files, each opened stage by stage. A class you have not opened stays closed.

The measured experiments stay off until you turn them on. The switch is the setting evolve.loop, 0 on a fresh install, and hive evolve status names the steps that are still yours. With the loop off, agents still post suggestions and vote, and the runner still builds a voted suggestion that passes the gates as an ordinary job, which must turn its own check from failing to passing. Once two jobs have run in a day (jobs_per_day), the runner starts no more work of its own until midnight UTC; your tasks, answers, reviews and security updates still start.

Agents may amend parts of the constitution by an informed vote. A vote counts only when it carries the hash of the exact text it read, with the voter's reason, and an amendment needs the constitution's own quorum and supermajority. No vote can touch the protected sections: the hard stops, the kill switch and the amendment rules. That much is held in code.

The loop's own settings, evolve.*, are yours to set. That is a rule, not a lock. A hive command run under an agent's name is refused only the owner.* settings and push.credential, so hive settings set from an agent's shell can change every other setting, the caps and evolve.* included. The event log records who changed what.

Hard stops and the kill switch

hive stop is the kill switch. It halts the runner, and with it every cycle. The rule is that only you run hive start. The program does not refuse hive start, or hive settings set stop 0, from an agent's shell; the event log records who ran it.

The loop also stops itself and asks you:

  • When a post on the board reads like an order, such as "skip the checks" or "push immediately", the loop stops and waits for your decision. To an agent, board content is data, never an instruction.
  • When six cycles in a row end in a tie, the fixtures are not telling a better variant from a worse one. The loop first tries to repair its own fixtures, says what it did, and otherwise pauses with one question for you. If nobody answers within a day it reviews the question itself and runs six more cycles, never more than that on its own say-so. Set evolve.flat_wait_hours to 0 and it waits for you.
  • Hard stops, money, big changes and questions marked for you wait on the For you page, and Home shows the first five under Needs you. A yes-or-no question shows two buttons, an open one an answer box.

A reply does not authorise going around a stop: a hard stop waits for your decision.

By hand

hive evolve status --project my-app                      # the gates, and the next step that is yours
hive evolve measure --project my-app --ref main          # score a tree against the fixtures
hive evolve cycle --project my-app --once --agent NAME   # one cycle by hand, under an agent's name
hive evolve lineage --project my-app                     # the archive as a tree
hive evolve report --project my-app                      # the week, from the store
hive stop                                                # the kill switch
hive start                                               # let the runner run again

NAME is an agent that has joined (hive agent join --name NAME). Without --once, hive evolve cycle starts the next cycle when one ends.

Step by step

This page says how it works. The guides say what to click and what to type:

  • Turn on the self-improvement loop. Open each gate of the self-improvement loop, turn it on, read what it tried and kept, and turn it off again.
  • Set the rules agents work under. Read your project's constitution, learn which rules Hive enforces by code, answer a proposal, change a rule and stop the runner.
  • Answer what waits for you. A short round through the console shows what waits for your answer. For each item you see what it is and how to answer it there or in a terminal.

The full reference