Skip to content

System Overview

Each Engine has one game document. Containers and game-specific state share that document; optional peer sync carries Automerge changes between replicas.

flowchart TB
  Examples[examples / CLI / MCP / RL adapters] --> Engine[engine/Engine.ts]
  Engine --> Actions[engine/actions.ts\nTypeScript ActionRegistry]
  Actions --> Chronicle[core/Chronicle.ts\nAutomerge document]
  Chronicle --> Containers[Token / Stack / Space / Source]
  Chronicle --> History[HistoryManager checkpoints]
  Chronicle --> Sync[sync manager]
  Sync --> Network[network transports and servers]
  Chronicle --> Storage[StorageAdapter implementations]
  Browser[core/browser] --> Examples

For Engine-managed state, application code calls engine.dispatch(), TypeScript registry handlers update the game document, and events notify observers. Some examples, such as Cuttle, also use standalone rules behind their adapters.