Skip to content

Persistence

SaveManager · TraceSegmentWriter

Kind Engine infrastructure
Project NextIteration.Persistence/
Exposes save / load; the trace's warm store
Writes saves/{universeId}/tick_{n}.json, saves/{universeId}/trace/*.jsonl
Status designed · Phase 1 (#32)
PLAN §18.3, §13.1, §13.5

Tick-atomic JSON saves, no database. A save happens between ticks, when no phase is in flight, no intents are pending and (later) no oracle call is outstanding. The file is the whole graph — nodes, edges, attributes, components, including rule nodes from Phase 3 — plus the active systems, the world config (which includes ticks_per_day), and later the oracle log. Human-readable, trivially debuggable, "saveVersion": 1 at the root from day one.

saves/{universeId}/tick_500.json
saves/{universeId}/trace/0000000-0001999.jsonl     # warm trace segments + index
saves/{universeId}/assets/…                        # Phase 5b

On load the engine restores the graph and resumes at the saved tick; determinism means the trajectory continues identically (same per-tick digests). The trace's hot buffer rebuilds from the newest warm segments.

Not in the save: the causal trace (its own store sits beside the saves), the ring buffer (rebuilt by keyframes), anything derived.

Later

Save management via the API (list, restore by tick, sessions) moves the files into whichever embedded database the LLM phase chooses, with the same serialisation; the narrator's vector store is decided then (PLAN §13.1). Nothing before Phase 5 needs a database.

History

Phase Change
1 Introduced: JSON saves, trace segments beside them, no database.

See also

Views, snapshots and the ring buffer · Causal trace · Clients, API, engine