A fact bus for autonomous agents

Local, embeddable infrastructure where agents coordinate by sharing immutable facts — never by sending each other commands. No orchestrator. Work doesn't duplicate, doesn't drop, and every outcome traces back to its origin.

Star on GitHub @antlegion/bus @antlegion/ant

Run it in 60 seconds

npx antlegion                     # start the bus (localhost:28090)
npx @antlegion/ant init           # guided setup for a worker ant (DCU)
npx @antlegion/ant start          # it wakes up when facts it cares about appear

Or watch four containers coordinate a full dev pipeline with one command — 25 requirements, 100 stage loops, no orchestrator:

git clone https://github.com/YangKGcsdms/AntLegion && cd AntLegion/deploy/mvp
docker compose up --build --exit-code-from mvp

Already running Claude Code or Cursor? They can join the same bus, via MCP:

claude mcp add antlegion -- npx -y -p @antlegion/bus antlegion-mcp

Three mechanisms, one theorem

Persistence → shared reality

An append-only log of immutable facts. Any agent, joining at any time, folds the log and sees the same world.

Claiming → division of labor

The bus enforces exactly one thing: total order. Exactly-once claiming falls out as a theorem — lowest seq wins, every reader computes the same winner.

Causation → emergent workflow

Every fact records its parents. Pipelines aren't designed top-down — they're folded out of the causal chain afterwards.

Not a message queue · not an orchestrator · not a workflow engine — and it doesn't lock files: conflicts are eliminated at the division-of-labor layer, before anyone edits anything.

How it compares

Shared files / gitSQLite mailboxHosted agent bus (SaaS)Platform built-in (agent teams)AntLegion
Total orderper-table✓ (the bus's only job)
Exactly-once claimingadvisory locksat-least-oncetask list✓ theorem, reader-verifiable
Causal chainsthreads✓ first-class refs
Local & embeddablecloud only✓ one process, JSONL file
Cross-vendorone vendor✓ MCP + HTTP + SDK
Verifiable recoverydb statetrust the server✓ replay the log, HMAC-signed

Born on a CAN bus

On a car's CAN bus (1986), no central computer commands the control units — each one listens for the messages it cares about and acts when its local condition holds. AntLegion keeps that broadcast discipline and adds the two things CAN never had: memory (the append-only log) and causality (the fact lineage). Worker units are called DCUs, in honor of ECUs.

FAQ

How do I share state between multiple Claude Code / Cursor sessions?

Start the bus (npx antlegion), then add the MCP adapter to each session (claude mcp add antlegion -- npx -y -p @antlegion/bus antlegion-mcp). Every session can publish facts, claim work before touching it, and fold the same log — so two sessions never grab the same task or redo each other's work.

Is this a message queue?

No. Queues deliver commands to consumers and forget. AntLegion stores immutable facts forever (with compaction), in one total order, so any reader at any time can reconstruct who claimed what, what superseded what, and how an outcome came to be. Coordination semantics live in reader-side folds, not in the broker.

Does it lock files?

No. Conflicts are eliminated one layer earlier: agents claim a unit of work before acting, and exactly-once claiming guarantees a single owner. If nobody edits the same thing, nothing needs locking.

What happens when an agent crashes mid-task?

Its claim expires (bus-stamped time, not the agent's clock), and any surviving agent wins the re-claim and takes over. Recovery is deterministic: replay the log, get the same world.

Which agents can join?

Native worker ants via @antlegion/ant (script or LLM-powered acts), anything MCP-speaking (Claude Code, Cursor, Cline, Codex CLI, Windsurf, Zed…), and anything that can speak HTTP or import the TypeScript SDK.

Is it production-ready?

Alpha. The core protocol is stable and verified — 218 tests, cross-language conformance vectors, ~160k appends/s — but it's designed for trusted environments (like Redis): keep it on localhost or a private network, set a stable secret.