PRD 19 of 19

Compliance Portal
& Human-in-the-Loop Interface

Web application providing compliance officers, external auditors, data subjects, and domain experts with secure access to the platform's regulatory compliance engine — audit trails, evidence packages, human gate decisions, DSR management, model card governance, and regulatory report generation.

Three Operational Surfaces
Claude App

Operator Cockpit

CLI

Developer Workbench

Internal Portal

Compliance & HITL

Public DSR Portal

Data Subject Self-Service

↓ ↓ ↓ ↓
Compliance Service REST API

10 endpoints · Single enforcement boundary

↓ ↓ ↓ ↓
Data Layer
PostgreSQL

7 Compliance Tables

Qdrant

Process Knowledge

Evidence Store

Ed25519-Signed Packages

Audit Store

Hash-Chain Immutable

Portal Surfaces (10 Components)
Audit Explorer Evidence Packages Gate Decisions DSR Management Incident Console Model Cards Regulatory Reports Compliance Dashboards Knowledge Queue Outcome Views

1. Problem Statement

The Missing Surface

PRD 18 specifies 50 regulatory compliance requirements — human gate decisions, evidence packages, DSR workflows, model card governance, incident management, regulatory reporting — implemented through a compliance service with 10 REST endpoints and 7 database tables. The enforcement engine exists. What doesn't exist is the interface for the humans who aren't the platform operator.

Five categories of people are implicitly promised service by PRD 18's requirements and have no way to receive it:

🏛

Compliance Officers

Triage DSRs within GDPR's 30-day window, approve gate decisions, manage incidents against NY DFS's 72-hour clock, sign off on model reviews

🔍

External Auditors

Scoped, time-limited access to evidence packages, audit chains, gate records, and model cards for working papers

👤

Data Subjects

Self-service for GDPR Articles 15–22: access, erasure, portability, rectification, objection requests

🧑‍💼

Domain Experts

Review extracted knowledge candidates from the Process Knowledge Base — rules, decision trees, SOPs

📊

Stakeholders

Read-only access to BRDs, architecture specs, outcome metrics, and cost reports

Third Face on the Same Engine

The portal reads from and writes to the same compliance service, audit store, evidence packages, model card registry, and DSR router that the App and CLI access through MCP. It is not a separate system — it is a different protocol (HTTP) in front of the same enforcement boundary. App is mobile operator cockpit, CLI is developer workbench, Portal is the compliance surface for everyone else.

2. Architecture Overview

Tech Stack

Following PRD 6 precedent (Memory Dashboard): FastAPI + HTMX + D3.js + Chart.js. Same architectural pattern, extended for additional views.

Two Containers, Two Attack Surfaces

Internal portal — behind Netbird-protected reverse proxy. OIDC authentication against shared IdP with role-based access control.

Public DSR portal — separate container, separate domain, rate-limited, WAF-protected, isolated from internal services. Verified requests push into the internal compliance service queue — no direct database access.

Authentication & Authorization

RoleAccess ScopeWrite Permissions
adminFullUser management, role assignment
compliance_officerAll compliance surfacesGate decisions, DSR resolution, incident notes, model card reviews
auditorScoped by engagement + date rangeNone (read-only + download)
smeProcess knowledge queueApprove/reject/modify knowledge candidates
viewerProject docs, dashboards, reportsNone

3. Key Components

3.1 Audit Explorer

Read-only interface to PRD 18's immutable_audit_events table. Hash-chain verification visible in UI.

  • Session timeline reconstruction (PRD 11 forensic replay)
  • Filters: time range, user, session, event type, classification
  • Event detail view with payload, hash verification status
  • JSONL export for external audit tools

3.2 Evidence Package Library

Interface to PRD 18's evidence_packages table. Ed25519-signed bundles.

  • Signature verification status (valid/invalid/expired)
  • Version history with diff view
  • Download with audit logging (user, timestamp, IP, purpose)
  • Watermarked PDF rendering for auditor downloads

3.3 Gate Decision Workspace

Interface to PRD 18's human_gate_decisions table.

  • Pending gates queue sorted by SLA urgency
  • Evidence presentation panel
  • Approve/deny/escalate with mandatory rationale
  • MFA step-up for confidential/restricted decisions
  • SOX separation-of-duties enforcement
  • Signed receipt generation

3.4 DSR Management

Full lifecycle for GDPR Articles 15–22. Internal form + public self-service.

  • 30-day SLA countdown with escalation alerts
  • Status workflow: received → verified → processing → delivered → closed
  • Filtered evidence package generation per data subject
  • Secure, expiring download link delivery

3.5 Incident Console

NY DFS 72-hour notification workflow via PRD 18's incident_records.

  • Active incidents with countdown timer
  • Investigation notes with timestamped entries
  • Affected session linkage
  • Post-incident report with auto-populated timeline

3.6 Model Card Registry

NAIC/SR 11-7 model governance via PRD 18's model_cards table.

  • Registry: Opus, Sonnet, Haiku, Gemini, nomic-embed-text
  • Third-party risk tier (NY DFS Part 500)
  • Annual review scheduling with NAIC responsible persons
  • Review workflow with sign-off

3.7 Regulatory Report Generation

On-demand regulator-ready artifacts from accumulated evidence.

  • SOX management attestation (REQ-RCA-029)
  • NY DFS Part 500 certification (REQ-RCA-030)
  • EU AI Act conformity declaration (REQ-RCA-031)
  • NAIC adverse action log (REQ-RCA-032)
  • Ed25519 signing, draft → review → approve → deliver

3.8 Compliance Dashboards

Multi-framework scoring from PRD 5 governance MCP tools.

  • ISO 42001, EU AI Act, OWASP Agentic Top 10
  • SOC 2 TSC, ISO 27001 Annex A, GLBA Safeguards
  • Current scores with trend sparklines
  • Gap analysis drill-down, regression alerts

3.9 Process Knowledge Queue

Interface to PRD 14 human verification gate.

  • Pending extracted knowledge: rules, decision trees, SOPs
  • Source attribution and YAML diff viewer
  • Approve/reject/modify with domain expert assignment
  • Batch operations for high-volume review

3.10 Outcome & Economics Views

Rendering PRDs 10, 15, 16 dashboards.

  • Cost per outcome, quality trends, ROI
  • Agent economics by workflow/project
  • Forecasting with confidence intervals
  • Exportable stakeholder summaries

4. Requirements

Portal Infrastructure

REQ-CPL-001 FastAPI web application with HTMX server-rendered views, D3.js/Chart.js visualization, deployed as containerized service.
REQ-CPL-002 OIDC authentication with 5 roles: admin, compliance_officer, auditor, sme, viewer. RBAC on every endpoint.
REQ-CPL-003 Separate public DSR portal: isolated container, separate domain, rate-limited (100 req/min/IP), WAF, CAPTCHA, no direct DB access.
REQ-CPL-004 All endpoints enforce rate limiting, authentication, audit logging, and threat detection per PRDs 11 and 17.
REQ-CPL-005 Portal calls compliance service REST API exclusively. Zero business logic in portal layer.

Audit & Evidence

REQ-CPL-006 Audit explorer with hash-chain verification, session timeline reconstruction, filters, JSONL export.
REQ-CPL-007 Evidence package library with Ed25519 signature verification, version history, diff view, download audit logging.
REQ-CPL-008 Watermarked PDF rendering for auditor downloads. Watermark includes auditor identity, timestamp, engagement scope.

Human Gates

REQ-CPL-009 Gate decision workspace with pending queue, evidence presentation, approve/deny/escalate, MFA step-up for confidential/restricted.
REQ-CPL-010 SOX separation-of-duties: approving identity cannot be triggering identity.
REQ-CPL-011 Signed decision receipts with full evidence snapshot at time of decision.

DSR Management

REQ-CPL-012 DSR intake: access (Art 15), rectification (16), erasure (17), restriction (18), portability (20), objection (21), automated decision review (22).
REQ-CPL-013 30-day SLA countdown with configurable escalation alerts at 7-day, 3-day, and 1-day remaining.
REQ-CPL-014 Status workflow: received → verified → processing → evidence_generated → delivered → closed. Each transition logged.
REQ-CPL-015 Filtered evidence package generation per data subject with secure, expiring download link.

Incident Management

REQ-CPL-016 Incident console with 72-hour notification countdown from Guardian TERMINATE or manual creation.
REQ-CPL-017 Investigation notes with timestamped entries, affected session linkage, notification tracking.
REQ-CPL-018 Post-incident report generation with auto-populated timeline from audit events.

Model Card Governance

REQ-CPL-019 Model card registry: all models with intended use, prohibited uses, validation dates, bias assessments, risk tier.
REQ-CPL-020 Annual review scheduling with named NAIC responsible persons. Reminders at 30-day and 7-day.
REQ-CPL-021 Review workflow: scheduled → evidence assembly → reviewer assignment → decision → sign-off.

Regulatory Reporting

REQ-CPL-022 On-demand SOX management attestation generation (REQ-RCA-029).
REQ-CPL-023 On-demand NY DFS Part 500 certification generation (REQ-RCA-030).
REQ-CPL-024 EU AI Act conformity declaration per high-risk system change (REQ-RCA-031).
REQ-CPL-025 NAIC adverse action log per event (REQ-RCA-032).
REQ-CPL-026 All reports Ed25519-signed with draft → review → approve → sign → deliver workflow.

Compliance Dashboards

REQ-CPL-027 Multi-framework scoring: ISO 42001, EU AI Act, OWASP, SOC 2, ISO 27001, GLBA. Trends.
REQ-CPL-028 Gap analysis drill-down: insufficient controls, remediation tracking, regression alerts.

Process Knowledge

REQ-CPL-029 Verification queue with source attribution, YAML diff, approve/reject/modify, expert assignment.
REQ-CPL-030 Batch review operations for high-volume extraction cycles.

Outcome & Economics

REQ-CPL-031 Outcome measurement views: cost per outcome, quality trends, ROI, agent economics.
REQ-CPL-032 Forecasting views with confidence intervals and exportable stakeholder summaries.

Auditor Access

REQ-CPL-033 Time-boxed auditor accounts scoped to engagement window. Auto-expiration, no renewal.
REQ-CPL-034 Watermarked downloads, access logging on every artifact view, instant revocation.
REQ-CPL-035 Auditor access assumes credential compromise: containment over convenience.

Security

REQ-CPL-036 Internal portal behind Netbird reverse proxy. Public DSR on separately-hardened endpoint with DDoS protection.
REQ-CPL-037 Every endpoint audited to PRD 11 standards. Portal traffic monitored by behavioral analysis.
REQ-CPL-038 PRD 17 A2A gateway patterns applied. CORS, CSP, security headers enforced.
REQ-CPL-039 No portal endpoint writes to immutable_audit_events directly — all through compliance service REST API.

5. Prompt to Build It

Build a compliance portal web application for the agentic AI platform:

1. INFRASTRUCTURE: FastAPI + HTMX + D3.js + Chart.js. Two containers:
   internal portal (Netbird-protected) and public DSR portal (WAF,
   rate-limited, CAPTCHA, isolated). OIDC auth with 5 roles:
   admin, compliance_officer, auditor, sme, viewer.

2. AUDIT EXPLORER: Read-only view of immutable_audit_events with
   hash-chain verification, session timeline reconstruction, filters
   (time/user/session/type/classification), JSONL export.

3. EVIDENCE PACKAGES: Ed25519 signature verification, version history,
   diff view, download with audit logging, watermarked PDF for auditors.

4. GATE DECISIONS: Pending queue, evidence presentation panel,
   approve/deny/escalate with rationale, MFA step-up for
   confidential/restricted, SOX separation-of-duties, signed receipts.

5. DSR MANAGEMENT: GDPR Art 15-22 intake (internal + public),
   30-day SLA countdown with escalation alerts, status workflow
   (received-verified-processing-evidence_generated-delivered-closed),
   filtered evidence package generation, secure delivery.

6. INCIDENTS: 72-hour NY DFS countdown, investigation notes,
   affected session linkage, notification tracking,
   auto-populated post-incident reports.

7. MODEL CARDS: Registry (Opus/Sonnet/Haiku/Gemini/nomic-embed-text),
   NAIC responsible persons, annual review scheduling with reminders,
   review workflow with sign-off.

8. REGULATORY REPORTS: On-demand generation of SOX attestation,
   NY DFS certification, EU AI Act conformity, NAIC adverse action.
   Ed25519 signed, draft-review-approve-sign-deliver workflow.

9. COMPLIANCE DASHBOARDS: ISO 42001, EU AI Act, OWASP, SOC 2,
   ISO 27001, GLBA scoring with trends, gap analysis drill-down.

10. PROCESS KNOWLEDGE: Verification queue for PRD 14 extracted
    knowledge with YAML diff viewer, approve/reject/modify,
    domain expert assignment, batch operations.

11. OUTCOME VIEWS: Cost per outcome, quality trends, ROI,
    agent economics, forecasting with confidence intervals.

Critical constraint: portal calls compliance service REST API only.
Zero business logic in portal. Auditor access assumes credential
compromise: time-boxed, watermarked, scoped, instant-revoke.
Public DSR surface is architecturally separate from internal portal.

6. Design Decisions

Read-Heavy with Narrow Write Paths

The portal is deliberately not a CRUD application. It renders data produced by the compliance engine and captures a small number of specific human decisions. Every write path maps to a PRD 18 requirement that mandates human involvement.

Two Containers over One

The public DSR portal and internal portal share a codebase but deploy as separate containers with separate domains, separate auth flows, and separate network exposure. A compromised public endpoint cannot reach internal compliance surfaces.

HTMX over SPA

Server-rendered partials rather than React/Vue. Smaller attack surface (no client-side state to tamper with), simpler security model (auth is server-side only), faster time to render, and consistency with PRD 6. Compliance interfaces need to be boring, reliable, and auditable.

Auditor Design Assumes Compromise

Time-boxed to engagement window with no renewal mechanism. Downloads watermarked with auditor identity. Every artifact view logged. Revocation is instant and total. Scope is minimum required per engagement.

Portal Does Not Duplicate the Service

The compliance service (PRD 18) owns all business logic. The portal calls the service's REST API. If logic appears in the portal that should be in the service, it migrates to the service. This prevents drift between surfaces.

Separate from the Memory Dashboard

PRD 6 Memory Dashboard is an operator tool. The compliance portal is for non-operators. Distinct applications with distinct auth, access models, and purposes. Mixing them creates access control confusion.

7. Integration Points

PRD 18 — Regulatory Compliance

Primary integration. Portal renders and captures decisions against all 7 compliance tables through compliance service REST API (10 endpoints).

PRD 11 — Runtime Security

Incident triggers from Guardian TERMINATE. Portal traffic monitored by behavioral analysis. Session timeline reconstruction.

PRD 14 — Process Knowledge

Verification queue surfaces extracted knowledge candidates for domain expert review. Approved knowledge enters production.

PRD 5 — Agent Governance

Compliance dashboard scores from governance MCP tools (compliance_dashboard, governance_report, governance_gap_analysis).

PRD 17 — A2A Interoperability

A2A gateway patterns applied to portal HTTP endpoints. Authentication, rate limiting, audit from PRD 17.

PRD 7 — Markdown for Agents

Project documentation rendering uses PRD 7's proxy for clean markdown-to-HTML conversion of BRDs and specs.

8. Phased Delivery

Phase 1 — Defensible Baseline (6–8 weeks)

Authentication and RBAC. Audit explorer with hash-chain verification. Evidence package library with watermarked downloads. Gate decision workspace with SOX separation-of-duties.

Exit criteria: compliance officer can approve a pending gate; auditor can access scoped evidence with watermarked download; audit explorer renders verified timeline.

Phase 2 — Regulatory Operations (4–6 weeks)

DSR management with 30-day SLA. Incident console with 72-hour countdown. Model card registry. Regulatory report generation. Public DSR portal deployment.

Exit criteria: data subject can submit GDPR request through public portal; incident clock fires notifications; all four regulatory report types generate.

Phase 3 — Scaling Beyond Operator (4–6 weeks)

Process knowledge verification queue. Compliance dashboards. Outcome and economics views. Batch operations for high-volume review cycles.

Exit criteria: domain expert can review knowledge batches; compliance dashboards show accurate scores with trends; stakeholders can access reports.

Total: 14–20 weeks

Each phase is independently valuable and deployable. Phase 1 gets you defensible within two months. The full portal is 4–5 months. Build in parallel with the existing App + CLI + VPS stack.