Expand description
SQL schema setup for Store, FileStore, and the saga log.
objects.db uses a flat schema: run_object_schema defines the
final table set directly in one idempotent CREATE TABLE IF NOT EXISTS
batch. It replaced an 11-step incremental migration chain
(run_forge_v1 … run_forge_v11) — see
docs/specs/SPEC_SCHEMA_FLATTENING_2026_05_19.md. The chain was pure
historical accretion: per-version data dirs mean every new version is
born with a fresh objects.db and ran the whole chain top-to-bottom
anyway, so the intermediate states were never reachable in production.
filestore.db and sagas.db were already single-DDL stores; they keep
their existing schema functions and gain only the user_version
tripwire (check_schema_compat + stamp_version).
Modules§
- object_
schema - The steps of
run_object_schema, one function each, in the order they ran: the generic object tables, typed input history, the flat table batch, the additive column migrations, the blank Bundle seed and the channel migration table. Moved out ofrun_object_schemawithout a change in behaviour. Thedoc comment abovenotes inside the SQL point atOBJECT_SCHEMA_VERSIONinmigrations.rs. - store_
schema - The tables, seed and additive columns of the shared store (
store.db) and the identity store, one function each, forrun_shared_store_schemaandrun_identity_store_schema. Moved out of them without a change in behaviour. The version notes (v4, v6 and so on) that the SQL comments below refer to are in the docs ofSHARED_STORE_SCHEMA_VERSIONandIDENTITY_STORE_SCHEMA_VERSIONinmigrations.rs.
Constants§
- FILESTORE_
SCHEMA_ VERSION user_versionvalue stamped intofilestore.db.- IDENTITY_
STORE_ SCHEMA_ VERSION user_versionstamped into the permanently-global~/.agentmux/shared/identity-store.db(a different file fromstore.db; seerun_identity_store_schema). Independent counter fromSHARED_STORE_SCHEMA_VERSION. What each version (v1 to v11) added: docs/architecture/STORAGE_SCHEMA_VERSION_HISTORY.md, “Identity store”.- OBJECT_
SCHEMA_ VERSION user_versionstamped intoobjects.dbafterrun_object_schema. The flat schema reset the counter to 1 (the pre-flatten chain never setuser_version, so legacy files read 0). Bumped per additive migration;check_schema_compatmakes an older binary refuse a file stamped newer than it. What each version (v1 to v45) added: docs/architecture/STORAGE_SCHEMA_VERSION_HISTORY.md, “Objects store”.- SAGA_
LOG_ SCHEMA_ VERSION user_versionvalue stamped intosagas.db.- SHARED_
STORE_ SCHEMA_ VERSION user_versionstamped into~/.agentmux/shared/store.dbafterrun_shared_store_schema. Versioned independently fromobjects.db. What each version (v1 to v12) added: docs/architecture/STORAGE_SCHEMA_VERSION_HISTORY.md, “Shared store”.
Functions§
- check_
schema_ compat PRAGMA user_versiontripwire (AUDIT_SQLITE_SYSTEMS §8.5): compare the file’suser_versiontocurrentand refuse to open a database written by a NEWER binary. This is the forward-compat safety lock of the channels design (SPEC_DATA_CHANNELS_2026_05_24.md§3.3): within a channel several released AgentMux versions share one data dir, and the lock keeps an older binary from writing into a schema a newer one laid down (as Chrome’s profile-too-new check and Postgres’s catalog version mismatch do).- run_
filestore_ migrations - Initialize the FileStore schema. Creates the wave_file and file_data
tables. Already a flat single-DDL store — unaffected by the
objects.dbflattening. - run_
identity_ store_ schema - Initialize (or re-validate) the
~/.agentmux/shared/identity-store.dbschema: the permanently-global store from docs/specs/SPEC_IDENTITY_STORE_SPLIT_2026_08_17.md, which fixes conversation continuity across a version switch (docs/specs/REPORT_HISTORY_CONTINUITY_ACROSS_VERSION_UPGRADE_2026_08_17.md). - run_
object_ schema - Initialize (or re-validate) the full
objects.dbschema. - run_
saga_ log_ migrations - Initialize the saga durability schema (
saga+saga_steptables and their indexes). Seedocs/specs/SPEC_SAGA_DURABILITY_2026-05-01.md§2.2. Already a flat single-DDL store. - run_
shared_ store_ schema - Initialize (or re-validate) the
~/.agentmux/shared/store.dbschema. - stamp_
version - Stamp the database’s
user_versionPRAGMA tocurrent. Called AFTERrun_*_schemasucceeds, paired with a priorcheck_schema_compatthat gated the migrations on the caller-binary speaking a compatible (or newer) schema version.