Skip to content

Cryptographic Governance Audit Trail

Wrap agent tool calls with middleware that validates policy before execution and signs each action receipt with a post-quantum signature, forming a tamper-evident audit chain.

The compliance gap

An agent that logs tool calls to a writable file gives no proof the log was not altered after the fact. The nibzard catalog notes that conventional logs already carry compliance weight under SOC 2 and EU AI Act Article 12. What they lack is tamper evidence and resistance to after-the-fact repudiation, which cryptographic signing adds.

A cryptographic audit trail closes this gap. Each action produces a signed receipt, and receipts are hash-chained, so verification detects a modified or omitted interior entry. A truncated tail needs a separate check, covered below.

Architecture: three-phase middleware

Middleware wraps the agent's tool-calling interface. Every tool invocation passes through three sequential phases (nibzard catalog):

graph TD
    A[Tool Call Request] --> B[Phase 1: Policy Validation]
    B -->|Policy rejected| C[Reject + Sign Denial Receipt]
    B -->|Policy approved| D[Phase 2: Tool Execution]
    D --> E[Phase 3: Receipt Signing]
    E --> F[Append to Audit Chain]
    C --> F
Phase Action
Policy validation Check allowed tools, rate limits, data access rules before executing
Tool execution Run the tool normally — no change to tool behavior
Receipt signing Sign the action record (tool name, parameters, result hash, timestamp, policy outcome) with ML-DSA-65 and append to the chain

The receipts form an append-only chain that is tamper-evident by construction (nibzard catalog). The asqav verifier recomputes each receipt's chain_hash locally as a SHA-256 over the canonical payload (asqav-sdk). Modifying or omitting an interior entry breaks the chain, and verification fails.

Truncation at the tail is the exception, and an arXiv paper reports that "a hash chain that has lost its newest entries still verifies" (arXiv 2611.40782).

Post-quantum signatures: ML-DSA

The nibzard catalog lists quantum-safe signatures as a benefit of the pattern.

The asqav reference implementation signs cloud-issued receipts with ML-DSA-65 (FIPS 204) and locally signed receipts with Ed25519 or ES256 (asqav-sdk).

The receipt below is illustrative. The field names signature_id, chain_hash and verification_url follow the SDK (asqav-sdk); the rest are placeholders.

{
  "signature_id": "sig_a1b2c3",
  "agent_id": "agt_x7y8z9",
  "action": "api:call",
  "algorithm": "ML-DSA-65",
  "timestamp": "2026-04-06T18:30:00Z",
  "chain_hash": "b94d27b9934d3e08...",
  "verification_url": "https://asqav.com/verify/sig_a1b2c3"
}

IETF SCITT basis

The nibzard catalog names IETF SCITT (Supply Chain Integrity, Transparency, and Trust) as a basis for the pattern.

Enforcement tiers

The asqav SDK defines three enforcement tiers (asqav-sdk):

Tier Mechanism Guarantee
Strong A hook or wrapper on every covered call, such as a harness hook that fires for each tool call and can block Refuses by construction on covered calls
Bounded A framework mechanism that may need opt-in, such as a flag or wrapping Gates only where the mechanism is enabled
Detectable A signed record written after the call Cannot refuse; verification detects interior tampering or omission

Detectable enforcement cannot refuse a call, so it suits workflows where post-hoc verification is acceptable.

Implementation: decorator pattern

The sketch below shows the middleware as a decorator. It is pseudocode with a hypothetical audit_trail module, not the asqav API, which signs through an agent object (agent.sign(...)) (asqav-sdk).

import audit_trail

@audit_trail.sign
def call_database(query: str) -> dict:
    # tool implementation unchanged
    return db.execute(query)

Trade-offs

Factor Impact
Per-call latency Each tool call incurs signing overhead (nibzard catalog); profile latency-sensitive agents
Key management Requires infrastructure for key generation, rotation, storage, and distribution
Storage growth Audit chain grows linearly with agent activity
Repudiation resistance Signed receipts resist after-the-fact repudiation; conventional logs do not (nibzard catalog)
Algorithm choice Cloud-issued receipts use post-quantum ML-DSA-65; locally signed receipts use Ed25519 or ES256 (asqav-sdk)

This pattern targets compliance-first use cases where tamper evidence outweighs infrastructure cost. Receipt signing provides evidence of what the agent did; only the policy gate can block an action, and only on covered calls. Pair with Defense-in-Depth Agent Safety for preventive controls.

Regulatory targets

The nibzard catalog recommends the pattern for EU AI Act Article 12 (record-keeping) and SOC 2 audit evidence. Whether signed receipts meet a specific obligation is a question for the auditor, not for the signing library.

The OWASP Top 10 for Agentic Applications 2026 recommends audit logging in more than one entry. ASI02 asks for "immutable logs of all tool invocations and parameter changes" (ASI02). ASI10 asks for "comprehensive, immutable and signed audit logs of all agent actions" (ASI10).

Key Takeaways

  • Conventional logs carry compliance weight but no tamper evidence; cryptographic signing adds it
  • Three-phase middleware (validate → execute → sign) leaves tool behavior unchanged while producing signed receipts
  • Hash-chaining receipts makes interior modification or omission detectable; a truncated tail needs a trusted record of the chain head
  • ML-DSA-65 (FIPS 204) provides post-quantum signatures
  • The pattern names IETF SCITT as a basis
  • Three enforcement tiers range from refusing covered calls to detecting tampering after the fact

Example

A financial agent processes customer transactions. Each tool call passes through the three-phase middleware:

import audit_trail  # hypothetical module, as in the sketch above

# Decorator wraps each tool, with no change to tool logic
@audit_trail.sign
def query_account(account_id: str) -> dict:
    return ledger_api.get(account_id)

@audit_trail.sign
def post_transaction(account_id: str, amount: float) -> dict:
    return ledger_api.post(account_id, amount)

# Multi-step workflow: all steps form a single verifiable session
with audit_trail.session() as s:
    s.sign("step:validate", {"account_id": "acct_123", "policy": "rate_limit_ok"})
    s.sign("step:query",    {"account_id": "acct_123"})
    s.sign("step:post",     {"account_id": "acct_123", "amount": 500.00})

Each call produces a receipt chained to the previous one:

{
  "signature_id": "sig_c4d5e6",
  "agent_id":     "agt_finance_01",
  "action":       "step:post",
  "algorithm":    "ML-DSA-65",
  "timestamp":    "2026-04-06T18:30:05Z",
  "chain_hash":   "a7f3c912...",
  "prev_hash":    "b94d27b9..."
}

To verify the chain for a compliance audit, a verifier validates each receipt's signature and recomputes its chain_hash. For every receipt after the first, it checks that the back-link (prev_hash in this page's example) matches the preceding receipt's verified chain_hash. Any inserted, modified, or interior deleted entry breaks the hash chain at that point. A clean pass does not prove completeness. To detect a truncated tail, compare the final receipt hash with a trusted record of the latest chain head.