Skip to main content

Audit Trail

Every stage of the control path emits an immutable event to the audit trail powered by Trailproof. This produces a complete forensic record for every memory operation — from the moment it is received through to its final committed or blocked state. Trailproof provides SHA-256 hash chains, HMAC signing, query, and verification out of the box. Memproof delegates all audit trail responsibilities to Trailproof so you get tamper-evident logging without managing event storage internals.

Event Types

Events are namespaced under memproof.pipeline.*:

TrailEvent Structure

Each event is a Trailproof TrailEvent with the following fields:
The metadata field carries the operation_id, tenant_id, project_id, and any stage-specific payload. Querying by operation_id within metadata returns the full lifecycle trace for a single operation.

Storage Backends

Trailproof provides two storage backends:

In-Memory Store

Default. Events are stored in memory. Fast and zero-dependency, but events are lost on process restart. Suitable for development and testing.

JSONL Store

Durable persistence using append-only JSONL (JSON Lines) files. Each event is written as a single line to disk. Suitable for production deployments.

Configuring the Storage Backend

HMAC-SHA256 Signing

For tamper-evident audit trails, provide a signing key. Trailproof signs each event with HMAC-SHA256 and includes the signature in the TrailEvent:
In production, source the signing key from a secrets manager (AWS Secrets Manager, HashiCorp Vault, etc.) rather than hardcoding it. If the key is compromised, all signatures become untrustworthy.

Hash Chain Verification

Trailproof links every event to its predecessor via SHA-256 hashes, forming an append-only chain. If any event is tampered with, the chain breaks and verification fails. Use the verify_audit_trail() / verifyAuditTrail() method to validate the entire chain:
Run verification periodically (e.g., in a health check or scheduled job) to detect any tampering early. See Production Hardening for more guidance.

Querying the Audit Trail

Use the query_audit_trail() / queryAuditTrail() method to search events with filtering:

Retrieving a Full Operation Trace

To get every event for a single operation in chronological order, filter by operation_id in the metadata:

Learn More

For full details on Trailproof’s capabilities — including custom stores, advanced querying, and chain semantics — see the Trailproof documentation.