Document engine
Architecture
How the editor and document engine packages fit together.
Lextrix splits into an editor surface and a document engine. The editor is how users type. The engine is how you store history, sync clients, and review AI edits.
ChangeSet → Document / Handle / Version
↓
Editor (DOM)lextrix-change is the engine core. It does not depend on Postgres, WebSockets, or your auth system. Collaboration protocol lives in lextrix-collab. The reference host that wires Postgres + WebSocket is lextrix-server. AI sits in lextrix-intelligence and only produces proposals.
A few rules that show up everywhere:
- A ChangeSet is a transition; a Document is a value; a Version is history. Editor undo is none of those.
- Concurrent edits use OT. The server picks Version ids and accept order.
- Durable writes go through compare-and-append (
changeId,owner_epoch). - Snapshots are checkpoints, not a second HEAD.
- Presence is ephemeral — it does not become document history.
Deeper ADR material stays on GitHub. Next: Document Model.