Hive

Development

On this page

The binary is a Cargo workspace: one crate per package under crates/, with crates/hive the hive binary itself.

cargo fmt --all --check && cargo clippy --workspace --all-targets -- -D warnings && cargo test --workspace

hive version prints the version the binary was stamped with at build time: the exact semver tag at HEAD, else a pseudo-version such as v0.1.9-0.yyyymmddhhmmss-<12hex> for a build that follows v0.1.8 (+dirty when the tree had uncommitted changes; release.md says which release a build follows), or dev for a build outside a git checkout. The stamp is generated by crates/hive/build.rs, the binary crate's build script, which reruns when .git/HEAD or the checked-out branch's ref moves, and the binary hands it to hive-cli (install_build_info) before any command runs, so hive_cli::version() and revision() read it everywhere in the process while a library's test binary, which installs none, sees dev. The script lives in that leaf crate on purpose: generated in hive-cli, which eighteen crates depend on, it made every landing on the brain's main recompile all 28 workspace crates in the daemon's self-update build (310 s measured), where a HEAD change now recompiles the binary crate and relinks.

The console is a Next.js 16 + Tailwind 4 + shadcn/ui app in web/hub/:

cd web/hub && npm install
npm run dev                                  # http://localhost:3000, talks to the `hive hub` API
hive hub --no-browser --port 8787           # the API (HIVE_HUB_PORT overrides the dev proxy target)
npm run dev:mock                             # or the mock API alone
npm run build                                # the static export, out/, which crates/hive-hub embeds (rust-embed)
npm run check                                # typecheck + lint + build + test

The export web/hub/out/ is a build product and is not committed: cargo builds it. crates/hive-hub/build.rs runs whenever web/hub/src/, web/hub/public/ or one of package.json, package-lock.json, next.config.ts, tsconfig.json, postcss.config.mjs and components.json changed since the last build (the same paths BINARY_INPUTS in crates/hive-runner/src/selfupdate.rs lists, which tell the daemon a landing changed the binary); it runs npm ci when node_modules/ is missing or older than package-lock.json, then npm run build, and a failed console build fails the cargo build rather than shipping a stale bundle. Building hive with a console therefore needs Node.js 22+; without npm on PATH the binary still builds, with a one-page placeholder that says so, and cargo prints a warning; such a build is not cached, so the first build after Node is installed makes the console (server::tests::embedded_export fails on a placeholder, so a verify run needs Node). HIVE_HUB_SKIP_BUILD=1 cargo build skips npm and embeds whatever out/ already holds, for work on the Rust side.

The site, hivefleet.dev

web/site/ is the public site: the landing page and the docs, a second Next.js static export in the console's look that is not part of the binary. It runs the same way as the console (cd web/site && npm install && npm run dev serves http://localhost:3000; npm run check is typecheck + lint + build + test, then check:out, which reads the built pages and fails on a broken link or anchor). It has no sign-in and no account: Hive is a tool you run yourself (ADR-071). At build time it renders this repository's docs/**/*.md under /docs/ and serves the installer, scripts/install.sh, at /install.sh. Its two fonts are committed whole and cut down to Latin and the signs the pages use; every page loads the cut files, and web/site/scripts/subset-fonts.py writes them (its first lines say how).

The guides are docs/how-to/*.md: one page per job, written to be followed from top to bottom. docs/how-to/README.md is the page that lists them, at /docs/how-to/, because a folder's README is the folder's own page. The folder is not called guides: hive migrate --records reads a repository's docs/guides/ as instructions for agents. A new guide needs a line in that README and nothing else: the sidebar lists the guides in the order that page first links them, and Previous and Next under a guide follow it. A guide the page does not link fails a test, and the site's check with it. Any other new file under docs/ gets a page with no change to the site: one that no group of DOC_GROUPS in web/site/src/lib/docs.ts names stands under More.

A picture lives beside the page that shows it, under docs/, and the page names it with a relative path, so it shows on GitHub too. The build copies every PNG, WebP, JPEG, GIF and AVIF picture under docs/ to /docs-media/ and the page shows it from there, sized from the file's own header, so a docs page loads nothing from GitHub. An SVG can carry script, so the site never serves one from its own address: a page shows it from GitHub. A picture no page shows fails a test. The pictures of the console (docs/how-to/images/console-*.webp) are 1440 by 900, taken in the dark theme from the console's mock (cd web/hub && npm run build && npm run serve:out), which serves made-up projects, and saved as WebP. They were taken from a copy of the mock's fixtures with three things changed, and a new picture should keep to them: the owner has a made-up name, the runner is on and a model provider is connected, and the dates are recent.

The search box reads /docs/search.json, which the build writes: for every page its title and headings, and for every section the commands and settings it names and every word of its text but the words of grammar ("the", "of", "how"). Nothing else is left out, so a word the docs hold is always found, and the file grows with the docs; npm run check prints its size. A query is not held to the words of grammar either: "how do I add a machine" looks for "add" and "machine". Titles come first, then headings, then the commands and settings a section names, then its text, where the section most about the words leads. A decision record or a design note comes last among finds of one kind. GUIDE_KEYWORDS in web/site/src/lib/docs.ts and keywords in web/site/src/lib/site.ts hold the words a reader types that a title lacks, such as "quickstart".

.github/workflows/deploy-site.yml deploys on every push to main that touches web/site/, docs/ or scripts/install.sh: it runs npm run check and the installer's own test (scripts/tests/install-test.sh), then vercel pull, vercel build --prod and vercel deploy --prebuilt --prod with the repository secrets VERCEL_ORG_ID, VERCEL_PROJECT_ID and VERCEL_DEPLOY_TOKEN. While one of the three is missing, the checks run, the deploy says it was skipped, and the run ends green. Its last step downloads https://hivefleet.dev/install.sh and compares it with this commit's scripts/install.sh, byte for byte, because the install line hands that address to a shell. An older installer there fails the run: the deploy did not reach the public address. Anything else there, such as a parked domain's page, is a warning on the run and not a failure: pointing the domain is not something a commit can fix, and a red run would only send an agent after it.

The workflow can also be started by hand (gh workflow run deploy-site.yml). Its deploy job does not ask which branch it is on, so by itself it would put a branch on the public address. The repository's production environment is what stops that: it allows deployments from main only (Settings, Environments, production, Deployment branches and tags). A run started on another branch still runs the checks on Linux, then fails at the deploy job with "Branch ... is not allowed to deploy to production due to environment protection rules", and deploys nothing. A copy or a fork of this repository has no such rule until someone sets it.

The same three commands deploy from a checkout, with a Vercel login in place of the token. In web/site of a clean checkout of main that passes npm run check, set VERCEL_ORG_ID and VERCEL_PROJECT_ID to the team's and the project's ids, then run npx vercel pull --yes --environment=production, npx vercel build --prod and npx vercel deploy --prebuilt --prod. What is uploaded is the build's output, not the source. Until VERCEL_DEPLOY_TOKEN is set this is the only way the site changes, and the site shows the docs of the commit that was deployed, not of main.

Going public takes five things. npm run check:live in web/site asks the public internet for each, with no login, and says which are still open. None of them is something a commit can do; they are the owner's steps.

  1. The repository is public. Until it is, every link from the site to GitHub answers 404 for a reader, and the installer cannot download a release. Making a repository public publishes more than its branches, so look through all of it first: every tag, every pull request with the commits it carries, and commits that were force-pushed away, which GitHub goes on serving to anyone who has their id. Squashing a branch removes none of that, and an owner cannot delete a pull request.
  2. A release is published with the four archives and SHA256SUMS (What a release must carry).
  3. The Homebrew tap holds the formula (The Homebrew tap). Without it the Homebrew line of the install page fails.
  4. The three Vercel secrets are set, so that a push deploys (above).
  5. The domain points at the Vercel project (the next paragraph).

The repository has been public since 23 November 2026. It was published as a new repository that holds main from 1 November 2026 on and the release tags, and nothing older. The pull requests #1 to #234 that commit messages on main name were made before that and are not public; the first pull request of the public repository is #235.

npm run check:live -- --site URL looks at another address instead: a preview of a deploy, or this machine while it serves web/site/out.

Putting the domain on the site is the owner's step, done once, and it is done: since 23 November 2026 hivefleet.dev points at the Vercel project and serves the site, and www.hivefleet.dev redirects to it. The records are at the registrar, Hostinger, on its own nameservers (aster.dns-parking.com and helios.dns-parking.com). The steps stay here for the day the site moves to another project, or the domain to another DNS host.

  1. Add the domain to the Vercel project. In Vercel, open the project this workflow deploys to, then Settings, then Domains. Choose Add Existing and enter hivefleet.dev. Vercel offers to add www.hivefleet.dev as well: add it. Keep hivefleet.dev as the name that serves the site, and make www.hivefleet.dev redirect to it (Edit on that row, then Redirect to). Vercel recommends the other direction, but the install line, the canonical addresses and the sitemap all name https://hivefleet.dev.

  2. Set the two records at the DNS host. That is Hostinger today, in the domain's DNS records. The project's Domains page shows the exact values to use:

    Type Name Value
    A @, or blank where the host does not take @ the address the Domains page shows for hivefleet.dev
    CNAME www the target the Domains page shows for www.hivefleet.dev

    Vercel gives each project values of its own. Its documentation, read on 21 November 2026, says that many projects show the address 76.76.21.21, that newer ones can show one such as 216.198.79.1, and that the CNAME target is the project's own, of the form d1d4fc829fe7bc7c.vercel-dns-017.com. So copy what the page shows, the dot at the end of the target included, and not a value from here or from another project. First remove what is already under the same two names. While the domain was parked at Hostinger, that was an A record on the apex (2.57.91.91) and a CNAME that pointed www at hivefleet.dev. Leave no other A record and no AAAA record on the apex: Vercel does not serve IPv6. The nameservers stay as they are. Vercel's own pages for this are adding a domain and the records for an apex domain and www.

  3. Wait until the Domains page shows both names as configured. Vercel then issues the certificate by itself. dig A hivefleet.dev +short and dig CNAME www.hivefleet.dev +short print what the DNS host publishes, to compare with the page.

To see that it worked:

curl -sI https://hivefleet.dev/install.sh               # content-type: text/plain
curl -fsSL https://hivefleet.dev/install.sh | head -2   # the installer's first lines

The first answers with content-type: text/plain, which web/site/vercel.json sets for the installer; a registrar's parking page answers text/html. The second prints #!/bin/sh and # The Hive installer, for macOS and Linux. And the workflow's last step, Check the installer at the public address, stops warning: it prints https://hivefleet.dev/install.sh serves scripts/install.sh of this commit.

The Mac app has its own check, apps/macos/scripts/check.sh (see The Mac app); it is outside the Cargo workspace and the verify command. Popups are panels, not modals (src/components/ui/panel.tsx): every dialog and sheet docks at the right edge under the header without dimming or locking the page, so you can keep reading, scrolling and clicking while you decide; decision and form panels stay open until you close them, read-only sheets close on an outside click, and opening a second top-level panel closes the first (a confirm inside a sheet stacks on it). When a framework record changes in the brain (a guide, skill, workflow, prompt or template), run hive seed export and commit crates/hive-records/seed/bundle.json with it: that file is what a fresh copy seeds from, and hive seed status names the records that drifted (framework_bundle_carries_the_framework checks the file is in export form). The existing mock includes live, idle, dead, legacy, pruned and multi-session roster cases. MOCK_AGENT_RETURN_MS=12000 exercises a returning worker twelve seconds after the first roster read; use a free loopback port via HIVE_HUB_PORT. MOCK_ROSTER_ONLY=1 npm run mock:generate refreshes only the roster fixture rather than unrelated console fixtures.

The hub builds a project's board snapshot (a slim row per post, the tally, the plan gates - a post's body and frontmatter stay in the store and the post route reads them on request) once and shares it between requests until the store rows it reads change or a minute passes; at most three builds run at once. A snapshot past that minute cannot be served again, so a timer drops it: the hub holds the boards the console asked for in the last minute or two, not every project and area ever opened, and an idle hub's heap empties on its own. A row is one fixed array of its 26 values rather than a map - a map of owned keys cost about 3 KB per post over the values, close to 200 MB for a 60k-post organization whose every board the console keeps warm - and it serializes to the same JSON.

To find what a slow planning pass spends its time on, run one against a copy of the store with the slow-statement log on:

mkdir /tmp/probe && cp ~/.hive/hive.sqlite* /tmp/probe/
HIVE_HOME=/tmp/probe HIVE_SQL_SLOW_MS=50 hive daemon --once --dry-run --no-restart 2>&1 | grep '^sql '

HIVE_SQL_SLOW_MS makes every store connection print sql <ms>: <statement> to stderr for each statement that took at least that long; the daemon's tick N took ...; longest: plan 14s, ... line and hive status name the stage, this names the query. The additive DDL in crates/hive-store/src/*_ddl.rs is where an index goes once the query is known: a CREATE INDEX IF NOT EXISTS there is applied the next time a store opens. Two of the indexes are partial (posts_mentioning, posts_asking): SQLite uses a partial index only when the query's own WHERE repeats the index's terms, so the queries in hive-board carry those terms verbatim and a test pins each plan. This is how the pass that took 30-41 s on an 848 MB store was traced to one unindexed join (28 of 45 s in the probe) and brought under 20 s.

crates/hive/                  the binary (registers every command crate)
crates/hive-cli               command registry, context, errors, JSON output
crates/hive-store             SQLite store: schema, additive DDL, records, settings, events, transactions
crates/hive-board             posts, agents, projects, jobs, decide, init, export, remove
crates/hive-tally             board digest, ballot, proposals, queue, amendments, constitution
crates/hive-records           typed records, Markdown import, guide, export, lead time, the seed bundle
crates/hive-tasks             owner tasks, messages, compute requests and caps
crates/hive-goals*            shared project goals and the `hive goal` command
crates/hive-cred*             push credential references, the `hive cred` command and setup
crates/hive-codedelivery      code delivery signals for the tally
crates/hive-bus               in-process event bus, redaction, tail/bridge for other processes
crates/hive-hooks             store hooks (scripts, webhooks) and harness hooks (copilot, claude)
crates/hive-gitenv            git environment scrubbing for child git commands
crates/hive-hand-core         the executor path the brain and the hand share (ADR-070): the hive-hands verbs, process groups and budgets, git helpers, worktree tidy, machine nice/build jobs/hardware, heartbeat clock, lease transport, pairing helpers, a job's local run (clone prep, worker run, cleanup); no brain code
crates/hive-hand              the `hive-hand` binary a machine installs: hive-hand-core alone (scripts/check-hand-deps.sh keeps the brain out)
crates/hive-provider          the model-provider contract (chat, models, status, device/token login) and its registry
crates/hive-provider-copilot  GitHub Copilot (device login); hive-provider-openai every OpenAI-compatible vendor as one Vendor entry each: OpenAI, Azure OpenAI (key or Microsoft device login), OpenRouter, Groq, Mistral, DeepSeek, xAI, Together, Fireworks, Cerebras, GitHub Models (token or GitHub device login), Ollama, LM Studio, vLLM; hive-provider-anthropic Anthropic Claude (Messages API); hive-provider-gemini Google Gemini (generateContent); hive-provider-fake the scripted test provider
crates/hive-harness           the built-in agent harness: the bash-tool loop, limits, deny rules, trajectories, sessions and the `hive harness` verbs
crates/hive-runner            daemon, planner, workers, delivery and review, executors, leads, compute providers, experiments, recovery, hygiene sweep
crates/hive-evolve            the self-improvement loop: fixtures, measure, archive, cycle, reflect, fleet, usage
crates/hive-inspect           status, projects, jobs, agents, events, settings, schema, verify, signers
crates/hive-hub               the HTTP API and SSE the console uses; its build.rs builds and it embeds the console export, web/hub/out
crates/hive-testutil          shared test helpers
web/hub/                       the console (source, mock API; the static export out/ is built by cargo, not committed)
web/site/                      hivefleet.dev: the landing page and the docs (Next.js static export, deployed to Vercel by .github/workflows/deploy-site.yml; not part of the binary)
apps/macos/                    the Mac app: a Swift package (HiveKit decides, the AppKit shell shows), build.sh, check.sh
docs/                          the reference, one file per part (the README's Documentation table lists them)
docs/design/                   design notes for work an ADR still gates (computer-use.md: the desktop-control tool ADR-048 decides; not built)

Diagrams in the docs

A page under docs/ shows how a thing works before it lists the detail: a diagram for a flow or a set of parts. A decision record follows the same rule (see below). A picture of a screen is a file, and The site, hivefleet.dev says where it lives and how the console's pictures are taken.

A diagram is drawn in text. It is a fenced block opened with ```text whose lines are drawn with box-drawing characters. GitHub, the site and the console all show such a block as it was written, so it needs no library and no picture file, and a record in the store can carry one. Neither the site nor the console draws Mermaid: a mermaid block is shown as code.

The rules, which web/site/src/lib/diagram.ts and crates/hive-records/src/diagram.rs both hold:

  • At most 72 characters wide. That is what the console's record panel shows without scrolling sideways.
  • ASCII, the line characters ─ │ ┌ ┐ └ ┘ ├ ┤ ┬ ┴ ┼ and the arrows → ← ↑ ↓. No tab and no other sign: Geist Mono, the font of the site and the console, holds these at one width.
  • Every box is closed, and a line that goes up or down meets a line, a corner or an arrowhead in the same column of the next row. A horizontal line may end at a space, so a label can sit on it: ── merge ──→.
  • Every box and every arrow is true of the code. A diagram the code does not back is removed.
node web/site/scripts/check-diagrams.mjs                 # every diagram under docs/, by file and line
node web/site/scripts/check-diagrams.mjs landing.md      # one page
node web/site/scripts/check-diagrams.mjs --file adr.md   # any Markdown file, such as a decision record before it is filed

The script needs Node 22.18 or later and no npm install. It exits 1 and names the row and the column of what is badly drawn. The same check runs in cargo test (every_diagram_in_the_repositorys_docs_is_well_drawn in hive-records), which is part of this repository's verify command, so it runs where a job's check and the reviewer's check run (The verify command). It also runs in the site's npm test, which npm run check runs before a deploy. The site and the console draw a diagram with its rows closed up (pre.diagram in each stylesheet), and a screen reader is given the word Diagram and the words in it, not the line characters.

A decision record opens with ## At a glance. The owner reads it first and may decide from it alone: the decision asked for as a yes-or-no question, what happens today, what would happen instead, what the owner will notice, the cost and the risk, and how to undo it, each in a sentence, then a diagram of the change. TPL-adr has the shape, and WF-decision and the hive-decision skill ask for it. hive record new adr, hive record amend and hive record draft print a note on stderr when a Draft or Proposed ADR has no such section, has no diagram, still holds the template's example diagram, or has a diagram that is badly drawn. The record is written all the same, and --quiet silences the note. A store that already holds TPL-adr keeps its own text, since hive seed apply writes only the records a store lacks: it takes the new template when the owner adopts a draft of it (hive record adopt TPL-adr) or amends it.

Upgrading from older Hive

A machine that ran an earlier, script-based Hive moves over in three commands:

hive migrate --records --repo . --ref <sha>   # import the last committed Markdown records; the docs/ tree can go afterwards
hive service install                          # replaces the earlier launchd/systemd unit in place
hive hooks install copilot|claude             # replaces the earlier shell hooks

The store schema is additive: new tables are created on first open and schema_version is never bumped.

Share Hive

A copy of Hive is the binary. The framework's records - the operating guide agents read (hive guide), the skills, workflows and prompts, the templates every ADR, plan and constitution is copied from - travel inside it (crates/hive-records/seed/bundle.json, embedded at build; ADR-038). The first hive hub, hive daemon or hive init on a machine writes the records the store lacks under the commons, once; a record already there, whatever its text, is kept. So someone who clones this repository and builds it has a working Hive with no checkout of Hive registered: their projects onboard, their loops seed a constitution from the bundled template, their agents read the same guide.

git clone https://github.com/lamplitlabs/hive.git hive && cd hive
cargo install --path crates/hive --root ~/.hive --locked
hive hub                # add a project, click Keep Hive running - that is the whole setup
hive seed status        # what this build carries against what the store has
hive seed apply         # write what is missing by hand (the hub and the daemon do it on start)

The brain - a registered Hive checkout (hive init PATH --brain) - is for developing Hive itself: with one, the daemon rebuilds from its main (ADR-035) and hive seed export refreshes the bundle from its records so the next build carries them. Without one, Settings → This machine says Installed build and nothing waits.