Documents all the way down
Most sync engines have several kinds of things: rows and migrations, documents and schemas, data and metadata — each with its own API. datadata has one kind of thing. Everything is a document, and there is one small, referential API for all of them.
Three kinds of documents, one API
Section titled “Three kinds of documents, one API”User documents hold application data. A document has an id, a type, a server-assigned sequence number, and JSON data. You subscribe to it, read it, and update it.
Schemas are documents. The schema for document type task lives at
sys:schema:task and is itself a document of type sys:schema. Creating a
new document type means writing a document — through exactly the same
createDocument/updateDocument calls as everything else. Schemas validate
against a meta-schema, carry their own migration history, and sync to clients
like any other document.
System state is documents. The engine exposes its own state as read-only documents you can subscribe to:
sys:index— every live document in the folder and its type.sys:trash— every soft-deleted document, ready for a restore UI.sys:session— a summary of all currently staged work in a session.sys:stage:<docId>— the full staged detail for one document.
These are synthesized read-models, never written directly — but to a client they’re just documents.
Why this matters
Section titled “Why this matters”The API stays tiny. Subscribe, read, create, update. Learn it once and you can manipulate data, evolve schemas, and introspect the engine. There is no separate admin API, migration tool, or metadata endpoint to learn.
Everything is referential. Documents point at other documents by id —
including schemas (sys:schema:<type>) and staged work (sys:stage:<docId>).
A small set of concepts composes instead of multiplying.
UI and agents get introspection for free. A devtools panel, a “pending changes” sidebar, or an AI agent inspecting its own staged edits all work the same way: subscribe to a system document and render it.
Agents can extend the data model. Because schemas are documents, an AI agent can design a new document type, write its schema, and start creating documents of that type — without any out-of-band tooling.