HoloSphere
The distributed substrate that every Holons UI reads from and writes to
HoloSphere
HoloSphere is the storage substrate of the Holons ecosystem. It is a JavaScript library that combines H3 geospatial indexing for hierarchical addressing with GunDB for distributed, peer-to-peer storage. Every interface in Harvestβthe web dashboard, the Telegram bot, the CLI, the AI agent, the MCP serverβwrites to and reads from HoloSphere. That shared substrate is what makes the system one source of truth despite having many user-facing surfaces.
This page is the conceptual introduction. For the full API reference, see HoloSphere API Reference below.
The shape of the substrate
HoloSphere is organized around three concepts:
Holons β units identified by an H3 cell (or, in non-geographic use, by any string ID). A holon is a folder; everything else lives inside it.
Lenses β named categories of data within a holon (
tasks,expenses,rea_events,dna_sequence,proposals, β¦). Each lens is independent: writing to one doesn't touch the others.Items β individual records inside a lens, each keyed by its own
id.
holon (H3 cell or string ID)
βββ lens "tasks"
β βββ item "task-abc123"
β βββ item "task-def456"
βββ lens "expenses"
β βββ item "expense-789"
βββ lens "rea_events"
β βββ β¦
βββ lens "dna_sequence"
βββ β¦Every domain in @holons/core is the authority over one or more lensesβTasks owns tasks, Council owns proposals, REA Accounting owns rea_events, and so on. HoloSphere itself is content-agnostic: it doesn't know what's in a lens, only how to store it, propagate it, and validate it against a schema if one is set.
Why H3
H3 is Uber's hierarchical hexagonal geospatial indexing system. It maps any (lat, lng) to a hex cell at any of 16 resolutions, and provides constant-time parent/child/neighbor lookups.
HoloSphere uses H3 because:
Hierarchy is free. A neighborhood holon's parent is a city holon; its children are block-level holons. No bespoke region trees.
Aggregation is natural. "Roll up all environmental readings for this region" maps directly to
cellToChildren()followed bygetAll()on each child.Neighbors are addressable. Adjacent holons can subscribe to each other's lenses without configuring relationships individually.
Stable IDs. Two clients computing the H3 index for the same
(lat, lng, resolution)always get the same cell, so they always end up writing to the same holon.
A holon doesn't have to be geographic. A community, a project, a datasetβanything can be a holon if you give it an ID. H3 is the default addressing scheme, not a requirement.
Why GunDB
GunDB is a decentralized, real-time, peer-to-peer database. HoloSphere uses it because:
No central server. Holons can run on relays, on phones, on Raspberry Pisβthe data finds its way.
Real-time by default. Every read can subscribe; updates propagate to all peers.
Conflict-free for the common case. GunDB's CRDT model handles concurrent writes without bespoke conflict resolution.
Offline-tolerant. A peer that goes offline picks up missed writes when it reconnects.
The trade-off is that GunDB is eventually consistent and not transactional. HoloSphere works with this rather than around it: domains are designed so that "out-of-order writes" produce sensible end states.
Multi-scale operations
The combination of H3 + GunDB lets HoloSphere support operations across scales naturally:
Localized β query one holon, get its own data.
Delocalized / aggregated β query a parent, get a roll-up across children.
Hybrid β subscribe to a holon and propagate computed summaries upward (e.g., "regenerative practices reported per bioregion").
This is what makes federation practical: a network of holons can share data along the H3 hierarchy or along explicit federation edges, with one consistent API.
Lenses, schemas, and validation
A lens can be left untyped or constrained to a JSON Schema:
In strict mode, writes that violate the schema are rejected at the substrate layer. This is what lets domains evolve independently without stepping on each otherβthe tasks schema doesn't know or care what shape expenses is.
Lenses without a schema accept arbitrary JSON. This is the default, and is appropriate for most domain data, which is typed at the @holons/core layer instead.
Identity-aware writes
In the Holons monorepo, raw HoloSphere puts and gets are wrapped by the identity-aware layer in @holons/core/holosphere:
writeWithIdentity(holonId, lens, item, actor)β attaches the writing actor to the record, used for attribution in scoring and federation.canWriteToHolon(holonId, actor)β checks whether an actor has standing to write to a holon (e.g., is a member, is in the right zone).
The MCP server and AI UI both resolve their actor through this layer, so every write is attributable regardless of which interface emitted it.
Federation
Federation is the system that lets two HoloSphere spaces share data while keeping a single source of truth. A space adds another to its federation list; the other space adds the first to its notify list. Reads on federated lenses resolve transparently across the relationship.
Federation supports soul references (lightweight pointers) by default, so propagating data between spaces doesn't duplicate storageβthe original lives in one space, and the federated copy resolves to it on read.
For the full federation model, see Federation.
Installation
In a Holons monorepo deployment, you don't usually instantiate HoloSphere yourselfβ@holons/core/holosphere provides a factory that every UI shares, configured by HOLONS_PEER and HOLONS_APP env vars (see MCP Server).
See also
Federation β cross-space data sharing
Harvest β the monorepo whose interfaces all share one HoloSphere namespace
MCP Server β the MCP layer that exposes the substrate to external agents
API Reference
The remainder of this page is the canonical API reference for the standalone HoloSphere library.
Holonic Architecture
HoloSphere implements holonic architecture in two ways:
1. Spatial Hierarchy
2. Data Organization
Use Cases
Localized structures
Delocalized structures
Hybrid structures
Constructor
Core methods
async getHolon(lat, lng, resolution)β Get H3 index for coordinatesasync put(holon, lens, data)β Store dataasync get(holon, lens, key)β Retrieve specific dataasync getAll(holon, lens)β Retrieve all dataasync delete(holon, lens, key)β Delete specific dataasync deleteAll(holon, lens)β Delete all dataasync setSchema(lens, schema)β Set JSON schema for validationasync getSchema(lens)β Get current schemasubscribe(holon, lens, callback)β Listen for changes
Data validation
In strict mode, writes that don't match the schema are rejected.
Federation API
federate(spaceId1, spaceId2, password1, password2, bidirectional)
Creates a federation relationship between two spaces.
This sets up:
space1.federationincludesspace2space2.notifyincludesspace1
propagate(holon, lens, data, options)
Propagates data to federated spaces.
Or use auto-propagation on every write:
Soul references
When using the default useReferences: true:
Only a lightweight reference is stored in the federated space.
The reference contains the original item's ID and soul path.
On access, the reference is resolved to the original data.
Changes to the original are immediately visible through references.
Single source of truth, no storage duplication.
Federation structure
Message federation
Dependencies
h3-jsβ Uber's H3 geospatial indexinggunβ Decentralized databaseajvβ JSON Schema validationopenaiβ AI capabilities (optional)
License
GPL-3.0-or-later
Last updated
Was this helpful?