Legion Developer Documentation
Legion is a distributed capability mesh for individual data sovereignty — a cohort of your own devices (your phone, your machines) that discover and invoke each other's capabilities (speech-to-text, an LLM, storage, audio) without routing your data through a big-cloud dependency.
These docs cover the public developer surface: how the system is layered, the exported ABI, and the two SDKs you build against.
Where to start
Architecture
The 4-layer model: L1 mesh → L2 consensus → L3 provider → L4 consumer.
Learn more →L3 — Provider SDK
Write capability-providing modules. Declare provided_caps, implement handlers.
Learn more →L4 — App SDK
Build apps that discover and consume capabilities the cohort advertises.
Learn more →The ABI boundary
The exported legion_* surface and how the L1–L4 boundary is enforced.
Learn more →The two developer layers
You almost always work at exactly one of the top two layers:
- Building an app? You work at L4 (consume capabilities the cohort advertises).
- Providing a capability? You write a module at L3 (declaring provided_capsis advertising them, once your node is certified).
L1 (transport / mesh) and L2 (consensus / membership / identity) are the machinery underneath — internal, not application-facing. You should never need to call into them directly.