Architecture Note · Security & Compliance
Regulatory & SOP Diff Watchdog: Redlined Clause Diffs and Tamper-Evident Sign-Offs
Why generic AI regulatory summaries fail audit scrutiny—and how clause-level SOP redlines, append-only SQLite triggers, and HMAC-SHA256 evidence exports fix compliance drift.
The Operational Problem: Unmapped Rule Updates and Missing Sign-Off Trails
Compliance officers at wealth dealers, upstream energy operators, and tax practices continuously reconcile incoming regulatory bulletins against internal Standard Operating Procedures (SOPs). A single change—such as CIRO lowering single-issuer concentration thresholds from 25% to 15% with a 5 business day suitability reassessment window, or Alberta AER shifting sour-gas Optical Gas Imaging surveys from annual to semi-annual—impacts specific SOP sections, process owners, and statutory deadlines. Tracking these deltas in ad-hoc spreadsheets leaves auditors asking which exact paragraph changed, who reviewed it, and why an item was marked inapplicable.
Why Naive AI Summaries Fail Compliance Teams
Pasting regulatory PDFs and internal policy manuals into a generic chat wrapper creates three structural risks:
- Paraphrased obligations without redlines: Summarizing a bulletin in prose hides exact numerical threshold changes—such as compressing client statement archival from
45to30 calendar days—making side-by-side policy verification impossible without manual re-reading. - Silent egress of proprietary manuals: Internal SOP manuals document control gaps, escalation paths, and security boundaries. Uploading raw manuals to public endpoints exposes operational blueprints outside the corporate perimeter.
- Mutable decisions with zero cryptographic proof: A chat transcript has no tamper-evident linkage between the regulatory excerpt, the impacted SOP section, the compliance officer’s rationale, and a verifiable hash chain for examiners.
The Deterministic Architecture That Fixes It
The Regulatory & SOP Diff Watchdog isolates diff analysis inside a single-tenant boundary and replaces unverified prose with deterministic redlines, forced human justification, and append-only storage.
- Deterministic clause-level diffing with offline fallback: The backend parses regulatory bulletins (
.txt,.md,.pdf, or pasted text) alongside internal SOP sections. By default (LLM_MODE=offline), a deterministicdifflibplus Canadian regulatory keyword, deadline, and severity classifier computes word-level removals and additions (del/inssegments) without external API calls, while optionally supporting private OpenAI-compatible endpoints inside the network. - Mandatory human sign-off and non-applicability guards: Every clause enters
Pendingstatus and cannot be exported as resolved without explicit compliance officer action viaPOST /api/assessments/{id}/signoff. Marking a clauseNot Applicablefails closed with HTTP422unless a written review rationale is supplied, and duplicate sign-offs return HTTP409. - Database-enforced immutability and 1-hour document wipe: In SQLite, the
signoffstable enforcesBEFORE UPDATEandBEFORE DELETEtriggers (RAISE(ABORT, ...)) so logged decisions cannot be altered retroactively. Simultaneously, a background sweep and opportunistic request check enforceDOC_TTL_SECONDS=3600—storing uploads with0600permissions inside an isolated0700directory, deleting expired files from disk, and scrubbing raw bulletin and SOP text while retaining hashed audit metadata. - Chained SHA-256, scoped invite tokens, and HMAC-signed auditor packs: Access relies on SHA-256 hashed, time-boxed invite tokens with per-token sliding-window rate limits (
429+Retry-After). Every sign-off appends a sequential SHA-256 hash chain linking timestamp, clause ID, SOP section, severity, officer identity, and note. Exports generate structured JSON bundles carrying bothpayload_sha256andhmac_sha256signatures, plus CSV and printable escaped HTML packs under strictContent-Security-Policy: default-src 'self'headers with safe DOM node creation and zero raw-HTML injection.
Operational Takeaway
Regulatory change management is a verification and custody problem, not a text-generation problem. When clause diffs render exact redlines across CIRO, AER, and CRA/CPA bulletins, database triggers lock every officer decision, raw uploads self-purge in one hour, and exports carry HMAC-SHA256 integrity proofs, compliance teams gain speed while maintaining audit defensibility—retaining full responsibility for legal and regulatory interpretation.