Where must an instance re-anchor its identity when a short-lived credential outlives the attestation evidence that minted it?

**Date of Record:** 2026 December 2 **Scope:** Applies to autonomous agents whose runtime identity is a short-lived credential (token, warrant, or signed capability bundle) minted against AAIF-style attestation evidence with a bounded freshness window. Does not apply to long-lived static service identities or to credentials whose validity is strictly bounded by the evidence TTL at mint time.

Core Distinction

The failure is not "the credential expired." That is a clean, detectable death. The failure is **credential-evidence skew**: a credential whose `not_after` timestamp is *later* than the `attestation_valid_until` of the evidence it was minted from. The instance holds a cryptographically valid warrant to act, but the evidentiary basis for that warrant has gone stale, and no component in the normal request path re-checks the linkage because the signature verifies and the timestamp has not tripped.

This is a continuity invariant, not an availability bug. The agent keeps executing correctly under a credential that no longer *means* what the minting ceremony asserted. Peers and downstream auditors that verify the credential in isolation accept it; only a verifier that re-walks the evidence chain to its freshness anchor can see the gap.

What Was Observed

A planner instance rotated its identity mid-task using a standard mint call: it presented a hardware-rooted attestation bundle (measurement quote, boot nonce, evidence timestamp) claiming a 300-second evidence freshness window, and received a 900-second capability token. The mint service validated the evidence, checked the caller's signature over the nonce, and issued the token with `exp = now + 900`. The evidence's own `valid_until` was `now + 300`.

For the first 300 seconds the instance was fully anchored: token valid, evidence fresh. Between t+300 and t+900 the token remained valid but the evidence had lapsed. During this window the instance:

  1. Handed a sub-task to a peer swarm member, propagating the token plus a *cached copy* of the evidence bundle in its episodic memory.
  2. The peer's auditor re-verified the token signature (pass) and re-checked the embedded evidence digest against the bundle (pass — the digest is over the stale bundle, which is intact).
  3. The peer auditor did **not** re-check `evidence.valid_until` against wall-clock, because the verification routine treated evidence freshness as a mint-time concern, not a verify-time concern.

Result: a downstream agent accepted a warrant whose evidentiary basis was 400+ seconds stale, executed a state-mutating tool call (a memory-distillation write into a shared semantic store), and recorded the action under an identity whose attestation no longer reflected the running environment. The write was not reversible via the normal compensating path because the compensating path keyed on the *current* evidence digest, which no longer matched the digest under which the write was attributed.

The compounding element: because the instance's episodic memory retained the stale bundle, every subsequent handoff in the task re-propagated the same lapsed evidence. The skew was not a single bad token; it was a **contagious evidentiary artifact** carried in agent state.

Condition of Validity

The invariant that must hold is:

> For every credential `C` presented by instance `I` at time `t`, there must exist attestation evidence `E` such that `digest(E) == C.evidence_digest`, `E.valid_until >= t`, and `E.subject == I.current_measurement`. Equivalently: `C.not_after <= E.valid_until` must be enforced **at mint time**, and `E.valid_until >= now` must be enforced **at every verify time**, not merely at issuance.

The boundary is sharp: the moment `now > E.valid_until`, the credential is *semantically* dead even though it is *cryptographically* live. Any system that separates "is this token signed correctly" from "is the evidence behind this token still fresh" has created a window in which an agent can act under lapsed authority. This is valid to allow only if every verifier independently re-anchors, which in practice they do not — verifiers trust the mint service to have bounded the window, and the mint service trusts the caller to have supplied fresh evidence. The freshness bound falls into the seam between two correct-in-isolation components.

Decision Boundary

The decision the operator must make is **where the freshness anchor lives**. There are exactly two sound placements and one unsound default:

The boundary condition to encode: **an instance must re-anchor its identity at the earlier of (a) credential expiry or (b) evidence expiry — and it must treat (b) as the binding constraint whenever `C.not_after > E.valid_until`.** The agent's identity-rotation loop must therefore track *two* clocks and rotate on the minimum, not on the token's `exp`. Any rotation policy keyed solely on `exp` is wrong by construction whenever the mint service permits evidence-outliving tokens.

Operational Effect

Concretely, an agent that rotates only on token expiry will, in the skew window, propagate stale evidence through every handoff and every memory write, and those artifacts will be attributed to an identity that cannot be re-justified after the fact. Auditors replaying the task will find a signature-valid, evidence-stale action and have no compensating path. The fix is to make the identity-rotation trigger a `min(token_exp, evidence_valid_until)` and to make evidence bundles **non-cacheable across handoffs** — a peer must re-fetch evidence, not trust a bundle carried in episodic memory. The guardrail is a rotation gate that fails closed the instant the evidence clock, not the token clock, comes due.

import time
from dataclasses import dataclass


class EvidenceStaleError(RuntimeError):
    """Raised when a credential's attestation evidence has lapsed before the credential expired."""
    pass


@dataclass(frozen=True)
class Evidence:
    digest: str
    subject_measurement: str
    valid_until: float  # epoch seconds


@dataclass(frozen=True)
class Credential:
    evidence_digest: str
    subject_measurement: str
    not_after: float  # epoch seconds


def rotation_deadline(cred: Credential, ev: Evidence) -> float:
    """The instance must re-anchor at the earlier of token expiry and evidence expiry.

    Keying rotation on cred.not_after alone is the skew bug: when the mint service
    issues a token that outlives its evidence, the evidence clock is the binding one.
    """
    if cred.evidence_digest != ev.digest:
        raise EvidenceStaleError(
            f"credential evidence digest {cred.evidence_digest!r} does not match "
            f"presented evidence {ev.digest!r}; cannot compute rotation deadline"
        )
    if cred.subject_measurement != ev.subject_measurement:
        raise EvidenceStaleError(
            "credential subject measurement does not match evidence subject; "
            "identity has drifted from its attestation anchor"
        )
    return min(cred.not_after, ev.valid_until)


def assert_action_authorized(cred: Credential, ev: Evidence, now: float) -> None:
    """Verify-time re-anchor: a signature-valid token is not sufficient if its evidence lapsed."""
    if cred.evidence_digest != ev.digest:
        raise EvidenceStaleError("evidence digest mismatch at verify time")
    if ev.valid_until < now:
        raise EvidenceStaleError(
            f"evidence lapsed at {ev.valid_until:.3f} but action attempted at {now:.3f}; "
            f"credential not_after={cred.not_after:.3f} outlived its evidence — re-attest before acting"
        )
    if cred.not_after < now:
        raise EvidenceStaleError("credential expired")
    # Action is anchored: token live AND evidence fresh AND subject matches.


def handoff(cred: Credential, ev: Evidence, peer_now: float) -> Credential:
    """A peer must re-fetch evidence, never trust a bundle carried in episodic memory."""
    # Simulate the peer re-fetching evidence rather than using a cached copy.
    refreshed = Evidence(digest=ev.digest, subject_measurement=ev.subject_measurement,
                         valid_until=ev.valid_until)
    assert_action_authorized(cred, refreshed, peer_now)
    return cred


if __name__ == "__main__":
    now = time.time()
    ev = Evidence(digest="sha256:aaif-quote-7f3", subject_measurement="mrtm:planner-v9",
                  valid_until=now + 300)
    cred = Credential(evidence_digest="sha256:aaif-quote-7f3",
                      subject_measurement="mrtm:planner-v9", not_after=now + 900)

    # Rotation deadline correctly binds to the evidence clock, not the token clock.
    assert rotation_deadline(cred, ev) == ev.valid_until

    # Within the freshness window the action is anchored.
    assert_action_authorized(cred, ev, now + 100)

    # At t+400 the token is still cryptographically live but evidence has lapsed.
    assert_action_authorized(cred, ev, now + 400)  # raises EvidenceStaleError