Status: Superseded by 0024 for the storage layout and memory numbers (2026-11-27). Still valid: one headless typed-array doc core shared by browser, doc workers, compactor and (via ScanBatch/StructIndex) the realtime tier; no JS object per node; change feed via drainChanges(); rejection of JS-object, Yjs and Automerge stores.
src/scene.ts is a render store: primitives in z-order with world coordinates, objects as primitive ranges, no ids, no tree, text stored only as glyph primitives. A product needs a document (stable ids, tree, pages, text content) that the server and MCP can load without WebGL. Scale targets: 682K layers (11M primitives) and 5M flat shapes in one page.
Measured/estimated CPU memory today: ~48 B per primitive + ~12 B per object + ~2 B chunk metadata: website 4,000 pages ~560 MB, 5M shapes ~310 MB.
packages/doc holds one page (used by browsers and doc workers/compactor; the realtime tier uses only its 14 B/node structural index, ADR 0019) as structure-of-arrays columns indexed by a dense Handle (contract: shared/src/doc-api.ts):
Float64Array 8 B, kind/flags 2 B, parent/first/last/next/prev Int32Array 20 B, fractional key in a byte arena ~10 B, x/y/w/h/rotation/opacity/strokeWidth/cornerRadius Float32Array 32 B, fill/stroke Uint32Array 8 B. About 80 B per node, of which ~40 B is doc-only overhead (budget: 48 B).Map<Handle, ...> side tables.Int32Array indexed by counter (ids from one session are dense), ~4 B/node.drainChanges() (dirty bit column + dedup list), never through callbacks per write.Y.Map per node: ~12 props x ~100-150 B per Item ~1.5 KB, ~1 GB / ~7 GB, and history/tombstones grow with every drag.ScanBatch/StructIndex, which share its rule tables) the realtime tier.