Skip to main content

State Layer — GoatDB + Orderstamp

The War Room's state runs on the Ofri Wolfus local-first data matrix:

  • GoatDB (@goatdb/goatdb) — an embedded, distributed document database with cryptographically signed (Ed25519) commits, Git-style three-way merges, and absolute offline-first behavior.
  • Orderstamp (@goatdb/orderstamp) — O(1) string-based ordering so project cards can be reordered without rewriting the whole list.

Why browser-only

GoatDB is initialized only in the browser. Docusaurus statically renders pages in Node during npm run build; instantiating GoatDB (which uses WebCrypto and persistent storage) at render time would be incorrect. The state layer is therefore guarded so it never runs during server-side rendering — the War Room mounts it through a client-only effect.

Schema

A single signed schema, war-room-project, models each of the six War Room projects:

const kSchemaProject = {
ns: 'war-room-project',
version: 1,
fields: {
name: {type: 'string', required: true},
domain: {type: 'string', required: true}, // agent domain (frontend, backend, ...)
status: {type: 'string', default: () => 'investigate'},
ghostDraftConfidence: {type: 'number', default: () => 0},
risk: {type: 'string', default: () => 'standard'}, // standard | high
approved: {type: 'boolean', default: () => false},
sort: {type: 'string', required: true}, // orderstamp
},
} as const;

Items live under the repository path /data/war-room. Each is ordered by an orderstamp written to the sort field via start(), end() and between().

Source

  • src/state/schema.ts — the signed GoatDB schema + shared types.
  • src/state/warRoomStore.ts — the browser-only store (open DB, seed, query, reorder, approve).
  • src/state/useWarRoom.ts — the React hook the dashboard consumes.