MeridianDocsSign in
Internals

Data model

Every table in the database, what it holds and how the pieces relate.

All data lives in meridian.db (SQLite) in the data directory. Ids are short, prefixed and URL-safe, such as tsk_7f3k9q2m1x or pol_…. Timestamps are RFC 3339 UTC. Lists and objects are stored as JSON text.

Workspace and people

TableKey columnsNotes
workspacename, slug, brand (JSON), profile (JSON), onboardedOne per install. brand = product name, logo, accent, theme. profile = what the agent knows about the company
usersemail, name, password_hash, role, colorRoles: owner, admin, member, auditor
sessionstoken_hash, user_id, expires_atOnly the token's SHA-256 is stored
invitestoken, email, role, task_ids, accepted_atTasks are assigned when the invite is accepted

Programme

TableKey columnsNotes
frameworks_enabledframework_id, target_dateWhich frameworks are active
milestonesframework_id, ord, title, summary, iconGenerated once per framework
tasksframework_id, milestone_id, key, kind, status, xp, requirement_refs, steps, policy_key, course_key, guidance, agent_prompt, assignee_id, completed_by, moduleThe unit of work. steps is a checklist; requirement_refs links to the framework; module is the register its work belongs in
assetskind, name, owner, attrsInventory: systems, repositories, SaaS, cloud, models, datasets, devices, vendors

Code connections

TableKey columnsNotes
integrationskind (github, gitlab), base_url, account, token_sealed, status, progress, last_scan_attoken_sealed is XChaCha20-Poly1305 ciphertext under secret.key; never returned by the API. progress holds the scan summary
repositoriesintegration_id, full_name, url, private, languages, findings, is_aiOne row per scanned repository; findings = AI components, vendors, data signals

Scan results also land in assets (with attrs.source set), in workspace.profile (systems, ai_role, data_types, code) and in evidence (the inventory document).

Shadow

TableKey columnsNotes
shadow_callsat, intent, provider, model, masked, restored, kept, kinds, detectors, duration_msThe privacy log: one row per model call Meridian made through Shadow. Counts per kind and detector names only, never a value. The newest 5,000 are kept
shadow_huburl, key_sealed, key_prefix, org, status, last_error, last_sync_atAt most one row: the connected Shadow Hub organisation. key_sealed is encrypted like integrations.token_sealed; only the first 12 characters of the key are ever returned
shadow_packssource (hub, meridian), pack, sha256, evidence_id, synced_atEvidence packs as synced, for the Shadow evidence tab. Each is also a file in evidence with the same SHA-256

A sync also writes a tests record per SHD control (source = shadow:SHD-01), links it to the matching controls, and adds the AI services in use to vendors and ai-systems. See Shadow integration.

Records

TableKey columnsNotes
evidencefilename, path, size, mime, sha256, task_id, requirement_refs, review_status, review_noteFiles live in evidence/
policieskey, title, status, version, body_md, requirement_refs, source, ai_status, doc_metaStatus: draft, in_review, published. source: template, ai or imported. ai_status tracks the AI writer. doc_meta holds document control (code, owner and approver roles, classification, review cycle) and import provenance
documentsfolder_id, filename, title, kind, sha256, path, content, text_md, table_json, match_key, suggested_module, status, policy_id, evidence_id, meta, updated_at, updated_byEvery file in the data room. Uploads keep their original in library/ plus extracted text or a table, the template they match and what became of them. Native docs (kind doc, HTML) and sheets (kind sheet, JSON grid) keep their content; text_md is their plain-text copy for search and the AI
foldersparent_id, nameThe data room's folders; names are unique within a folder
acknowledgementspolicy_id, user_id, versionOne per person per policy version
training_progressuser_id, course_key, lesson, score, completed_at, assigned
auditsframework_id, title, status, window
audit_requestsaudit_id, requirement_ref, title, status, responseopen → answered → closed
audit_findingsaudit_id, requirement_ref, severity, textobservation, minor, major
ledgerseq, at, actor_id, kind, summary, payload, prev_hash, hashAppend-only. hash = SHA-256(prev_hash, seq, at, actor, kind, summary, payload)

Registers

One table holds the records of every register module. The module registry (backend/core/src/modules.rs) defines each module's statuses and fields, and the server validates every write against it.

TableColumnsNotes
recordsmodule, seq, ref, title, status, owner_id, props (JSON), framework_refs, body_md, sourceref = module prefix + seq (R-001). source marks generated records (iso27001-2022:A.5.1, repo:acme/x) so regenerating never duplicates them
record_linksa, bUndirected: stored once, with the smaller id in a
commentsrecord_id, user_id, body
groupsname, description, courses, policiescourses and policies are lists of keys members must complete and acknowledge
group_membersgroup_id, user_id
inbox_readsuser_id, last_seqLedger entries after last_seq show as unread

Columns added after a table first shipped are applied at startup by the MIGRATIONS list in db.rs.

Agent and progress

TableKey columnsNotes
threadsuser_id, titleOne conversation each
messagesthread_id, role, blocks (JSON)Blocks: text, card, attachment, tool, action
cardsid, thread_id, message_idIndex from a card id to the message holding it, so answers can update it
xp_eventsuser_id, amount, reason, atLevels and streaks are computed from these
badgesuser_id, key, earned_at

Static content (frameworks, policy templates, courses) isn't stored in the database. It's loaded from content/ at start-up.