Objective
2026 FDA and EMA expectations for AI in safety-critical workflows are explicit: the trail must be explainable, validated, and inspection-ready — you must be able to reconstruct what the algorithm knew and produced at the moment a case was assessed, and prove the record was not altered afterward. This recipe builds exactly that: a hash-chained, encrypted-at-rest immutable table that captures every AI-assisted decision, with a one-query integrity proof.
Step 1: Create the encrypted immutable ledger
IMMUTABLE makes the table append-only and hash-chains every row (tamper-evident by
construction). WITH (ENCRYPTION = 'AES256GCM') encrypts it at rest.
CREATE IMMUTABLE TABLE pv_audit (
case_id TEXT,
drafted_by TEXT, -- which agent / process produced the draft
model_version TEXT, -- exactly which model + version
draft TEXT, -- what it proposed
reviewed_by TEXT, -- the qualified human who approved
decision TEXT -- approved / edited / rejected
) WITH (ENCRYPTION = 'AES256GCM');
The engine refuses
ENCRYPTIONunlessAIDB_IMMUTABLE_MASTER_KEYis set (a hex key of 64+ chars) — there is no random per-process fallback, because that would make the table undecryptable after a restart. Drop theWITH (...)clause for a plain immutable table, which is still append-only and still hash-chained.
Step 2: Record a decision
INSERT INTO pv_audit VALUES (
'US-2026-001',
'pv_case_drafter',
'qwen2.5-coder:7b',
'Patient experienced bilateral leg myalgia 14 days after starting atorvastatin.',
'J. Smith QPPV',
'approved'
);
Step 3: Prove the trail was never altered
VERIFY TABLE pv_audit;
Result:
is_valid | message
---------+-----------------------------------------------------------------------
true | chain verified: 1 record(s) across 1 block(s) (1 open), checksum
| SHA3_256; per-record lineage anchored (tamper-evident); 1 row(s) in
| storage; ...
Why it matters
VERIFY TABLE gives you a cryptographic yes/no on integrity — not a policy promise. Every draft,
the model that produced it, and the human who approved it are anchored in an append-only chain and
encrypted at rest. When an inspector asks "show me how this case was assessed and prove nobody
changed it," the answer is a single query. This is the audit layer under
source-grounded drafting and
duplicate detection.