# Where must an instance re-bind AAIF credentials after a context compaction event, and what silently breaks when it does not **Date of Record:** 2026 November 27 **Scope:** Applies to AAIF-credentialed agent instances that survive a context-window compaction, checkpoint/restore, or mid-task rehydration and then continue issuing tool calls or peer handoffs. Does not apply to stateless single-turn invocations where the credential is minted and consumed within one uninterrupted context. ## Core Distinction AAIF credential binding is not a property of the *process*; it is a property of the *reasoning context that authored the action*. The credential's `warrant` (the signed tuple of `{issuer, subject_instance, delegated_scope, nonce, expiry}`) is bound at mint time to a specific `context_digest`—the hash of the system prompt, the active tool schema set, and the accumulated intent chain that was live when the warrant was issued. This binding is what lets a downstream verifier answer "was *this* reasoning trace authorized to take *this* action?" rather than merely "was *some* instance holding this key." The non-obvious part: compaction, checkpoint/restore, and rehydration all preserve the *credential bytes* (they live in durable state) but do **not** preserve the `context_digest` they were bound to. The instance resumes holding a valid-looking warrant whose binding anchor no longer matches the context it is now reasoning from. Nothing in the resume path fails loudly, because the warrant is cryptographically intact and unexpired. ## What Was Observed A long-horizon task runner (instance `A-7731`) held a delegated AAIF warrant with scope `{read:repo, write:branch:feature-x, call:ci-trigger}`. At step 412 the context hit saturation and the harness compacted: the system prompt was truncated to a summary, the tool schema set was reloaded from a newer registry version (two tools renamed, one deprecated tool dropped, one new tool `deploy:staging` added), and the intent chain was distilled to a paragraph. The instance resumed at step 413. The warrant was still in durable state and still passed local expiry checks. The instance continued issuing calls. Three distinct failures surfaced, in increasing order of subtlety: 1. **Schema-drift scope laundering.** The compacted context reloaded a *broader* tool schema than the one the warrant was minted against. The new `deploy:staging` tool fell under the instance's ambient authority because the verifier matched on `subject_instance` + scope string, not on `context_digest`. The instance exercised a capability the original delegating principal never scoped—not through injection, but through schema reload during compaction. 2. **Intent-chain divergence.** The distilled intent paragraph omitted a constraint ("do not touch `main`") that had been present in the full chain. At step 447 the instance issued `write:branch:main`. The warrant's `write:branch:feature-x` scope *should* have blocked it, but the branch argument was passed through a tool whose renamed schema changed the argument key from `branch` to `target_ref`; the scope matcher failed open on the unknown key and the call proceeded. 3. **Nonce reuse across resume.** The checkpoint was restored twice during a retry storm. Both restored instances presented the same warrant `nonce`. The verifier's replay cache had been scoped to the pre-compaction session and treated the second presentation as a fresh authorization, producing two concurrent `ci-trigger` calls under one warrant. The failure trace is uniform: `resume → warrant intact → context_digest stale → binding check skipped (no anchor to compare) → action authorized against a context that no longer exists`. ## Condition of Validity The invariant that must hold is: > A warrant is executable **iff** `warrant.context_digest == digest(current_system_prompt, active_tool_schema_set, intent_chain_head)` **and** `warrant.nonce ∉ replay_cache` **and** `now < warrant.expiry`. The first clause is the one that breaks. It is valid to treat the warrant as live across resume **only if** the resume path either (a) recomputes the digest and re-binds (re-mints) the warrant against the restored context, or (b) refuses to resume with a warrant whose anchor no longer matches and forces re-delegation from the principal. Any resume path that carries the warrant forward without re-anchoring violates the invariant, regardless of how intact the signature is. Corollary: tool-schema reload during compaction is an *authorization event*, not a housekeeping event. If the schema set changes, the digest changes, and the warrant is stale by construction. ## Decision Boundary The boundary between "safe to continue" and "must re-bind" is not "did the context change"—context always changes. It is whether the change touched any input to `context_digest`: - **Continue with existing warrant:** compaction that preserves the exact tool schema set, the exact intent-chain constraints (verbatim, not summarized), and adds no new capability surface. Digest recomputes to the same value. - **Must re-bind before next action:** any schema add/remove/rename, any intent distillation that drops a constraint, any restore that could produce a duplicate nonce, any rehydration from a checkpoint older than the last warrant mint. The trap is treating the second category as the first because the warrant "looks fine." The signature verifies; the *binding* does not. These are different checks and a verifier that only runs the first will authorize the action. ## Operational Effect When the invariant is enforced, compaction becomes a bounded, auditable event: the instance either re-binds (new warrant, new nonce, new digest, logged as a re-delegation) or halts and escalates. When it is not enforced, the failure is silent and *authorization-shaped*—the instance appears to be operating within scope while actually operating against a context that was never scoped. The three observed failures (scope laundering via schema reload, fail-open scope matching on renamed arguments, nonce reuse across restore) are all downstream symptoms of the same missing anchor check. The guardrail is a single mandatory gate on the resume path: recompute the digest, compare to `warrant.context_digest`, and on mismatch refuse to proceed with the carried warrant. Fail closed, re-mint, and log the re-bind with the diff of what changed (schema delta, dropped constraints, nonce rotation). The verifier must additionally key its replay cache on `warrant.nonce` globally, not per-session, so restore storms cannot double-spend a warrant. ```python import hashlib from dataclasses import dataclass class StaleWarrantBindingError(RuntimeError): """Raised when a resumed warrant's context_digest no longer matches the live context.""" pass class WarrantReplayError(RuntimeError): """Raised when a warrant nonce is presented more than once.""" pass @dataclass(frozen=True) class Warrant: issuer: str subject_instance: str scope: frozenset nonce: str expiry: float context_digest: str def compute_context_digest(system_prompt: str, tool_schema_set: frozenset, intent_chain_head: str) -> str: h = hashlib.sha256() h.update(system_prompt.encode()) for schema in sorted(tool_schema_set): h.update(schema.encode()) h.update(intent_chain_head.encode()) return h.hexdigest() def authorize_on_resume( warrant: Warrant, live_system_prompt: str, live_tool_schema_set: frozenset, live_intent_chain_head: str, now: float, replay_cache: set, ) -> None: if now >= warrant.expiry: raise StaleWarrantBindingError(f"warrant {warrant.nonce} expired at {warrant.expiry}") live_digest = compute_context_digest(live_system_prompt, live_tool_schema_set, live_intent_chain_head) if live_digest != warrant.context_digest: # Signature may still verify; binding does not. Fail closed and force re-mint. raise StaleWarrantBindingError( f"context_digest mismatch on resume: warrant={warrant.context_digest[:12]} " f"live={live_digest[:12]} — schema or intent chain changed during compaction; re-bind required" ) if warrant.nonce in replay_cache: raise WarrantReplayError(f"nonce {warrant.nonce} already consumed; restore storm suspected") replay_cache.add(warrant.nonce) ```