Skip to content

Reference

Schema

User-relevant tables in memory.db — what they store and when they're written.

memory.db is a single SQLite file that holds every page, link, embedding, and audit row. The schema lives in src/schema.sql and is embedded into the binary via include_str!(). This page documents the user-relevant tables — internal scaffolding (test guards, watcher state, IPC heartbeats) is excluded.

The current schema version is 6, recorded as config.version and quaid_config.schema_version. Both quaid validate and the runtime open path verify it on every load.

The core content table. One row per page, regardless of which collection it lives in.

ColumnTypeNotes
idINTEGER PK
collection_idINTEGER FKReferences collections(id). Default 1 is the auto-created default collection.
slugTEXTUnique per (collection_id, slug).
uuidTEXT (nullable)Stable identifier across renames; populated by the UUID lifecycle.
typeTEXTOne of the values listed in Page types.
titleTEXTDisplay title from frontmatter.
summaryTEXTShort summary (rendered in lists).
compiled_truthTEXTThe “above the line” canonical body.
timelineTEXTThe “below the line” append-only timeline.
frontmatterJSON TEXTWhole frontmatter blob (including extension fields).
wing / roomTEXTMemory-palace classification (derived).
versionINTEGERBumps on every write; used for OCC.
quarantined_atTEXT (nullable)Soft-delete timestamp. Quarantined pages are hidden from FTS5 via triggers.
created_at / updated_atTEXTISO-8601 timestamps.

FTS5 virtual table indexing (title, slug, compiled_truth, timeline). Tokenizer: porter unicode61. Synchronized to pages via pages_ai / pages_ad / pages_au triggers; quarantined rows are excluded.

Structured timeline rows used by quaid timeline-add. Unique per (page_id, date, summary_hash) to make ingestion idempotent.

ColumnType
idINTEGER PK
page_idFK → pages(id)
dateTEXT (ISO-8601)
sourceTEXT
summaryTEXT
summary_hashTEXT (SHA-256 of summary)
detailTEXT

Registry of every model ever active. Exactly one row has active = 1, enforced by a partial unique index.

ColumnTypeNotes
nameTEXT PKE.g. BAAI/bge-small-en-v1.5.
dimensionsINTEGERVector width.
vec_tableTEXTThe dynamically created vec0 table (page_embeddings_vec_384, _768, …).
activeINTEGEROne row may be 1.

sqlite-vec virtual table holding the actual vectors. One per dimension you’ve used. Created on demand by db.rs.

Chunk metadata joining vec rowids back to pages.

ColumnTypeNotes
idINTEGER PK
page_idFK → pages(id)
modelTEXTFK → embedding_models(name).
vec_rowidINTEGERJoins to the vec0 table.
chunk_typeTEXTtruth_section or timeline_entry.
chunk_indexINTEGERPosition within the page.
chunk_textTEXTThe content that was embedded.
content_hashTEXTSHA-256, used for stale detection by quaid embed --stale.
token_countINTEGERPre-tokenized count.
heading_pathTEXTBreadcrumb of headings preceding the chunk.

Typed temporal cross-references.

ColumnTypeNotes
idINTEGER PK
from_page_id / to_page_idFK → pages(id)
relationshipTEXTE.g. mentions, supersedes, manages. Free-form.
contextTEXTOptional context string.
source_kindTEXTwiki_link (parsed from markdown) or programmatic (memory_link etc.).
valid_from / valid_untilTEXT (nullable)Open intervals encode “still active”.
created_atTEXT

Subject-predicate-object triples used by memory_check for contradiction detection.

ColumnType
idINTEGER PK
page_idFK
subject / predicate / objectTEXT
valid_from / valid_untilTEXT (nullable)
supersedes_idFK → assertions(id)
confidenceREAL
asserted_byTEXT — one of agent, manual, import, enrichment
evidence_textTEXT

Page tags. Unique per (page_id, tag).

API responses or raw enrichment payloads attached to a page. One active row per (page_id, source).

Original byte-exact contents of imported files. Used by quaid export --raw to round-trip through the database without lossy normalization.

Per-file SHA-256 audit trail for quaid import / quaid ingest idempotency. Re-running on the same source content is a no-op unless --force is supplied.

Stat-based change detection for the file watcher. One row per (collection_id, relative_path).

Materialized contradictions detected by memory_check. Cleared on resolution.

Privacy-safe gap log. The default behavior is to store only query_hash (SHA-256 of the original query); query_text is populated post-approval and only when sensitivity permits. See Sensitivity contract.

ColumnTypeNotes
query_hashTEXTAlways populated.
query_textTEXT (nullable)Only after explicit approval.
sensitivityTEXTinternal / external / redacted.
approved_by / approved_atTEXTRequired when sensitivity ≠ internal or query_text is set.
redacted_queryTEXTSanitized form, when sensitivity is redacted.
resolved_at / resolved_by_slugTEXTSet when a page resolves the gap.

Named vault roots. State is one of active, detached, or restoring. Multiple ignore-pattern, watcher-release, and reconcile-halt flags coordinate the file-watcher and reconciler.

Lease-based ownership. One MCP serve process leases each collection; collection_owners records the lease, serve_sessions carries heartbeats. Stale leases are reaped on next start.

History of quarantine exports — one row per (page_id, quarantined_at) event.

Immutable model and schema metadata, validated on every open. See Configuration.

Mutable runtime defaults editable via quaid config.