Metadata-Version: 2.4
Name: hivo
Version: 0.1.0
Classifier: Environment :: Console
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Rust
Classifier: Topic :: Software Development :: Version Control
Summary: Agent-native version control: lanes for every agent, CAS landing, JSON CLI and MCP server
Keywords: vcs,version-control,agents,mcp
License: Apache-2.0
Requires-Python: >=3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# hivo

hivo is a version control system for repositories where most of the writers are AI agents. Each
agent works in its own lane, records checkpoints with its identity attached, and lands on `main`
through a compare-and-swap that is safe to run from many processes at once. Every command prints
JSON, and `hivo mcp` exposes the same operations as MCP tools.

hivo is not compatible with Git and does not try to be. It runs on Linux, macOS and Windows as a
single binary.

## Why

In October 2026 Anthropic reported more than 30,000 changes merged per day into its monorepo, up
from about 2,500 in May, and replaced its Git hosting with a purpose-built system (Scion). OpenAI
did the same for Codex pushes (Pando). Both moved merging to the server and publish `main` with a
single compare-and-swap. The client side still assumes one person per working copy: one index,
one branch checked out, push, fetch and rebase loops, text output.

hivo starts from the agent side:

| Need | Git | hivo |
|---|---|---|
| Parallel agents on one repo | worktrees you create, name and clean up | `lane new`, one call; virtual lanes need no directory at all |
| Two agents editing the same file | found when the second push conflicts | `write_file` names the other lanes working on that path |
| Getting work onto main | fetch, rebase, push, retry on non-fast-forward | `land`: merge and compare-and-swap, retried inside hivo |
| Who wrote a change | author name and email | agent, session, task and model, hashed into the change |
| Machine output | porcelain text | JSON everywhere, errors with stable codes |
| Undo | reflog per ref | `op log` and `op undo` across all refs and lanes |
| Agent integration | shell commands | built-in MCP server |

The design and its sources are in [docs/adr/0001-architecture.md](docs/adr/0001-architecture.md).

## Install

```
cargo install --path crates/hivo
```

Requires Rust 1.91 or newer. Release builds for Linux (x86_64, aarch64), macOS (x86_64,
aarch64) and Windows (x86_64) come from `.github/workflows/release.yml`, each archive with a
SHA-256 checksum next to it.

## Quickstart

```
cd my-project
hivo init                      # existing files become the first change on main
hivo lane new alice            # working dir: .hivo/lanes/alice
hivo lane new bob

cd .hivo/lanes/alice
echo "notes" > notes.md
HIVO_AGENT=alice hivo land -m "add notes"

cd ../bob
HIVO_AGENT=bob hivo land -m "fix parser"   # merges with alice's change automatically
hivo --human log
```

### Virtual lanes

A virtual lane has no working directory. Its uncommitted files live in an overlay, and agents
read and write them through hivo:

```
hivo lane new worker-7 --virtual
echo 'fn main() {}' | hivo file write --lane worker-7 src/main.rs
hivo file ls --lane worker-7 src
hivo grep --lane worker-7 'fn main'
hivo land --lane worker-7 -m "add main"
```

To run a build or tests, `hivo materialize --lane worker-7 /tmp/w7` writes the files out and
`hivo capture --lane worker-7 /tmp/w7` takes the results back. On this machine virtual lanes land
three to five times faster than directory lanes under the same load (see benchmarks).

Inside a lane directory the lane is picked automatically. Elsewhere pass `--lane <name>` or set
`HIVO_LANE`.

If `land` returns `"landed": false` with conflicts, run `hivo sync`. Files that need a decision
get conflict markers; edit them and run `hivo land -m "resolve"`. A lane with unresolved markers
cannot land. To take one side of a file instead of editing it, `hivo restore --from main <path>`
keeps main's version, and `--from <change>` takes it from any change, such as your lane's head
before the sync (see `hivo log <lane>`). `hivo cat --raw main <path>` prints one version as plain
bytes.

A land puts exactly one change on `main`: the merged tree, with the previous `main` as its only
parent, the `-m` message (or the lane head's message) and the lander's provenance. The lane's
checkpoints and `sync main into ...` merges stay out of `main`'s history and out of Git exports;
the change's `lane_head` field points at them for audit (`hivo log <lane_head>`). The output
says `"squashed": true`. `hivo land --no-squash` (MCP: `"squash": false`) instead fast-forwards
`main` to the lane head or adds a merge change, so every lane step becomes part of `main`.

To take back a change that already landed, revert it in a lane and land the result:

```
hivo revert 3f2a9c81d0e4 --lane fix   # new checkpoint with the inverse, message: Revert "<first line>"
hivo land --lane fix
```

The revert is a three-way merge (the change as base, the lane as one side, the change's parent as
the other), so later edits to other lines survive and lines a later change also touched come
back with conflict markers, as after `sync`. A merge change is reverted against its first parent;
the root change has no parent and is refused with `revert_root`. Both the change and its revert
stay in `main`'s history. `hivo op undo` is different: it moves refs back to where they were, which
rewrites `main` for anyone who already has it, so use it for local mistakes and `revert` for
work others may have built on.

## Commands

| Command | What it does |
|---|---|
| `init [--empty]` | Create a repository; import existing files unless `--empty` |
| `lane new <name> [--path P \| --virtual] [--from REF]` | Fork a lane from main, with its own directory or virtual |
| `lane list`, `lane show`, `lane rm <name>` | Inspect and remove lanes |
| `status` | Uncommitted changes in the lane |
| `diff [--from A --to B]` | Unified diff of the lane, or between two changes |
| `checkpoint -m MSG` | Record the lane as a change |
| `land [-m MSG] [--no-squash]` | Checkpoint if needed, then merge into main as one change |
| `sync [-m MSG]` | Merge main into the lane |
| `check` | Run the land policy checks without landing |
| `approve` | Approve the lane's current head as the current agent |
| `revert <change> [-m MSG]` | Add a change to the lane that undoes `<change>`, to land like any other work |
| `restore [--from REF] [PATH...]` | Discard uncommitted edits, or reset only PATHs to their content at REF (a path REF lacks is deleted) |
| `log [START] [-n N]` | History, newest first |
| `show <change>`, `cat [--raw] <change> <path>` | Inspect a change or read a file at it (`--raw`: the bytes, errors as JSON on stderr) |
| `file read/write/rm/ls` | File access through a lane, with uncommitted edits |
| `grep <pattern>` | Regex search over a lane's files |
| `materialize <dir>`, `capture <dir>` | Write a virtual lane to disk and take it back |
| `op log`, `op undo <id>` | Operation log and undo |
| `mcp` | Serve the tools over MCP on stdio |
| `serve --root DIR [--listen ADDR] [--insecure-allow-http] [--run-checks]` | Serve every repository under DIR over HTTP (see [Server](#server)) |
| `serve token create\|list\|revoke --root DIR ...` | Manage the bearer tokens of a served root |
| `serve repo visibility --root DIR --repo R public\|private` | Allow or forbid anonymous reads of a served repository |
| `clone <url> [DIR]` | Copy a server repository's main into a new repository (see [Working with a server](#working-with-a-server)) |
| `remote add <name> <url>`, `remote list`, `remote rm <name>` | Manage remotes |
| `fetch [REMOTE]`, `pull [REMOTE]` | Update `remotes/<remote>/main`; `pull` also fast-forwards local main |
| `land --remote [REMOTE]`, `sync --remote [REMOTE]` | Land on the server's main, or bring it into the lane |
| `repo create <url> [--public] [--description D] [--add-remote [NAME]]` | Create a repository on a server that offers it, such as a hosting service; private unless `--public` |
| `repo visibility public\|private [--remote R \| --url URL]` | Make a server's repository public or private (needs `admin` there) |

Global flags: `-C/--chdir <dir>`, `--human`, `--agent`, `--session`, `--task`, `--model`. The identity
flags can also come from `HIVO_AGENT`, `HIVO_SESSION`, `HIVO_TASK` and `HIVO_MODEL`.

## Land policy

A `hivo.toml` at the repository root turns `land` into a gate, the way required CI checks and
reviews gate a pull request:

```toml
requires_hivo = "0.2"       # optional: oldest hivo that understands this file

[[check]]
name = "test"
run = "cargo test --workspace"
timeout_secs = 900          # optional, default 600

[approvals]
required = 1                # optional, default 0
reviewers = ["reviewer-*"]  # optional; empty means any agent except the author
```

The policy is read from `main`, never from the lane being landed, so a lane cannot loosen its
own gate; a policy change takes effect once it has landed. With a policy on `main`, `land`:

1. refuses with `not_synced` when `main` moved since the lane's base. Run `hivo sync` first, so
   the checks run on exactly what will land;
2. refuses with `approval_required` until enough other agents ran `hivo approve` on the lane's
   current head. Approvals belong to a change: a new checkpoint or a sync needs new approvals,
   and the author of the head cannot approve it (`self_approval`);
3. runs each check through `sh -c` (`cmd /C` on Windows) in the lane's directory, or in a
   temporary copy of a virtual lane, and refuses with `check_failed` and the last lines of
   output when one fails or times out.

`hivo check` runs the checks without landing and shows the approval status. A `hivo.toml` that
does not parse cannot land (`invalid_policy`). Repositories without `hivo.toml` land as before.

`land` decides every refusal it can before it checkpoints uncommitted edits: conflict markers
(`unresolved_conflicts`), an invalid policy, `not_synced`, and `approval_required` when approvals
are required and the lane has uncommitted edits (approvals belong to a change, so checkpoint and
get it approved first). A refused land leaves the edits uncommitted. A failing check still
happens after the checkpoint, since the checks run on what would land.

Unknown keys are rejected, so a misspelled key cannot quietly turn a gate off. That also means
an older hivo cannot read a `hivo.toml` that uses a key added in a later release. When you use
such a key, set `requires_hivo` to the release that introduced it (`major.minor` or
`major.minor.patch`). An older hivo then fails with `policy_needs_newer_hivo`, naming the
version to upgrade to, instead of `invalid_policy`, and does so before looking at the other
keys. Without `requires_hivo`, an unknown key stays `invalid_policy` and the message suggests
adding it. Keep in mind that the policy is read from `main`: once a file that the running hivo
cannot read has landed, every agent needs the newer hivo to land, sync or check.

### Merge rules

Generated files such as lockfiles cannot be merged line by line: two lanes that each add a
dependency to `Cargo.lock` get conflict markers. `[[merge]]` entries tell hivo how to resolve a
file that both `main` and the lane changed:

```toml
[[merge]]
path = "Cargo.lock"                    # first matching rule wins
strategy = "main"                      # main | lane | union
regenerate = "cargo generate-lockfile" # optional, reported back to the agent
```

`path` is `/`-separated. `*` and `?` match within one segment and a `**` segment matches any
number of segments, so `**/*.lock` matches `Cargo.lock` and `web/yarn.lock`, while `docs/*.md`
matches `docs/format.md` but not `docs/adr/0001.md`.

| Strategy | Result |
|---|---|
| `main` | `main`'s version of the file |
| `lane` | the lane's version of the file |
| `union` | line merge; each conflicting hunk becomes `main`'s lines followed by the lane's, without repeated lines |

The strategies name the sides by role instead of "ours" and "theirs" because land and sync use
the two in opposite positions: land merges the lane into `main` (ours = `main`, theirs = lane)
and sync merges `main` into the lane (ours = lane, theirs = `main`). A rule means the same thing
in both.

Rules apply only to files changed on both sides. A file deleted on one side and changed on the
other, or a file that became a directory, still conflicts; a binary file under `union` still
conflicts. Like the checks, rules are read from `main` at merge time, so a lane cannot pick how
its own merge is resolved. Every file a rule resolved is listed in `strategy_merges` of the land
or sync result together with its `regenerate` command; run it in the lane and checkpoint the
output. A file resolved by `union` also appears in `merged`, since its content comes from
both sides. A `hivo.toml` with merge rules but no checks and no required approvals does not gate
land.

## Using hivo with an existing Git repository

hivo can sit in front of a Git checkout: import it, let agents land in hivo, and export every
land to a Git branch that people review as a pull request.

```
hivo init --from-git .
hivo git config --auto-export . --branch agents/main
```

`docs/git.md` walks through it step by step with real output, and
`docs/walkthrough-git.sh` reproduces it against a throwaway repository. hivo never pushes and
never rewrites existing Git commits.

## Using hivo from Claude Code

Register the MCP server once per agent, with the agent's identity in its environment:

```
claude mcp add hivo -e HIVO_AGENT=claude-1 -e HIVO_LANE=claude-1 -- hivo mcp
```

Create the lane first (`hivo lane new claude-1 --virtual`), then the agent gets the tools
`lane_new`, `lane_list`, `lane_remove`, `status`, `diff`, `checkpoint`, `land`, `sync`,
`revert`, `check`, `approve`, `restore`, `log`, `read_file`, `write_file`, `delete_file`, `list_dir`,
`grep`, `materialize`, `capture`, `op_log`, `op_undo`, `set_visibility` (on the server of a
remote, default `origin`) and `create_repo` (a new repository on a server, private unless
`public: true`). Both use the token in `HIVO_TOKEN`; over HTTP `set_visibility` changes the
repository served there and `create_repo` is not offered.

## Server

`hivo serve` hosts every hivo repository under a directory, in two layouts that can be mixed.
A repository directly under the root is served under its directory name, so `/srv/hivo/web`
becomes `http://HOST:7420/repos/web/...`. A directory that is not a repository is an owner, and
the repositories directly inside it are served as `<owner>/<name>`, so `/srv/hivo/alice/web`
becomes `http://HOST:7420/repos/alice/web/...`. Names are ASCII letters, digits, `-`, `_` and
`.`, not starting with `.`; the startup report lists repositories skipped for their name. In
the rest of this section `<repo>` stands for `<name>` or `<owner>/<name>`.

```
hivo serve --root /srv/hivo --listen 127.0.0.1:7420
```

On start it prints one JSON line with the bound address and the served repositories; port 0
picks a free port. The server opens each database in redb's exclusive mode, so while it runs a
local `hivo` command on the same repository fails with `repo_busy`. Stop the server (Ctrl-C) to
work on the repository locally again.

Agents connect with MCP over HTTP at `/repos/<repo>/mcp` and work in virtual lanes on the
server. Every agent needs a token (see [Access control](#access-control)); the token's name is
the agent identity recorded on its changes. `X-Hivo-Session`, `X-Hivo-Task` and `X-Hivo-Model`
headers are recorded as sent:

```
claude mcp add --transport http hivo http://127.0.0.1:7420/repos/web/mcp --header "Authorization: Bearer $HIVO_TOKEN"
```

Over HTTP there is no default lane, so every lane tool needs `lane`. Tools that take a path on the
server's disk are not offered there: `materialize`, `capture`, `git_import`, `git_export`,
directory lanes and `lane_remove` with `delete_dir`.

Every land, from MCP or from the HTTP API, goes through the repository's land queue. The lane's
own work (refusals, checkpoint) runs in parallel; one thread per repository then merges the
queued lands in arrival order and writes the whole batch to disk with one fsync before it
answers anyone. A conflicting land gets its conflict list and the others in the batch still
land. On a repository with a `hivo.toml` gate, each land's checks run on the queue thread when
its turn comes, so lands behind it wait and a lane that a land ahead moved main past gets
`not_synced`.

A check is a shell command from the repository, so the server runs none unless it is started
with `--run-checks`; without it every check is reported with `"skipped": true` and counts as
passed, while approvals, merge rules and `not_synced` still apply. Run checks only where everyone
who may land is trusted to run commands on the server, or run them in CI instead. Either way, a
land that changes `hivo.toml` (adds, edits or removes it) needs the admin role or an approval of
the lane head from another agent; the land role alone gets 403 `forbidden`, so it cannot
rewrite the gate or its commands in one step.

The HTTP API for local repositories and CI, all under `/repos/<repo>/`:

| Endpoint | Purpose |
|---|---|
| `GET refs` | `main` and every lane ref with its change id |
| `POST objects/missing` | `{"ids": [...]}` in, the ids the server lacks out |
| `POST objects` | upload length-prefixed postcard frames of blobs, trees and changes; every id is recomputed and an object whose references are missing is refused |
| `GET objects?ids=a,b` | download objects as frames |
| `POST land` | `{"lane", "base", "head", "message"?, "squash"?}`: land an uploaded head, same result as `hivo land` |
| `GET ops?since=N&limit=M` | op log entries after op N, oldest first |

Errors are the usual `{"error": {"code", "message"}}` body with HTTP 404 for missing things, 409
for refusals that depend on main or the lane (`not_synced`, `check_failed`, `contention`), 422
for requests that cannot succeed as sent (`object_id_mismatch`, `missing_objects`) and 500
otherwise.

A missing, unknown, revoked or expired token gets 401 `unauthenticated`, a token without the
needed role or lane 403 `forbidden`, and an unknown repository 404 `not_found`.

### Access control

Requests authenticate with `Authorization: Bearer <token>`. Tokens are created on the server
machine, while the server runs or not; a running server picks up changes within a second:

```
hivo serve token create --root /srv/hivo --name claude-1 --repo web --role land --lane 'agents/claude-1/*' --expires 30d
hivo serve token list --root /srv/hivo
hivo serve token revoke --root /srv/hivo --id 3f2a9c0d1e7b4a55
hivo serve repo visibility --root /srv/hivo --repo web public
hivo serve token create --root /srv/hivo --name ci --repo alice/web --role read
```

`token create` prints the token once, as `hivo_<id>_<secret>`. The server stores only a BLAKE3
hash of the secret, in `.hivo-auth.redb` under the root (owner-only permissions on Unix), and
compares hashes in constant time. `--owner` defaults to `--agent`/`HIVO_AGENT` of whoever runs
the command. `token revoke --name NAME` revokes every token of that name.

Roles are per repository; `--repo` and `--role` can be repeated, and `--role lane,land` works
too:

| Role | Allows | Includes |
|---|---|---|
| `read` | `refs`, `objects`, `ops`; MCP reading tools (`read_file`, `log`, `diff`, `status`, `check`, ...) | |
| `lane` | uploading objects; `lane_new`, `lane_remove`, `write_file`, `delete_file`, `checkpoint`, `sync`, `revert`, `restore` | `read` |
| `land` | the `land` endpoint and tool | `lane`, `read` |
| `approve` | `approve` | `read` |
| `admin` | `op_undo`, `set_visibility` and `PUT visibility` | everything |

`--lane GLOB` limits the lanes a token may create, change or land (`*` stays within one `/`
segment, `**` crosses segments), so agents sharing a repository cannot touch each other's lanes.
Reading and approving are not limited by lane globs. A request whose `X-Hivo-Agent` header
names anyone but the token's name gets `forbidden`; without the header the token's name is used.

Repositories are private by default: every request needs a token with a role there, and a
private repository answers callers without one exactly like a repository that does not exist.
A public repository can be read anonymously; everything else still needs a token. A bad token is
refused even on a public repository. A token with `admin` in a repository can change its
visibility over HTTP (`hivo repo visibility`, the MCP tool `set_visibility`). Tokens are managed
on the server only, and `hivo serve` does not create repositories over HTTP: `POST /repos`
answers `forbidden`. A hosting service that embeds the hub decides who may create one through
its `Registry` (`hivo_server::registry`).

The server speaks plain HTTP, so tokens are only safe on loopback. It refuses to listen on any
other address with `insecure_listen` unless started with `--insecure-allow-http`. For access from
other machines, keep `--listen 127.0.0.1:7420` and put a reverse proxy that terminates TLS in
front of it (for example `caddy reverse-proxy --from hivo.example.com --to 127.0.0.1:7420`).
The proxy must pass a loopback `Host` header through to `/repos/<repo>/mcp`, because the MCP
transport refuses other host names on a loopback listener to stop DNS rebinding; nginx's
`proxy_pass http://127.0.0.1:7420;` does that by default, Caddy needs
`header_up Host 127.0.0.1:7420`.

## Working with a server

A local repository can clone a served one, land lanes on the server's main and fetch what
others landed. A remote URL takes one of three forms:

- `http(s)://HOST[:PORT]/repos/<name>`
- `http(s)://HOST[:PORT]/repos/<owner>/<name>`
- `http(s)://HOST[:PORT]/<owner>/<name>`, the short form a hosting service shows in the
  browser. The client sends its requests to `/repos/<owner>/<name>/...` on the same host, so one
  URL serves both the repository's web page and `hivo clone`. A path prefix in front works in
  every form (`https://example.com/git/alice/web`).

The remote keeps the URL as given. https goes through rustls with the Mozilla root
certificates, so no system TLS library is needed.

```
hivo clone http://127.0.0.1:7420/repos/web        # creates ./web with remote origin
hivo clone https://hub.example.com/alice/web       # also creates ./web: the name, not the owner
cd web
echo 'fn b() {}' > b.rs
hivo land --remote -m "add b"                      # checkpoint, upload, land in the server queue
hivo fetch                                         # remotes/origin/main = the server's main
hivo pull                                          # also fast-forward local main
hivo sync --remote                                 # pull, then merge main into this lane
```

`clone` checks that the server's repository format and hivo release match this hivo (same
major version, and for 0.x the same minor) and refuses with `incompatible_remote` before it
writes anything. It downloads main's whole history, registers remote `origin`, sets `main` and
`remotes/origin/main`, and creates the root lane on the new directory checked out at main.

Objects are exchanged by id. `fetch` asks the server for the ids it lacks, level by level from
the server's main, and stops at the first object it already has; it reports how many objects,
bytes and requests that took, and never moves local `main`. `land --remote` does the same in the
other direction with `objects/missing`, uploads everything the server lacks in one request and
calls the land endpoint, so the land goes through the server's queue and gate. The lane lands
there as `<agent>/<lane>` (the agent from `HIVO_AGENT`, which with a token is the token's name),
so agents never share a server lane. Without a usable agent name it falls back to
`<client_id>/<lane>`, where `client_id` is a random id each repository gets with its remote.

After a successful remote land the client fetches, fast-forwards local `main` and moves the lane
to the server's new main, updating its files as a local land does. The output is the server's
land result with the local lane name, plus `upload`, `fetch`, `local_main` and `lane_after`. A
conflict comes back as a normal `"landed": false` result with `"next": "sync_and_resolve"`; run
`hivo sync --remote`, resolve the markers and land again.

A clone keeps local `main` equal to an earlier state of the server's main. A local `hivo land`
in a clone makes `main` diverge from the server, and `pull` and `sync --remote` then refuse with
`main_diverged`; land lanes with `--remote` instead.

`HIVO_TOKEN`, when set, is sent as `Authorization: Bearer <token>` on every request (see
[Access control](#access-control)). The server records the token's name as the agent, so
`HIVO_AGENT` must be unset or equal to it. `land --remote` lands under the server lane
`<agent>/<lane>`, so a token created with `--lane '<agent>/*'` lets the agent land from any clone
and keeps it out of every other agent's lanes.

## Embedding the server

`hivo_server::hub::Hub` hosts the repositories of a root directory inside another axum
application, so one process can serve the hivo protocol next to its own pages. `hivo serve` is
a `Hub` with the root's auth store and its own listener.

```rust
use std::sync::Arc;
use hivo_core::{Repo, repo::OpenMode};
use hivo_server::hub::{Hub, HubConfig};
use hivo_server::mcp::McpHosts;

let config = HubConfig {
    mcp_hosts: McpHosts::Only(vec!["hivo.example.com".into()]),
    ..HubConfig::new("/srv/repos")
};
let (hub, _skipped) = Hub::open(config, Arc::new(MyAuthorizer))?;
let app = my_routes().merge(hub.router());          // the protocol under /repos/
let repo = Repo::open_with("/srv/repos/alice/web", OpenMode::Exclusive)?;
hub.insert("alice/web", repo)?;                      // served from now on
let mut lands = hub.subscribe();                     // tokio broadcast of LandEvent
```

- The hub's router owns `/repos/...` only: the HTTP API and MCP at `/repos/<repo>/mcp`. The
  application may serve its own page for a repository at `/<owner>/<name>`, and that URL also
  works with `hivo clone` (the short form under [Working with a server](#working-with-a-server)).
- `Hub::open` serves the repositories it finds under the root, in both layouts. The hub never
  creates or deletes repositories on disk. An application that does creates one with
  `hivo_core` (`Repo::init`, then any first changes), reopens it with `OpenMode::Exclusive` and
  registers it with `insert(name, repo)`, which refuses a name that is invalid or served
  already (`repo_exists`). `remove(name)` stops serving a repository, ends its MCP sessions and
  returns its handle; the land queue stops and the database closes once that handle is dropped,
  after which the application may delete the directory. `list` and `get` show what is served.
- Every request goes through the `Authorizer` the application implements
  (`hivo_server::access::Authorizer`): it gets the repository, the operation, the bearer token
  and all headers, and returns the caller's identity (the agent name recorded on its changes, a
  label for messages, optional lane globs) and roles. No roles, or a repository that is not
  served, answer 404; roles without the operation's role answer 401 to anonymous callers and
  403 to identified ones; the authorizer can also refuse with `Unauthenticated`, `Forbidden` or
  `RepoNotFound` itself. `StoreAuthorizer` is the auth store `hivo serve` uses.
- `subscribe` returns a receiver of `LandEvent`s (repository, lane, agent, `landed`, main
  before and after, message and time) for every land over HTTP or MCP, published once it is on
  disk and before the caller gets its answer.
- The databases are open exclusively, so the application reads repositories (log, files,
  trees, diffs) through `hub.get(name)?.repo`, a shared `Arc<Repo>`, from blocking tasks.
- `McpHosts` sets the `Host` names the MCP endpoint accepts. The default accepts loopback names
  only; behind a reverse proxy that passes the public host on, use `Only([...public names])` or
  `Any`.

A hosting service whose users may not run commands on its machine sets
`HubConfig { checks: CheckMode::Skip, .. }`. A `hivo.toml` check is a shell command taken from
the repository, so with the default `CheckMode::Run` anyone who may land could run commands on
the server. Skipped checks run nothing, count as passed and appear in the land result with
`"skipped": true`; approvals, merge rules and `not_synced` still apply. `hivo serve` keeps
running checks, since its tokens are created by the machine's owner.

## Performance

On one laptop (i7-13700H, NVMe, ext4), 64 agent processes landing concurrently sustain about
200 lands per second with virtual lanes and 36 to 82 with directory lanes, with no lost changes. Method, numbers and current limits are
in [docs/benchmarks.md](docs/benchmarks.md). Through `hivo serve`, whose land queue group commits,
the same 64 agents over MCP on HTTP landed 3.5 times as fast as local virtual lanes on a loaded
machine, with p99 latency close to p50.

`bench/compare.py` runs the same workload through the git, jj and hivo command lines (git
worktrees with `update-ref` compare-and-swap, git clones with fetch, rebase and push, jj clones
with `jj git push`). With 4 agents git worktrees landed faster than hivo directory lanes (76 to
85 against 62 to 75 lands/s over four runs). At 16 agents the order changed between runs, and
from 64 agents up hivo directory lanes landed 2.7 to 10 times as fast as the fastest git
variant, which spends most of its time on rebases that lose the race. jj was the slowest at
every size. The comparison, including where git and jj do better, is in the same document.

## Dogfooding

This repository is developed with hivo itself: agents work in lanes, land through a gate that
runs fmt, clippy and the tests, and every land is exported to Git. `docs/dogfooding.md` lists
what that turned up and how each problem was fixed.

## Status

Working today: local repositories, directory and virtual lanes with early overlap warnings,
checkpoints with provenance, three-way merge with
recorded conflicts, tree-sitter structural merge for Rust, Python, TypeScript, JavaScript and Go
when the line merge conflicts (down to class members, enum variants, struct fields and added Rust
`match` arms), compare-and-swap landing, land policies with required checks and
reviewer approvals, op log with undo, JSON CLI, MCP server, `hivo serve` with a group-committing
land queue and MCP over HTTP, public and private served repositories with bearer tokens, roles
and lane scopes.

Planned: clone, fetch and `land --remote`.

## Layout

```
crates/hivo-core   library: objects, database, lanes, merge, land, op log
crates/hivo        the hivo binary: CLI and MCP server
crates/hivo-server hivo serve: HTTP API, land queue, MCP tools (stdio and HTTP), HTTP client
crates/hivo-bench  multi-process benchmark
bench/             comparison with git and jj (Python driver and raw results)
docs/              architecture decisions and benchmark results
```

## License

Apache-2.0

