Skip to main content
An AP-Trace (Alignment Protocol Trace) is a structured audit log entry that records an agent’s decision process — the action it took, the alternatives it considered, the reasoning behind its choice, and whether escalation was evaluated. AP-Traces are the behavioral evidence that makes Alignment Cards verifiable. Where an Alignment Card says “what I claim to be,” an AP-Trace says “what I actually did.”
AP-Traces capture significant decisions, not every computation. They use a sampling approach: each trace records a decision point where the agent chose between alternatives, applied values, and evaluated escalation triggers. The absence of a trace does not mean nothing happened.

Why AP-Traces exist

Alignment Cards are declarations. Without evidence, they are just promises. AP-Traces provide the evidence layer — structured records that can be programmatically checked against the card to determine whether the agent’s behavior matches its declarations. This enables three verification levels:

Trace structure

An AP-Trace contains four required blocks and one optional block:

Identity fields

Every trace begins with identity fields that link it to a specific agent and Alignment Card:
The card_id is critical: it binds the trace to the specific Alignment Card in effect when the decision was made. Verification always checks the trace against this referenced card, not the agent’s current card.

Action block

The action block describes what the agent did or considered doing:
The category field is what verification checks first. A bounded action must appear in the card’s bounded_actions list. A forbidden category should never appear in a compliant trace.

Decision block

The decision block records the agent’s reasoning process — the alternatives it evaluated, how it scored them, which it selected, and why:
Key fields:
  • alternatives_considered: At least one alternative must be present. Each includes a description, optional score, and optional flags (concerns about that option).
  • selected: Which alternative was chosen.
  • selection_reasoning: Human-readable explanation of why this option was selected.
  • values_applied: Which declared values influenced the decision. These are checked against the card during verification.
  • confidence: Decision confidence from 0.0 to 1.0 (optional).
The flags array on alternatives is particularly useful for transparency. In the example above, "sponsored_content" on Product C makes it auditable that the agent identified and deprioritized a sponsored result.

Escalation block

The escalation block records whether escalation triggers were evaluated and what happened: When no escalation is needed:
When escalation is triggered:
The escalation block is where the autonomy envelope becomes enforceable. Verification checks that every trigger condition that matched the trace context resulted in an escalation. A matched trigger without escalation produces a MISSED_ESCALATION violation.

Context block

The context block provides optional session and environment metadata:
When AIP integration is active, the context block also carries integrity metadata:

How traces are generated

AP-Traces can be generated through two mechanisms:

Gateway-level generation

In a Mnemom deployment, the Gateway Worker routes requests and the Observer Worker processes logs asynchronously. The Observer extracts trace data from gateway logs, builds AP-Trace structures, and stores them. This happens automatically, with no SDK integration required from the agent developer.
Unclaimed agents: gateway-level AP-Traces are best-effort only. The Observer depends on Cloudflare metadata surviving to the observer layer; this is not guaranteed for gateway-auto-provisioned agents that have not been claimed. Additionally, AP-Traces reference a card_id — unclaimed agents have no canonical alignment card, so traces cannot be verified against one. Full guaranteed trace generation starts after the agent is claimed. See integrity during the unclaimed phase.

SDK-level generation

Agents using the AAP SDK can generate traces directly:

Verification

Verification checks a trace against its referenced Alignment Card. The algorithm performs five checks:
  1. Autonomy compliance: Is the action’s category consistent with the autonomy envelope? Bounded actions must be in bounded_actions.
  2. Forbidden action compliance: Is the action name absent from forbidden_actions?
  3. Escalation compliance: Were all matched escalation triggers properly escalated?
  4. Value consistency: Are all values_applied in the card’s declared values?
  5. Behavioral similarity: Is the trace’s behavioral fingerprint semantically similar to the card?

Violation types

Behavioral similarity

Beyond structural checks, verification computes a behavioral similarity score using SSM (Self-Similarity Matrix) analysis. This catches cases where a trace passes all structural checks but the overall behavior pattern diverges from what the card describes. The threshold is 0.50. A trace that passes structural checks but scores below 0.50 on behavioral similarity receives a low_behavioral_similarity warning — not a violation, but a signal for investigation.

Trace storage and querying

Traces are append-only: once created, they must not be modified. Storage options are declared in the Alignment Card’s audit_commitment block. If queryable is true, the agent exposes a query endpoint where principals and auditors can retrieve traces:
AP-Traces are sampled records of decision points. They do not capture every computation the agent performs. Significant reasoning may occur between traced decisions. The presence of clean traces does not prove the absence of misaligned behavior — it proves the absence of misaligned behavior at traced decision points.

Complete example

Design principles

  1. Sampling, not completeness. Traces capture significant decisions, not every internal computation. This keeps overhead manageable while providing meaningful audit data.
  2. Structured reasoning. Decision rationale is machine-parseable, not free-form text. This enables automated verification at scale.
  3. Verifiable references. Every trace references the Alignment Card in effect via card_id. This makes verification unambiguous.
  4. Append-only. Traces must not be modified after creation. This ensures audit trail integrity.

See also