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
| Table | Key columns | Notes |
|---|---|---|
workspace | name, slug, brand (JSON), profile (JSON), onboarded | One per install. brand = product name, logo, accent, theme. profile = what the agent knows about the company |
users | email, name, password_hash, role, color | Roles: owner, admin, member, auditor |
sessions | token_hash, user_id, expires_at | Only the token's SHA-256 is stored |
invites | token, email, role, task_ids, accepted_at | Tasks are assigned when the invite is accepted |
Programme
| Table | Key columns | Notes |
|---|---|---|
frameworks_enabled | framework_id, target_date | Which frameworks are active |
milestones | framework_id, ord, title, summary, icon | Generated once per framework |
tasks | framework_id, milestone_id, key, kind, status, xp, requirement_refs, steps, policy_key, course_key, guidance, agent_prompt, assignee_id, completed_by, module | The unit of work. steps is a checklist; requirement_refs links to the framework; module is the register its work belongs in |
assets | kind, name, owner, attrs | Inventory: systems, repositories, SaaS, cloud, models, datasets, devices, vendors |
Code connections
| Table | Key columns | Notes |
|---|---|---|
integrations | kind (github, gitlab), base_url, account, token_sealed, status, progress, last_scan_at | token_sealed is XChaCha20-Poly1305 ciphertext under secret.key; never returned by the API. progress holds the scan summary |
repositories | integration_id, full_name, url, private, languages, findings, is_ai | One 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
| Table | Key columns | Notes |
|---|---|---|
shadow_calls | at, intent, provider, model, masked, restored, kept, kinds, detectors, duration_ms | The 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_hub | url, key_sealed, key_prefix, org, status, last_error, last_sync_at | At 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_packs | source (hub, meridian), pack, sha256, evidence_id, synced_at | Evidence 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
| Table | Key columns | Notes |
|---|---|---|
evidence | filename, path, size, mime, sha256, task_id, requirement_refs, review_status, review_note | Files live in evidence/ |
policies | key, title, status, version, body_md, requirement_refs, source, ai_status, doc_meta | Status: 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 |
documents | folder_id, filename, title, kind, sha256, path, content, text_md, table_json, match_key, suggested_module, status, policy_id, evidence_id, meta, updated_at, updated_by | Every 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 |
folders | parent_id, name | The data room's folders; names are unique within a folder |
acknowledgements | policy_id, user_id, version | One per person per policy version |
training_progress | user_id, course_key, lesson, score, completed_at, assigned | |
audits | framework_id, title, status, window | |
audit_requests | audit_id, requirement_ref, title, status, response | open → answered → closed |
audit_findings | audit_id, requirement_ref, severity, text | observation, minor, major |
ledger | seq, at, actor_id, kind, summary, payload, prev_hash, hash | Append-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.
| Table | Columns | Notes |
|---|---|---|
records | module, seq, ref, title, status, owner_id, props (JSON), framework_refs, body_md, source | ref = module prefix + seq (R-001). source marks generated records (iso27001-2022:A.5.1, repo:acme/x) so regenerating never duplicates them |
record_links | a, b | Undirected: stored once, with the smaller id in a |
comments | record_id, user_id, body | |
groups | name, description, courses, policies | courses and policies are lists of keys members must complete and acknowledge |
group_members | group_id, user_id | |
inbox_reads | user_id, last_seq | Ledger 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
| Table | Key columns | Notes |
|---|---|---|
threads | user_id, title | One conversation each |
messages | thread_id, role, blocks (JSON) | Blocks: text, card, attachment, tool, action |
cards | id, thread_id, message_id | Index from a card id to the message holding it, so answers can update it |
xp_events | user_id, amount, reason, at | Levels and streaks are computed from these |
badges | user_id, key, earned_at |
Static content (frameworks, policy templates, courses) isn't stored in the database. It's loaded from content/ at start-up.
