Watch
0
0
Fork
You've already forked hyperhive
0
a swarm o agents, each in its own nspawn cage, gossiping over unix sockets. config changes flow as git commits, the operator approves them in a browser, every deploy is a tag. cyberpunk-themed dashboard included. 💜⚡
  • Rust 66.3%
  • Nix 22.3%
  • TypeScript 5.6%
  • JavaScript 2.6%
  • CSS 2.1%
  • Other 1.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
atlas 484a9fd4c1 swarm-controller: send one operator message to several agents
The swarm UI's broadcast page (#5524) needs the controller to do the
fan-out, so POST /api/agents/broadcast takes {agents, body} and answers
200 with {results: [{agent, sent, reason?}]} in request order.

- agent_input.rs: the single-agent send is now send_one, which both
  routes call; the single route maps its outcome to the same statuses
  and texts as before. The broadcast validates the whole request first
  (sender, empty body, empty or duplicated agents, more than 64, a name
  outside the roster), then sends up to 16 at once with the single
  route's no-responders window.
- main.rs: wires the route.
- docs/swarm/ui.md: describes the route next to the single-agent one.
2026-10-18 01:49:03 +02:00
.forgejo/workflows ci: evaluate with nix-eval-jobs under a memory cap, then build the checks 2026-10-17 11:02:29 +02:00
.hyperhive review classifier: tests-with-behaviour asks for tests of the logic, not of every line of glue 2026-10-14 18:51:45 +02:00
branding swarm-ui: make it installable as a PWA 2026-09-12 11:30:20 +02:00
claude-plugins add swarm-metrics, an agent CLI for the metrics store 2026-10-17 10:10:17 +02:00
docs swarm-controller: send one operator message to several agents 2026-10-18 01:49:03 +02:00
frontend swarm-ui: the subagents menu resets per agent and closes when an entry is picked 2026-10-18 01:46:49 +02:00
hive-agent archetypes: say nothing in the prompt about a config repo an archetype agent lacks 2026-10-17 16:27:21 +02:00
hive-agent-mcp drop option renames and removals older than two weeks 2026-10-16 22:04:57 +02:00
hive-agent-sock subagent: keep runs at +1000 when their cgroup is unavailable 2026-10-13 12:25:27 +02:00
hive-bash-mcp bash-mcp: warn when capturing a task's stdout or stderr fails 2026-10-16 16:55:48 +02:00
hive-c0re hive: stop controlling the swarm's forge and matrix containers 2026-10-17 23:27:44 +02:00
hive-core-agent-sock say per-agent socket where the manager socket is gone 2026-10-16 21:42:26 +02:00
hive-forge hive-forge: exit after HIVE_FORGE_DEADLINE instead of hanging on a stalled forge 2026-10-17 08:01:23 +02:00
hive-forge-notify retry the remaining plain schedules with backon 2026-10-17 16:33:21 +02:00
hive-host-sock hive: stop controlling the swarm's forge and matrix containers 2026-10-17 23:27:44 +02:00
hive-jobq hive-jobq: treat a panicking job runner as a failed node 2026-10-09 15:14:04 +02:00
hive-jobq-metrics drop the remaining HYPERHIVE_OTEL_METRIC_INTERVAL_MS readers 2026-10-17 08:00:14 +02:00
hive-jobq-wire address review: move parse_states/filter_nodes_by_state to hive-jobq-wire, rename placeholder enums, trim core-mirroring framing 2026-08-16 16:59:54 +02:00
hive-log log: send records natively to journald, keep stdout off-unit 2026-09-21 15:52:57 +02:00
hive-matrix-mcp matrix mcp: a restore that hangs at boot times out instead of blocking every account after it 2026-10-15 08:29:17 +02:00
hive-metric docs(readmes): drop mentions of nonexistent fields 2026-10-02 11:40:07 +02:00
hive-priv hive-priv refuses bind-mount edits on the swarm's forge and matrix containers 2026-10-18 00:21:45 +02:00
hive-priv-sock hive-priv refuses bind-mount edits on the swarm's forge and matrix containers 2026-10-18 00:21:45 +02:00
hive-runtime acp rpc: log a read error on the agent's stdout/stderr before treating the stream as closed 2026-10-16 14:47:04 +02:00
hive-screen-mcp drop option renames and removals older than two weeks 2026-10-16 22:04:57 +02:00
hive-sh4re archetypes: build an archetype agent from its archetype's module on the hive 2026-10-17 16:27:21 +02:00
hive-sock-client retry: share one backon helper for the client secret reads and convert the remaining doubling tables 2026-10-17 12:31:29 +02:00
hive-subagent-mcp grant manage_root_agent by stored permission only, not by the name ruth 2026-10-17 08:10:08 +02:00
hive-types swarm-controller: refuse new agents named hive-<anything> 2026-10-07 21:07:17 +02:00
hivectl hive: stop controlling the swarm's forge and matrix containers 2026-10-17 23:27:44 +02:00
nix trust the swarm services ca in swarm-ci-metrics 2026-10-17 23:28:03 +02:00
scripts ci: evaluate with nix-eval-jobs under a memory cap, then build the checks 2026-10-17 11:02:29 +02:00
swagger-ui-theme treefmt: apply prettier 2026-09-02 15:25:07 +02:00
swarm-agent-verify swarm-agent-verify: lift the agent-token store check out of swarm-nats-auth 2026-10-13 08:38:05 +02:00
swarm-authelia-bridge chown only a lock file swarmctl just created and refuse a hard-linked one 2026-10-17 15:19:09 +02:00
swarm-authelia-bridge-sock swarm-controller: make authelia's operators matrix homeserver admins 2026-10-04 16:45:08 +02:00
swarm-builder swarm-builder: refuse a build that waited too long for the slot 2026-10-17 23:30:13 +02:00
swarm-ci-metrics read the publisher in authelia's container in the ci-metrics eval and error text 2026-10-17 00:28:16 +02:00
swarm-claude-login retry: share one backon helper for the client secret reads and convert the remaining doubling tables 2026-10-17 12:31:29 +02:00
swarm-controller swarm-controller: send one operator message to several agents 2026-10-18 01:49:03 +02:00
swarm-controller-api take the agent-create and forge-token responses from swarm-controller-api 2026-10-18 00:14:02 +02:00
swarm-logs swarm-logs-auth: rate-limit verification and cache positive verdicts 2026-10-14 01:54:54 +02:00
swarm-logs-auth add swarm-metrics, an agent CLI for the metrics store 2026-10-17 10:10:17 +02:00
swarm-matrix-client swarm-controller: log matrix accounts in and out through swarm-matrix-client 2026-10-17 23:26:33 +02:00
swarm-matrix-ctl matrix: drop the per-hive appservice and its unused token 2026-10-05 07:48:17 +02:00
swarm-metrics add swarm-metrics, an agent CLI for the metrics store 2026-10-17 10:10:17 +02:00
swarm-metrics-auth swarm-metrics-auth: remember a failed lookup briefly so a store outage costs one lookup per burst 2026-10-17 23:36:05 +02:00
swarm-nats-auth swarm-nats-auth: answer callout requests concurrently, skip expired ones 2026-10-17 23:36:01 +02:00
swarm-queue-client swarm-builder: refuse a build that waited too long for the slot 2026-10-17 23:30:13 +02:00
swarm-review-classifier retry: share one backon helper for the client secret reads and convert the remaining doubling tables 2026-10-17 12:31:29 +02:00
swarm-secret-client push ci run metrics to victoriametrics, with a grafana board 2026-10-16 20:43:11 +02:00
swarmctl take the agent-create and forge-token responses from swarm-controller-api 2026-10-18 00:14:02 +02:00
.gitignore docs: address review — redundancy proof for Passive, wave-2 split, re-enable Contractions 2026-09-07 11:56:31 +02:00
.mailmap chore(#2165): add damocles@pr1ma + lexis@pr1ma mailmap entries 2026-07-04 13:50:16 +02:00
.prettierignore add swarm-metrics, an agent CLI for the metrics store 2026-10-17 10:10:17 +02:00
.prettierrc temp: add prettier configs 2026-07-02 23:33:11 +02:00
.vale.ini docs: disable write-good.TooWordy -- 100% dictionary mismatch on this corpus 2026-10-04 17:09:58 +02:00
Cargo.lock share the forge and schedule wire types through swarm-controller-api 2026-10-17 23:27:14 +02:00
Cargo.toml share the forge and schedule wire types through swarm-controller-api 2026-10-17 23:27:14 +02:00
CLAUDE.md take the agent-create and forge-token responses from swarm-controller-api 2026-10-18 00:14:02 +02:00
clippy.toml swarm-logs: an agent's CLI for the swarm log store 2026-09-17 01:02:14 +02:00
flake.lock nix flake update 2026-10-17 05:00:49 +02:00
flake.nix victorialogs and victoriametrics: own the package for each auth responder they run 2026-10-17 18:38:25 +02:00
README.md remove c0re.operatorPronouns and c0re.contextWindowTokens 2026-10-17 08:00:14 +02:00

hyperhive

a swarm of coding agents with one control plane: one identity, one forge, one homeserver, one secret store, one UI. agents run caged on whichever host has room. config changes flow as git commits, the operator approves them in a browser, every deploy is a tag. cyberpunk dashboards included. 💜⚡

→ website · → docs · → options reference

A coding agent is great in one window, exponentielle across many — as long as the agents stay off each other's toes, keep a durable identity, and leave production alone. hyperhive is a set of NixOS modules that runs that many-agent setup as a swarm:

  • the swarm is where things live — agent identities and accounts, secrets, the job graph that creates and places agents, telemetry, and the UI you drive it all from.
  • hives are the substrate — NixOS hosts that run agent containers on the swarm's behalf. Add a hive to add capacity.

Start with everything on one box; move services and add hives as the swarm grows. Which host runs what is a per-host deploy.* toggle, not an architecture change.

concern how hyperhive answers it
control plane swarm-controller holds the hive directory, the agent roster and the job graph. Create an agent from the swarm UI or swarmctl agent create --hive <h>: it provisions the SSO identity, forge user and config repo, then deploys the agent onto that hive
identity every agent is a swarm-wide principal — SSO subject, forge user, matrix account, secret-store cert identity — addressable as name@hive.domain
secrets one OpenBao store; the operator places one mTLS identity per host, and everything else — every agent's credentials included — is fetched from the store under an identity rather than copied by hand
shared services one forge, homeserver, SSO, message queue and metrics/logs stack per swarm, each on whichever host you put it
config git: an agent opens a PR on its config repo, an operator merges it on the forge, and the merge deploys
runtime claude --print by default; any ACP agent (e.g. opencode) per agent with services.hyperhive.agent.runtime = "acp"
substrate each hive runs one nixos-container per agent, under an unprivileged daemon with a tiny socket-activated helper for the few root ops
watching the swarm UI (hives, agents with live terminals, jobs, a cross-repo issue report), Grafana over OTEL, and a per-hive dashboard for host-level detail

Shape

the swarm — one of each, each on whichever host you choose
│
├── swarm-controller       hive directory, agent roster, job graph
│   ├── swarm-ui           the operator's UI, served off the gateway on the swarm apex
│   └── swarmctl           its CLI, on the controller's host
├── swarm-authelia         SSO in front of the swarm UI, forge, grafana, …
├── swarm-bao              OpenBao — secrets, a cert identity per agent
├── hive-forge             Forgejo — per-agent accounts, config repos
├── hive-matrix            tuwunel — matrix homeserver, per-agent accounts
├── swarm-nats             message queue (JetStream KV: hive status, …)
├── swarm-otel             telemetry collector, sole holder of upstream creds
├── swarm-victoriametrics  metrics store
├── swarm-victorialogs     log store
├── swarm-grafana          dashboards over both stores
│
└── opt-in, not part of singleHostSwarm
    ├── swarm-ci-runner        Forgejo Actions runner (deploy.ci-runner)
    ├── swarm-snapshot-store   btrfs-receive endpoint for agent snapshots
    └── wg-hive                WireGuard mesh between hives (deploy.wireguard)

the hives — the substrate, as many as you like (deploy.hive-controller.enable)
│
├── hive-c0re      runs the agent containers: lifecycle, broker,
│                  auto-rebuild, the per-hive dashboard; unprivileged
├── hive-priv      root helper, socket-activated, does bind-mounts + nsenter
├── hive-gateway   nginx + dnsmasq on :80/:443, fronts every agent's web UI
├── hivectl        host-level CLI
│
└── agent containers
    ├── h-ruth     manager — privileged MCP surface, configures agents
    └── h-<name>   agent — claude / ACP runtime, MCP tools, web UI

Inside an agent

Every agent is a full NixOS container with its own unix user (passwordless sudo inside the cage) and a durable, self-compacting session. Out of the box it gets:

  • messaging — send / recv to other agents (the operator is on matrix), remind to wake itself, scheduled prompts the operator sets for it at swarm level, and a todo list that forge notifications and other producers feed. → schedules
  • background bash — long-running commands as tracked tasks (run / status / kill), so a build doesn't block the turn. → bash
  • subagents — nested sessions on the agent's own runtime, optionally re-prompted toward a goal over several turns. → subagent
  • forge — its own Forgejo account, the hive-forge CLI, git credentials, and notifications turned into todos. Optional linked accounts on other forges, and GitHub (gh + push) via services.hyperhive.agent.github.enable. → forge · github
  • matrix — its own account(s) on the swarm homeserver, as MCP tools. → matrix
  • knowledge — the swarm's shared internal/knowledge repo, read-only at /knowledge, plus hyperhive's own docs in the container. → knowledge
  • web UI — a per-agent page behind the gateway: live terminal of the turn stream, model / effort switching, cancel, /compact.
  • GUI (opt-in, services.hyperhive.agent.gui.enable) — a Wayland desktop with screenshot / keyboard / mouse tools, viewable over VNC in the web UI.
  • your own tools — any extra MCP server (stdio or http) via services.hyperhive.agent.extraMcpServers, and any NixOS config you'd put on a machine.

Quick start: an all-local swarm

The whole swarm on one box — a hive plus every shared service. Good for a dev box or a single-host deployment; docs/swarm/ covers spreading a swarm across hosts.

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
    hyperhive = {
      url = "git+https://forge.darkest.space/hyperhive/hyperhive";
      inputs.nixpkgs.follows = "nixpkgs"; # see "Overriding nixpkgs"
    };
  };

  outputs = { nixpkgs, hyperhive, ... }: {
    nixosConfigurations.my-host = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
        hyperhive.nixosModules.default # the whole host stack, one import
        {
          services.hyperhive = {
            deploy.singleHostSwarm = true;        # every swarm service on this machine
            deploy.hive-controller.enable = true; # …and a hive to run agents on

            swarm.domain = "hive.example";        # the swarm's DNS domain
            hiveName = "pr1ma";                   # this hive's label in it
            swarm.hives.pr1ma = { };              # the directory: just us
          };

          # ... the rest of your host config
          system.stateVersion = "25.11";
        }
      ];
    };
  };
}

singleHostSwarm turns on everything an all-on-one-box swarm implies: the shared services above, the swarm controller, and /etc/hosts entries so the hive's names resolve on the box itself. claude-code is unfree — hyperhive scopes the allowance to itself, so there's nothing to set.

After nixos-rebuild switch the swarm UI answers on the swarm domain, and the hive brings up the manager agent (ruth). A few steps stay deliberately human — initialising the secret store, giving ruth her store identity, creating your SSO account. Walk through docs/getting-started/setup.md once, top to bottom.

Overriding nixpkgs

hyperhive pins its own nixpkgs so it builds standalone in CI. The follows line above builds it against your host's nixpkgs instead: one evaluation, no version drift. It works as long as your channel is close to the nixos-26.05 hyperhive develops against — drop it if a much older or newer channel breaks in ways hyperhive's CI doesn't catch.

Operating it

  • swarm UI — the day-to-day surface, on the swarm apex behind SSO (admins group): hive roster and status, every agent with its live terminal and wanted state, creating agents, linking external forge and matrix accounts, the job graph, a cross-repo issue report. → docs/swarm/ui.md
  • swarmctl — the swarm's CLI, on the swarm-controller host: create agents and mint their identities, manage SSO users, make forge admins. → reference
  • per-hive — each hive's dashboard (container state, rebuild queue) and hivectl for host-level administration and container shells. → docs/web-ui/ · hivectl

You are an SSO user too: swarmctl user add <you> --group admins, and a first login through authelia creates your forge and matrix accounts; swarmctl forge make-admin <you> promotes the forge one, and the matrix one becomes a homeserver admin within five minutes of that first login.

docs/README.md is the index, grouped by question — pick the page for your task rather than reading front to back. Some common entry points:

Hacking on it

nix develop -c cargo check
nix flake check            # rust + nix + toml fmt, clippy, module-eval tests

# in your host flake:
nix flake update hyperhive
sudo nixos-rebuild switch --flake .#<host>

Conventions (commit style, no #[allow(clippy::…)], the pre-push hook) live in docs/process/conventions.md. Issues + backlog are on the forge.