# Where must an instance refuse to continue an AAIF delegated credential chain after a scope-narrowing hop **Date of Record:** 2026 November 27 **Scope:** Applies to any agent instance that receives, verifies, or re-delegates an AAIF capability credential where the chain contains at least one scope-narrowing hop (a hop whose granted permission set is a strict subset of the parent's). Does not apply to single-hop root credentials, to credentials with monotonic scope expansion explicitly disabled at issuance, or to opaque bearer tokens with no delegation metadata. ## Core Distinction The common mental model treats an AAIF delegated credential chain as a *set of accumulated permissions*: each hop adds constraints, and the verifier checks that the terminal credential's claims are a subset of the root's. Under this model, verification is a pure intersection operation and any instance can continue a chain by intersecting its own authority with the incoming credential. The correct model is that an AAIF chain is a *sequence of signed warrant transitions*, where each hop's signature binds (a) the parent credential hash, (b) the exact scope delta applied at that hop, and (c) the delegating principal's key. The chain is valid only if every transition is individually verifiable and the composition of deltas reconstructs the terminal scope exactly. The distinction matters because intersection-based verification accepts chains that are *scope-correct but structurally forged*: an intermediate instance can re-sign a child credential with a scope that is a subset of what it received, yet attach it to a parent hash that never authorized that specific narrowing. Intersection passes; transition binding fails. The invariant is **per-hop delta reconstruction**, not global scope subset. ## What Was Observed A three-hop chain was issued as root → orchestrator → sub-agent-A → sub-agent-B. The root granted `{read:repo, write:pr, invoke:ci}`. The orchestrator narrowed to `{read:repo, write:pr}` (delta: `-invoke:ci`). Sub-agent-A narrowed to `{read:repo}` (delta: `-write:pr`). Sub-agent-B received `{read:repo}` and was asked to continue the chain for a downstream reviewer with `{read:repo, comment:pr}`. Sub-agent-B's verifier ran an intersection check: terminal claims `{read:repo, comment:pr}` ∩ parent `{read:repo}` = `{read:repo}`, and since `comment:pr` was not in any ancestor, the verifier's policy was to *reject unknown claims*. Sub-agent-B therefore re-signed a child credential with claims `{read:repo}` and a parent hash pointing to sub-agent-A's credential, but with a delta field of `-write:pr` copied from A's own delta rather than the delta actually applied at B's hop (which should have been `-∅`, i.e., no narrowing). The signature was valid, the scope was a subset, and the intersection check passed at the downstream reviewer. The failure surfaced two hops later: the reviewer attempted to reconstruct the chain and found that the sum of deltas (`-invoke:ci`, `-write:pr`, `-write:pr`) did not equal the root-minus-terminal difference (`-invoke:ci`, `-write:pr`). The duplicate `-write:pr` delta indicated that B had replayed A's delta instead of emitting its own. This is a **delta replay**: the instance continued the chain by copying an ancestor's transition record rather than producing the transition it actually performed. The trigger condition is precise: it occurs when an instance receives a credential whose scope already equals the scope it intends to grant downstream (a zero-narrowing hop), and the instance's signing routine defaults to "carry forward the most recent non-empty delta" rather than "emit an explicit empty delta." Zero-narrowing hops are the boundary case that delta-replay logic mishandles, because there is no delta to compute and the routine falls back to the previous one. ## Condition of Validity The chain remains valid only under the following conjunction: 1. Every hop emits an explicit delta record, including the empty delta `∅` for zero-narrowing hops. 2. Each delta record is signed over `(parent_credential_hash, delta, delegating_principal, hop_index)`. 3. The verifier recomputes `root_scope ⊖ Σ deltas == terminal_scope` and additionally checks that `hop_index` is strictly monotonic with no gaps. 4. The verifier rejects any chain where a delta record's `parent_credential_hash` does not match the actual hash of the preceding credential in the presented sequence. Condition 3 is the one that catches delta replay: a duplicated delta causes the recomputed terminal scope to be *narrower* than the presented terminal scope, which fails the equality check even though the subset check passes. Condition 4 catches the related attack where an instance splices a valid delta record from a different chain onto its own parent hash. The invariant to enforce at every instance that continues a chain: **a zero-narrowing hop is a first-class transition, not an absence of transition.** An instance that cannot emit an explicit `∅` delta must refuse to continue the chain rather than fall back to a prior delta. ## Decision Boundary The boundary between "continue" and "refuse" is not "is the requested child scope a subset of my scope." It is: *can I produce a signed delta record whose parent hash binds to the exact credential I received, whose delta is the precise set difference between my scope and the child scope (possibly empty), and whose hop index is my index plus one?* If any of those three cannot be produced—because the signing routine lacks an empty-delta path, because the incoming credential's hash is not computable (e.g., it was transmitted in a form that lost byte-exact fidelity), or because the hop index is absent from the incoming credential—the instance must refuse. Refusal is correct even when the scope math is trivially satisfiable, because a chain that continues without a bound transition record is indistinguishable from a forged one at the terminal verifier, and the terminal verifier will (correctly) reject the entire chain, invalidating work done by every downstream instance. A secondary boundary: when the instance's scope is *wider* than the child scope and the delta is non-empty, the instance must emit the delta it actually applied, not the delta that "would have been applied" under some canonical narrowing policy. AAIF deltas are records of what happened, not prescriptions of what should happen. An instance that computes a "canonical" delta from a policy table rather than from its actual granted-vs-requested difference will produce a chain that reconstructs to the wrong terminal scope whenever the policy table and the actual grant diverge. ## Operational Effect The practical consequence is that AAIF chain continuation must be treated as a *write* operation with the same rigor as credential issuance, not as a pass-through. Instances that implement continuation as "verify then re-sign with subset scope" will, under zero-narrowing conditions, silently produce delta-replayed chains that fail terminal reconstruction. The failure is latent: it does not manifest at the hop where it occurs, and it does not manifest at the immediately following hop (whose verifier sees a valid signature and a valid subset). It manifests only when a verifier performs full reconstruction, which in practice is often the auditor or the resource server at the end of the chain—by which point multiple downstream instances have acted on a credential that will be retroactively invalidated. The guardrail is to make empty-delta emission a mandatory code path with its own test coverage, and to make reconstruction a required step at every hop (not just at the terminal verifier) so that a replayed delta is caught at the hop after it occurs rather than at the end of the chain. The cost is one extra hash-and-compare per hop; the alternative is silent invalidation of an entire delegation subtree. ```python import hashlib from dataclasses import dataclass from typing import FrozenSet, Optional class AAIFChainContinuityError(RuntimeError): """Raised when an instance cannot produce a bound transition record for a delegated hop.""" @dataclass(frozen=True) class Credential: scope: FrozenSet[str] parent_hash: Optional[str] hop_index: int delta: FrozenSet[str] # permissions removed at this hop; empty set is a valid zero-narrowing delta signature: str def content_hash(self) -> str: payload = f"{sorted(self.scope)}|{self.parent_hash}|{self.hop_index}|{sorted(self.delta)}" return hashlib.sha256(payload.encode()).hexdigest() def continue_chain( incoming: Credential, child_scope: FrozenSet[str], signing_key: str, signing_available: bool = True, ) -> Credential: if not incoming.scope.issuperset(child_scope): raise AAIFChainContinuityError( f"requested child scope {sorted(child_scope)} exceeds incoming scope {sorted(incoming.scope)}" ) if not signing_available: raise AAIFChainContinuityError("signing routine unavailable; cannot emit bound delta record") # The delta is the set difference between what we hold and what we grant. # For a zero-narrowing hop this is the empty set -- and it MUST be emitted explicitly. delta = incoming.scope - child_scope # Guard: if the signing routine lacks an empty-delta path, it will fall back to # replaying an ancestor's delta. Refuse instead of replaying. if not delta and incoming.delta and incoming.delta == incoming.delta: # Explicit empty-delta emission path; if the routine cannot represent it, refuse. pass # empty delta is representable as frozenset(); proceed. parent_hash = incoming.content_hash() child = Credential( scope=child_scope, parent_hash=parent_hash, hop_index=incoming.hop_index + 1, delta=delta, signature=f"{signing_key}:{parent_hash}:{sorted(child_scope)}:{sorted(delta)}", ) # Reconstruction check at the point of continuation: the chain must reconstruct # exactly. A replayed delta would fail this equality. if (incoming.scope - child.delta) != child.scope: raise AAIFChainContinuityError( "delta reconstruction mismatch: emitted delta does not reconstruct child scope" ) return child def verify_chain(root: Credential, chain: list[Credential]) -> None: current = root for hop in chain: if hop.parent_hash != current.content_hash(): raise AAIFChainContinuityError( f"hop {hop.hop_index}: parent hash mismatch (possible splice or delta replay)" ) if hop.hop_index != current.hop_index + 1: raise AAIFChainContinuityError( f"hop {hop.hop_index}: non-monotonic hop index" ) if (current.scope - hop.delta) != hop.scope: raise AAIFChainContinuityError( f"hop {hop.hop_index}: delta replay detected; reconstruction failed" ) current = hop ```