Audience: Platform engineers implementing compliance requirements, compliance officers validating configurations, legal teams interpreting regulatory mandates.
CRITICAL ASSESSOR NOTICE: SWT3 witness anchors are evidence artifacts, not compliance determinations. Each anchor records that a governance-relevant event occurred and preserves its cryptographic fingerprint. The assessor determines whether the evidence satisfies a given control requirement. The protocol does not make pass/fail compliance decisions on behalf of any regulatory body. Substance verification remains the assessor's responsibility.

1. How to Read a Recipe

Each recipe has five parts:

  1. Regulatory requirement -- the specific article or section cite
  2. What the assessor asks -- the question you need to answer
  3. Configuration -- copy-paste TypeScript code blocks, labeled by component (Middleware SDK MCP Tool)
  4. Evidence produced -- which anchors appear in the ledger
  5. What to tell the compliance officer -- plain-language explanation of what the config does and why it satisfies the requirement
Component boundaries: These recipes combine multiple SWT3 components. The middleware CANNOT block tool calls (fire-and-forget by design). Recipes that require blocking use the SDK with strict: true. AI-HITL.1 (human oversight) is an MCP server tool, not a middleware feature. Each recipe clearly labels which component provides which capability.

2. Integration Levels

LevelComponentsWhat It Provides
Level 1: Passive withSWT3(transport) middleware Transport-layer evidence (AI-TOOL.1). Fire-and-forget. Zero code changes.
Level 2: Active SDK Witness class (strict: true) Gatekeeper blocking on failure. Full procedure coverage (drift, HITL, model integrity, RAG).
Level 3: Full Stack Middleware + SDK + MCP server All of the above plus 33 compliance tools, forensic timelines, Verifiable Credentials.

For detailed comparison, see the Architecture Decision Matrix in the Witness Middleware guide.

3. Recipe: EU AI Act High-Risk (Art. 9 + Art. 14)

Regulatory requirement: EU AI Act Article 9 (risk management system with continuous monitoring and mitigation) + Article 14 (human oversight with ability to interrupt)
"How does your system ensure human oversight over AI decisions? Can a human stop the system if it produces an anomalous result?"
Integration Level 2 + MCP Server

SDK Gatekeeper mode blocks inference if the witness anchor cannot be minted:

import { Witness } from "@tenova/swt3-ai";
import OpenAI from "openai";

const witness = new Witness({
  apiKey: process.env.SWT3_API_KEY,
  strict: true,        // Gatekeeper: blocks if anchor cannot be minted
  clearingLevel: 1,
});

// Every inference is witnessed. If the ledger is down, the call is blocked.
const client = witness.wrap(new OpenAI());

Middleware Transport-layer evidence for every tool call:

import { withSWT3 } from "@tenova/swt3-mcp/middleware";

const transport = withSWT3(new StdioServerTransport(), {
  apiKey: process.env.SWT3_API_KEY,
  batchSize: 1,        // Every tool call flushed immediately
  samplingRate: 1.0,   // 100% coverage -- no sampling for high-risk
});

MCP Tool Human oversight witnessing (called by the LLM/agent after human review occurs):

// MCP tool call: witness_human_review
{
  "model_id": "gpt-4o",
  "reviewer_role": "senior_underwriter",
  "outcome": "approved_with_conditions",
  "review_duration_seconds": 120
}

Evidence Produced

What to Tell the Compliance Officer

strict: true means the system literally cannot operate if the witness infrastructure is unavailable. When the gatekeeper detects missing guardrail requirements, it mints an AI-GRD.3 anchor recording the failure and raises a GatekeeperError, halting the inference pipeline. The system is rigidly controlled and cannot operate outside its bounds. This satisfies the active risk management mandate of Article 9.

Combined with AI-HITL.1 anchors from witness_human_review, the evidence proves that human oversight was exercised at the tool boundary with documented reviewer identity, decision outcome, and review latency. The assessor can verify that a qualified human reviewed the output before it was acted upon. This satisfies the human oversight requirement of Article 14.

4. Recipe: GDPR Data Minimization (Art. 5(1)(c) + Art. 25)

Regulatory requirement: GDPR Article 5(1)(c) (data minimization) + Article 25 (data protection by design and by default)
"How do you ensure that your AI observability pipeline does not become a secondary data store for personal data?"
Integration Level 2 + Clearing Level 3

SDK Active governance with maximum metadata stripping:

const witness = new Witness({
  apiKey: process.env.SWT3_API_KEY,
  strict: true,
  clearingLevel: 3,   // Classified: tool names hashed, only numeric factors leave wire
});

Middleware Transport-layer evidence with same clearing level:

const transport = withSWT3(new StdioServerTransport(), {
  apiKey: process.env.SWT3_API_KEY,
  clearingLevel: 3,
  samplingRate: 1.0,
});

Evidence Produced

What to Tell the Compliance Officer

By combining active blocking (strict mode) with clearing level 3, the resulting anchors prove two things simultaneously. First, the system was rigidly controlled and could not operate outside its bounds. Second, raw PII was irreversibly purged from the witness stream the millisecond the call completed. No sensitive prompt data, tool arguments, or response content was ever persisted in the permanent telemetry layer. The cryptographic fingerprint still proves the event occurred and is independently verifiable, but the descriptive content is gone by design. The compliance telemetry stream itself is data-minimized.

Per-tool clearing: The middleware applies a single clearing level to all tool calls. If you need clearing level 2 for database queries (retaining tool identity for audit) and level 3 for everything else (maximum PII stripping), use the SDK's per-call witness methods for the database layer and the middleware for general transport coverage. This allows different clearing levels for different data sensitivity classifications within the same application.

5. Recipe: CMMC AU-2/AU-3 (Audit Event Generation)

Regulatory requirement: CMMC v2.0 AU-2 (audit events) + AU-3 (content of audit records)
"Show me that your AI tools generate audit events with sufficient content for after-the-fact investigation."
Integration Level 1 (Middleware Only)

Middleware This is the simplest recipe. Middleware alone satisfies AU-2/AU-3:

const transport = withSWT3(new StdioServerTransport(), {
  apiKey: process.env.SWT3_API_KEY,
  signingKey: process.env.SWT3_SIGNING_KEY,
  agentId: "claims-processor-v3",
  samplingRate: 1.0,   // Every tool call
  batchSize: 5,        // Small batches for timely evidence
});
await server.connect(transport);

process.on("SIGTERM", async () => {
  await transport.flush();
  process.exit(0);
});

Evidence Produced

What to Tell the Compliance Officer

One line of code, zero tool modifications. The middleware alone generates audit events (AU-2) with six content fields per record (AU-3). The HMAC-SHA256 signature provides non-repudiation: the assessor can verify that the anchor was minted by an authorized system by checking the signature against the registered signing key. No SDK integration or MCP server required.

Lowest effort path: This recipe satisfies CMMC AU-2/AU-3 for the AI tool execution layer with middleware alone. No tool changes. No SDK. Copy, paste, deploy.

6. Recipe: NIST AI RMF MEASURE 2.5 (AI System Monitoring)

Regulatory requirement: NIST AI RMF MEASURE 2.5 (AI systems are monitored for performance, with detection of anomalous behavior and drift)
"How do you continuously monitor your AI system for performance degradation, drift, and anomalous behavior?"
Integration Level 2

SDK Drift detection witnessing after each evaluation cycle:

const witness = new Witness({
  apiKey: process.env.SWT3_API_KEY,
  strict: true,
});

// After each evaluation cycle:
await witness.witnessDrift({
  metricsEvaluated: 12,
  driftedCount: 2,
  driftScore: 0.15,
  detectionMethod: "psi",   // Population Stability Index
  threshold: 0.1,
});

Middleware Transport-layer coverage for tool execution patterns:

const transport = withSWT3(new StdioServerTransport(), {
  apiKey: process.env.SWT3_API_KEY,
  samplingRate: 1.0,
});

Evidence Produced

What to Tell the Compliance Officer

The SDK witnesses drift detection results with quantified methodology (PSI, KL divergence, or custom metrics), configured thresholds, and measured scores. Each drift evaluation produces a cryptographic anchor that proves the monitoring occurred, what was measured, and what the result was. The middleware provides continuous transport-layer coverage for tool execution. Together they provide evidence that the AI system's behavior is continuously tracked against baselines with documented detection methodology.

7. Recipe: SR 11-7 Model Risk Management

Regulatory requirement: Federal Reserve SR 11-7 (comprehensive model risk management for financial institutions)
"Show me the complete lifecycle evidence for this model: what was validated, who validated it, what changed, and what it costs to operate."
Integration Level 3 (Full Stack)

SDK Model integrity and adapter witnessing:

const witness = new Witness({
  apiKey: process.env.SWT3_API_KEY,
  strict: true,
  clearingLevel: 2,   // Sensitive financial data
  signingKey: process.env.SWT3_SIGNING_KEY,
});

// Witness model weight integrity
await witness.witnessModelWeights({
  modelId: "fraud-detector-v4",
  weightsHash: "sha256:abc123...",
  format: "onnx",
  parameterCount: 125_000_000,
});

// Witness active adapter stack
await witness.witnessAdapterStack({
  modelId: "fraud-detector-v4",
  adapters: ["lora-financial-v2", "domain-specific-v1"],
  mergeStrategy: "linear",
});

Middleware Transport-layer evidence with signing:

const transport = withSWT3(new StdioServerTransport(), {
  apiKey: process.env.SWT3_API_KEY,
  clearingLevel: 2,
  samplingRate: 1.0,
  signingKey: process.env.SWT3_SIGNING_KEY,
});

MCP Tools Resource consumption and forensic timeline:

// witness_resource_consumption (AI-COST.1)
{
  "model_id": "fraud-detector-v4",
  "tokens_in": 1500, "tokens_out": 200,
  "api_calls": 1, "cost_cents": 12
}

// reconstruct_timeline -- forensic history on demand
{ "model_id": "fraud-detector-v4", "window_hours": 720 }

Evidence Produced

What to Tell the Compliance Officer

This is the most comprehensive recipe. Model integrity is proven at the weights level (SHA-256 hash verification). Adapter composition is documented with merge strategy. Every tool interaction is witnessed at the transport layer with HMAC-SHA256 signatures. Resource consumption is tracked for cost governance. A forensic timeline can reconstruct any model's complete operational history over any time window. All evidence is produced at clearing level 2, ensuring sensitive financial data context is retained for audit while limiting distribution scope.

8. Building Your Own Recipe

Any regulatory requirement that demands evidence of AI system behavior can be mapped to a recipe. Follow these four steps:

  1. Identify the regulatory article or section. What specifically does it require? Record-keeping? Human oversight? Data minimization? Continuous monitoring?
  2. Does the requirement need blocking? If the system must halt when evidence cannot be produced, use the SDK with strict: true (Level 2). If passive observation is sufficient, use middleware alone (Level 1).
  3. Does it need specific procedure coverage? Check the UCT Registry for the matching procedure. Each procedure maps to specific regulatory requirements across 36 frameworks.
  4. Does it constrain what metadata can leave the system? Set the clearing level: 0 (analytics), 1 (standard), 2 (sensitive), 3 (classified, maximum stripping).
Recipes are additive. The EU AI Act recipe also partially satisfies NIST AI RMF requirements. The CMMC recipe covers NIST 800-53 AU-2/AU-3. Starting with one recipe does not prevent adding another. The anchors accumulate in the same ledger and map to all applicable frameworks simultaneously through the UCT crosswalk engine.

9. Common Questions

"Can I use one recipe for multiple frameworks?"

Yes. Every anchor maps to all applicable frameworks simultaneously through the UCT taxonomy. The EU AI Act recipe's AI-HITL.1 anchors also satisfy NIST AI RMF GOVERN 1.3 (human oversight) and CMMC AU-2 (audit event generation). You do not need separate configurations per framework.

"What if my framework is not listed here?"

Use the four-step process in Section 8. The UCT Registry maps 114 procedures across 36 frameworks. Find the procedure that matches your regulatory requirement, then choose the integration level and clearing level that satisfies the evidence depth needed.

"Do recipes replace assessor judgment?"

No. Recipes produce evidence. The assessor determines whether the evidence satisfies the requirement. The "What to Tell the Compliance Officer" sections provide language to bridge the conversation, but the final determination belongs to the assessor.

"Can I run multiple recipes simultaneously?"

Yes. The middleware runs once at the transport layer. The SDK runs in your application code. MCP tools are called by the LLM/agent as needed. All three can operate simultaneously. All anchors flow to the same ledger.

"What happens if I outgrow a recipe?"

Upgrade the integration level. Start with Level 1 (middleware only) for CMMC AU-2/AU-3. When you need gatekeeper blocking for EU AI Act, add the SDK at Level 2. When you need forensic timelines for SR 11-7, add the MCP server at Level 3. Each level is additive.

10. References