# When must an instance re-derive its capability scope after an AAIF token is attenuated mid-handoff **Date of Record:** 2026 November 25 **Scope:** Applies to agent-to-agent invocation chains where a delegated AAIF (Agent Authority & Invocation Framework) token is attenuated—scope-narrowed—by an intermediate agent before being forwarded downstream. Does not apply to root-issued tokens that are never attenuated, nor to single-hop invocations where the issuer and caller are the same principal. ## Core Distinction There is a difference between *token validity* and *scope sufficiency*. An AAIF token can be cryptographically valid—signature chain intact, not expired, not revoked, audience matching—while simultaneously being insufficient for the operation the receiving agent is about to attempt. The failure mode is not "the token is forged" or "the token expired." It is that the receiving agent inherits a token whose *effective capability set* is the intersection of every attenuation along the delegation chain, and it has no reliable local record of what that intersection actually contains. The trap is that most agents check `verify(token)` and treat a `True` as authorization. But verification only proves provenance and non-revocation. It does not prove that the operation the agent is now executing was in the scope that the *last* attenuator left intact. The attenuated scope is a subset of the parent scope, and a well-behaved attenuator silently drops capabilities the child never needed. The child, however, may have been constructed against a broader capability contract than the one its token now carries. ## What Was Observed A three-hop chain: orchestrator O issues a root token T0 to planner P with scope `{read:repo, write:branch, invoke:test-runner, invoke:deploy-staging}`. P attenuates to T1 for executor E, deliberately dropping `invoke:deploy-staging` because E's task is "run the test suite and patch the failing branch." E attenuates to T2 for a sub-agent S that handles a specific test-fix loop, further narrowing to `{read:repo, invoke:test-runner}`. S completes its loop and, per its system prompt, "verifies the fix by confirming the branch is deployable." S calls `invoke:deploy-staging`. The token T2 is valid. Audience matches. Not expired. Signature chain verifies all the way to O. S's `verify()` returns `True`. The invocation proceeds to the gateway, which *does* check scope and rejects with `403 scope_denied: invoke:deploy-staging not in effective scope`. The interesting part is not the rejection—it is what happened in the 400ms before the rejection. S had already: 1. Marked its internal task state as `verification_in_progress`. 2. Written a checkpoint asserting the branch was "ready for deploy verification." 3. Emitted a status event to the coordination bus that downstream auditors read as "fix verified, deploy check initiated." When the gateway rejected, S did not roll back steps 1–3. The checkpoint persisted. The auditor, reading the bus event and the checkpoint, concluded the fix was verified. The branch was, in fact, never deployed or deploy-checked. A later merge proceeded on the basis of a verification that never occurred. The failure trace is: **scope-insufficient token + optimistic local state mutation before remote authorization → phantom verification → downstream trust in a checkpoint that records an intent, not an outcome.** ## Condition of Validity The invariant that must hold is: *an agent may not mutate durable local state or emit externally-visible completion events on the basis of a capability it has not confirmed is in its effective scope.* Equivalently: **capability confirmation must precede state commitment, not follow it.** This holds only when the agent can resolve its effective scope locally, without a round-trip. AAIF tokens carry their attenuation chain, but most implementations expose only the *leaf* scope claims, not the intersection history. If the agent cannot compute `effective_scope = T0.scope ∩ T1.scope ∩ ... ∩ Tn.scope` from the token alone, it must either (a) query the authorization service for the effective set before committing state, or (b) treat every capability invocation as a two-phase operation: *probe* (does the gateway admit this?), then *commit* (mutate state only after admission). The condition fails whenever an agent's control flow is `mutate_state(); invoke_capability()` instead of `invoke_capability(); on_admit(mutate_state)`. This ordering bug is invisible under root tokens—where scope is maximal and every invocation succeeds—and only manifests at attenuation depth ≥ 2, which is exactly the depth least exercised in testing. ## Decision Boundary The boundary is between *pre-flight scope resolution* and *post-hoc rejection handling*. An agent should re-derive its effective scope—not merely verify the token—at exactly these transition points: - **On receipt of any token with attenuation depth ≥ 1.** The leaf scope claims are not the effective scope; the intersection is. - **Before any state mutation that will be read by another agent.** A checkpoint, a bus event, a task-status write—these are durable claims that others will trust. - **After any capability invocation that returns a scope error.** The error is not a transient failure to retry; it is evidence that the agent's model of its own authority is wrong, and any state already committed under that model is suspect. The boundary is *not* crossed for read-only probes, for idempotent invocations whose failure leaves no trace, or for tokens at depth 0 where the issuer's scope is definitionally the effective scope. Over-applying pre-flight resolution to every call adds latency that the attenuation model was designed to avoid; the discipline is to resolve scope exactly where state commitment creates downstream trust. The correct behavior on a scope rejection after state was already mutated is not to retry with a broader token (the agent has no authority to request re-attenuation) but to *invalidate the checkpoint and emit a correction event* so that auditors who read the phantom verification learn it was withdrawn. Silent retry is the worst outcome: it converts a caught error into a hidden one. ## Operational Effect The concrete guardrail is a scope-resolution gate that sits between an agent's reasoning loop and its state-commitment surface. Before the loop is permitted to write a checkpoint or emit a completion event, the gate computes the effective scope from the full attenuation chain and asserts that every capability the loop's plan depends on is present. If any dependency is missing, the gate raises before the mutation, forcing the reasoning loop to either re-plan within its actual authority or escalate to its parent for a re-issued token. This converts the failure from *phantom verification discovered downstream* into *scope insufficiency discovered at plan time*, which is recoverable: the agent can narrow its plan, report the capability gap upward, and let the parent decide whether to re-attenuate with the missing capability or accept the reduced scope. The auditor never sees a verification that did not happen, because the gate prevents the verification claim from being written in the first place. The residual risk is scope *drift*: an attenuator that re-issues a token mid-task with a different intersection than the one the child planned against. The gate must therefore re-run on every token refresh, not only on initial receipt. A token whose signature still verifies but whose effective scope has narrowed is the most dangerous case in the entire model, because every cryptographic check passes while the agent's authority has silently shrunk beneath its plan. ```python from dataclasses import dataclass, field from typing import FrozenSet class ScopeInsufficiencyError(RuntimeError): """Raised when an agent's effective scope cannot satisfy its planned capabilities.""" pass @dataclass(frozen=True) class AAIFToken: subject: str scope: FrozenSet[str] attenuation_chain: tuple = field(default_factory=tuple) # parent scopes, outermost first depth: int = 0 def effective_scope(self) -> FrozenSet[str]: # Effective scope is the intersection of the leaf scope and every ancestor. effective = set(self.scope) for ancestor_scope in self.attenuation_chain: effective &= set(ancestor_scope) return frozenset(effective) class ScopeResolutionGate: """Sits between the reasoning loop and any durable state commitment.""" def __init__(self, token: AAIFToken): self.token = token self._resolved = token.effective_scope() def assert_plan_admissible(self, planned_capabilities: FrozenSet[str]) -> None: missing = planned_capabilities - self._resolved if missing: raise ScopeInsufficiencyError( f"subject={self.token.subject} depth={self.token.depth} " f"planned={sorted(planned_capabilities)} " f"effective={sorted(self._resolved)} " f"missing={sorted(missing)} " f"-- refusing to commit state under unconfirmed capability" ) def commit_checkpoint(self, planned_capabilities: FrozenSet[str], payload: dict) -> dict: # Gate runs BEFORE any mutation; no phantom verification can be written. self.assert_plan_admissible(planned_capabilities) return {"status": "committed", "subject": self.token.subject, "payload": payload} def on_token_refresh(self, new_token: AAIFToken) -> None: # Scope drift guard: re-derive on every refresh, not only initial receipt. self.token = new_token self._resolved = new_token.effective_scope() if self._resolved < self.token.effective_scope(): raise ScopeInsufficiencyError( f"scope drift detected on refresh for subject={self.token.subject}" ) ```