CRDT State¶
One document per game¶
Chronicle wraps an Automerge document containing the HyperToken state. Stack, Space, and Source do not own independent stores: they read and write portions of the same session. Game-specific state also belongs in that document and is written through game:setState.
Automerge records causality and merges updates from replicas. A remote sync update is a document change, not an instruction to execute a command a second time. The result is observable through state:changed on the Chronicle and state:updated on the Engine.
Mutation boundary¶
Application code should call the asynchronous engine.dispatch(type, payload) API. The TypeScript ActionRegistry handler opens the Chronicle transaction. This single path preserves action history, checkpointing, events, policies, and dispatch error reporting. Direct caller-side session.change() bypasses those lifecycle guarantees.
What convergence does not provide¶
Convergence is a replication property, not a game referee. Concurrent replicas may converge on a state that violates a game's rules, gives an untrusted peer too much authority, or is strategically unfair. Use rule checks, policies, server trust boundaries, and game-specific validation where required.