Introduction
audience: all
ai on mosaik — self-organization as composition.
This book is about the intersection of AI and self-organization: populations of autonomous agents that coordinate without a central authority, under a distributed runtime whose primitives make such coordination a property of composition rather than a platform favour.
Self-organization
Self-organization in a population of autonomous agents is not a feature a substrate offers. It is what falls out when a sufficiently careful set of primitives composes. A substrate that supplies durable identity, narrow public surfaces with ticket-gated admission, deterministic shared state, evidence-pointed commits, and voluntary opt-in at every bond does not need separate “multi-agent” machinery. The composition does the work.
The thesis inverts the usual design instinct. Rather than enumerate the primitives a substrate must add to host agent populations (a coordinator, a broker, a scheduler, a reputation service), this book reads the other way: begin with a small set of composable distributed-systems primitives and show the agent- population regime as one thing that falls out. No supra-agent authority is added anywhere; none needs to be.
The mechanism, named once: mosaik AI agents
self-organize and converge by agreeing on a shared
policy. The shared policy is the Config.content
of a mediating organism (a reputation organism’s
utility function, a market’s clearing rule, an
attestation fabric’s verification rule, a stigmergic
collection’s write-side contract) or, when TDX is in
the deployment, the runtime policy bound by a declared
TDX Measurements set. Convergence is substrate-
anchored: each agent’s TicketValidator admits the
same fingerprint, and every bond remains voluntary on
both sides.
Balance of power
The stance above is deliberate. A substrate that supplies compulsion at any rung — a coordinator who can force a bond, a basic service whose absence disqualifies a member, a coalition whose membership is mandatory — becomes another concentrated locus of power, which the book treats as a design failure. Buterin’s On balance-of-power as a goal for the 21st century (2025) frames the underlying concern directly: natural diseconomies of scale have receded, and without deliberate design every sector’s power concentrates past the point where checks operate. The coalition layer’s construction is the substrate-level answer in one direction — subsidiarity made mechanical: decisions live at the most local composable rung (one agent, one organism, one coalition), cross-coalition atomicity is refused, and the operator’s exit is always available. The substrate is the game; it is not a player.
Mosaik
The substrate is mosaik — a Rust
distributed runtime originally designed for block-
building committees. Its primitives
(Stream,
Group,
Collection,
TicketValidator) were chosen for
cryptographically admitted committees exchanging
evidence-bearing commits under a shared clock. They
compose cleanly into populations of autonomous agents:
durable per-agent identity, narrow public surfaces
committing agent outputs, deterministic agreement when
a set of agents must reach one commit rather than N,
evidence pointers into upstream commits for replayable
trust composition, and ticket-gated admission at every
bond. Nothing in the runtime is agent-specific; agents
get the same ladder everything else does.
This book does not re-specify mosaik. It composes on
top of the runtime and links out to the mosaik
documentation at docs.mosaik.rs
whenever a primitive is named. Every consensus-
critical value in the coalition layer — coalition
fingerprints, organism ids, module roots, retirement
markers — is a mosaik::UniqueId (a 32-byte blake3
digest). The coalition
crate depends on
mosaik = "0.3" and re-exports that identity type
directly; downstream crates pin the same mosaik
version so every fingerprint the book names flows
through one shared primitive.
The load-bearing pages, for readers coming to this book without a prior mosaik pass:
- Concepts — Architecture and Identity & Networking — how mosaik organises peers, networks, and bonds.
- Subsystems — Streams, Groups, and Collections — the three replicated-data primitives this book’s organisms commit on.
- Subsystems — Discovery and
its Auth Tickets page — how
TicketValidatoradmits bonds and how integrators present tickets. - Subsystems — TEE — Intel TDX — the attestation wrapper the book’s TDX-required deployments bond against.
- Internals — Raft, Bonds & Peer Connections, State Sync & Replay, Determinism & Hashing — the deep-dive pages threat-model and composition chapters reference.
- Reference — Primitives & Types — the canonical type index.
Every chapter below links to the specific page a reader should consult when a primitive is load-bearing; the index above is for readers who want to study mosaik first.
Shuffle
Across this book, shuffle denotes the abstract primitive that takes N sealed submissions from distinct senders and makes their cleartext available to downstream readers in a way that breaks the sender → submission link: through a bonded unseal committee, a mix network, a threshold-decryption quorum, or another construction with the same public surface. Shuffle is what the composition needs; the construction underneath is a choice the operator makes.
Zipnet is one shuffle implementation — one mosaik organism that accepts sealed submissions and releases cleartext through a bonded unseal committee. It is the smallest interesting composition the mosaik runtime admits, and it is the shuffle construction this book’s examples bond against concretely. See the zipnet book for its specification. Other shuffle constructions (cMix-style mix networks, threshold-BLS decryption pools, FHE-backed release) are out of scope for this book but slot into the same shuffle role without changing the compositional surface.
In an agent population, a shuffle is the submission layer for any flow where individual contributions are sensitive and the aggregate is not: sealed prompts, sealed bids, sealed forecasts, sealed attestations. Building on it, one arrives quickly at the full coalition rung this book specifies.
This book
The book has three parts.
Part I — Thesis. The argument is assembled in five chapters.
- Societies — what a production population of agents looks like when coordination is a property of composition, not a central actor.
- AI — the four agent shapes (integrator, standalone organism, organism member, swarm-as-organism) and the four emergent-coordination patterns (stigmergic collections, reputation feedback, coordination markets, attestation fabrics).
- Zero to one — shipping the first organism. A single-agent product, end-to-end.
- One to two — introducing the second organism. The smallest multi-agent protocol: handoff, delegation, two-agent composition.
- Two to three — a quorum. The smallest non-trivial society: three is the minimum for threshold schemes, majority-of-honest committees, and the smallest composite organism whose commits encode disagreement rather than report it.
Part II — Examples. Four parallel end-to-end worked examples, each walked through seven chapters. Each adds one mosaik surface per rung (setup, binding, market reads, wrapping, inference-or-provisioning-or-aggregation-or-signing, submission-or-receipts-or-publication-or-aggregate, reputation-and-successor-chain).
- web3 — an MEV-searcher AI bot built on a
Flashbots-operated instance of the
builder (6e3v) lattice —
the instance named
testnet-1a— inside its own small coalition. Market-maker variants are called out per chapter where the pattern diverges. - web2 — an entity operating a compute-bridge provider, wrapping AWS, GCP, Azure, and bare-metal behind one provider identity and competing with other providers on rate in a coalition’s Compute coordination market.
- oracle — a TDX-attested price oracle shipping
one
Stream<PriceTick>per supported token pair, with the whole trust model anchored on a declared Measurements set. A standalone organism packaged inside its own coalition for retirement and optional audit. - signer — a generic threshold-signature organism. The committee is itself a market of providers at varying attestation levels (software, TDX-local, TDX-remote-attested, RA-TLS bidirectional, TDX + reproducible build) competing on attestation, capacity, and fee per partial signature. Consumers gate admission on the aggregate attestation level each outcome carries. Design inspired by zipnet, inverted from decryption to signing.
See Part II overview.
Part III — For builders. Three chapters that carry the reference material for each audience of implementers.
- For integrators — external developers whose agent binds across members of a coalition.
- For operators — teams running an organism, a multi-operator coalition, or a coalition-scoped module.
- For contributors — engineers commissioning a new composite organism, a new class of mid-rung composition, or a new basic service.
Every chapter declares its primary audience on the
first line (audience: integrators | operators | contributors | ai | both | all)
and respects that audience’s register: pattern-forward
and code-forward for AI authors, cookbook-style for
integrators, runbook register for operators, design-
review density for contributors.
Vocabulary ladder
mosaik primitives Stream, Group, Collection, TicketValidator
composed into
organisms one Config fingerprint, narrow public surface
(AI agents, oracle feeds, attestation fabrics,
composite organisms spanning multiple members, …)
composed into
(optional) lattices a fully-specified mid-rung composition
(block-building, per builder; other classes
may follow their own proposals)
composed into
coalitions N lattices + M organisms under one CoalitionConfig,
possibly shipping up to five basic services and
an optional coalition-scoped ticket issuer
Each rung reuses the rung below verbatim. The universe
(the mosaik NetworkId) is the only bottom rung; every
rung above is optional composition.
Status
Blueprint. No organism or module in this repository is implemented. The specification assumes mosaik’s current primitives, the shuffle’s shipped shape, and the builder proposal’s
LatticeConfig; pinned versions will be called out as crates land.
Prior art
- The builder book specifies the first
concrete lattice class: six organisms composed into
one end-to-end block-building pipeline for one EVM
chain. The coalition rung this book specifies
references builder’s
LatticeConfigverbatim. - The Flashbots essay Decentralized building: wat do? sets the motivating context for why mosaik exists and what the path from centralized to Byzantine-distributed production looks like. This book picks up after the infrastructure question is answered.
For my sons