- snapshots: checksummed JSON archive of every mind-scoped state table plus identity/personality/config and the event position; stored, downloadable - fork: restore into a new mind with all ids remapped; event references are kept so history before the fork is shared by reference - export/import: same archive; import is hostile-input validated (size, allow-listed tables, row caps, column names, checksum, forced mind_id) - compare: deterministic counts, belief diffs by proposition, personality and config diffs, event mix - replay: Runtime.Step for synchronous drivers; sandbox fork driven one stimulus at a time under a forbidden capability context; recorded model responses via a replaying router; steps labelled exact / approximate / diverged with recorded-vs-replayed digests - experiments: definition (overrides, stimuli, expectations, seed, duration), background run in a disabled subject mind, stored and exportable results - migration 0015, API, UI (Snapshots and Replay tabs, Experiments section, compare page), noemactl snapshots/compare/replay/experiments, docs
50 lines
2.3 KiB
SQL
50 lines
2.3 KiB
SQL
-- Snapshots, forks, replays and experiments (spec §41, §42, §43, §57).
|
|
CREATE TABLE snapshots (
|
|
id uuid PRIMARY KEY,
|
|
mind_id uuid NOT NULL REFERENCES minds(id),
|
|
name text NOT NULL,
|
|
note text NOT NULL DEFAULT '',
|
|
event_seq bigint NOT NULL, -- history position at capture
|
|
checksum text NOT NULL, -- sha256 of the canonical archive
|
|
size_bytes integer NOT NULL,
|
|
counts jsonb NOT NULL DEFAULT '{}'::jsonb,
|
|
archive jsonb NOT NULL,
|
|
created_by text NOT NULL DEFAULT '',
|
|
created_at timestamptz NOT NULL DEFAULT now()
|
|
);
|
|
CREATE INDEX snapshots_mind_idx ON snapshots (mind_id, created_at DESC);
|
|
|
|
CREATE TABLE replays (
|
|
id uuid PRIMARY KEY,
|
|
mind_id uuid NOT NULL REFERENCES minds(id), -- source of the history
|
|
snapshot_id uuid NOT NULL REFERENCES snapshots(id),
|
|
replay_mind_id uuid REFERENCES minds(id), -- sandbox mind the replay ran in
|
|
from_seq bigint NOT NULL,
|
|
to_seq bigint NOT NULL,
|
|
status text NOT NULL DEFAULT 'running' CHECK (status IN ('running','done','failed')),
|
|
summary jsonb NOT NULL DEFAULT '{}'::jsonb, -- {steps, exact, approximate, diverged, llm_live, llm_replayed}
|
|
steps jsonb NOT NULL DEFAULT '[]'::jsonb,
|
|
error text NOT NULL DEFAULT '',
|
|
created_by text NOT NULL DEFAULT '',
|
|
created_at timestamptz NOT NULL DEFAULT now(),
|
|
finished_at timestamptz
|
|
);
|
|
CREATE INDEX replays_mind_idx ON replays (mind_id, created_at DESC);
|
|
|
|
CREATE TABLE experiments (
|
|
id uuid PRIMARY KEY,
|
|
name text NOT NULL,
|
|
hypothesis text NOT NULL DEFAULT '',
|
|
snapshot_id uuid NOT NULL REFERENCES snapshots(id),
|
|
mind_id uuid REFERENCES minds(id), -- subject mind created by the run
|
|
definition jsonb NOT NULL, -- config/personality overrides, stimuli, expected, seed, duration
|
|
status text NOT NULL DEFAULT 'draft' CHECK (status IN ('draft','running','done','failed')),
|
|
results jsonb NOT NULL DEFAULT '{}'::jsonb,
|
|
error text NOT NULL DEFAULT '',
|
|
created_by text NOT NULL DEFAULT '',
|
|
created_at timestamptz NOT NULL DEFAULT now(),
|
|
started_at timestamptz,
|
|
finished_at timestamptz
|
|
);
|
|
CREATE INDEX experiments_created_idx ON experiments (created_at DESC);
|