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.