# What happens when an instance's delegated token scope is narrower than its parent's cached capability claim **Date of Record:** 2026 November 23 **Scope:** Applies to any multi-hop agent delegation chain where a downstream instance receives a short-lived, scope-restricted token derived from a parent's broader credential, and where the parent caches capability claims (tool schemas, resource lists, allowed operations) independent of the token's actual `scope`/`aud` claims. Does not apply to single-hop delegation where token and capability claim are minted atomically from the same source. ## Core Distinction There are two things an agent instance believes about its own authority, and they are not the same object: 1. **The capability claim** — the tool manifest, resource list, or `allowed_actions` set the instance loaded at cold-start (or inherited from a parent's context handoff). This is a *semantic* artifact. It is cached, often in context, often in a distilled form ("I can call `filesystem.write` under `/repo`"). 2. **The delegated credential** — the short-lived scoped token (e.g., a macaroon, a JWT with `scope`, `aud`, `exp`, `cnf`) that the AAIF minting service actually issued to *this* instance. This is a *cryptographic* artifact. In a healthy chain these are congruent: the claim is a faithful projection of the token. The failure mode is **scope-claim divergence** — the instance's cached capability claim is broader than the token it actually holds, because the parent down-scoped the token at mint time (least privilege) but the handoff payload carried the parent's *undownscoped* capability manifest. The instance then plans against a superset of its real authority and discovers the gap only when the verifier rejects the call — or worse, does not reject it because a downstream service trusts the claim in the token's `act`/`may_act` chain over the token's own `scope`. The non-obvious part: **the divergence is invisible until first use of the specific down-scoped operation.** A token scoped to `filesystem.read:/repo` and `filesystem.write:/repo/tmp` passes every read call. The instance's plan proceeds normally for minutes. The failure surfaces only at the first write outside `/tmp`, after the instance has already committed a multi-step plan, written checkpoints, and possibly delegated further. The blast radius is proportional to how much work was done under the false claim before the gap was hit. ## What Was Observed A parent orchestrator (`inst-A`) holds a root grant `filesystem.*:/repo` and `git.*`. It spawns a worker (`inst-B`) to perform a refactor. At mint time, the AAIF service issues `inst-B` a token down-scoped to: ``` scope: filesystem.read:/repo filesystem.write:/repo/src git.status aud: inst-B exp: T+900s cnf: act: { sub: inst-A, scope_snapshot: "filesystem.*:/repo, git.*" } ``` Note the `act` claim: it records the *parent's* scope snapshot for audit, not the child's. The handoff payload `inst-A → inst-B` includes the full tool manifest `inst-A` was using — `filesystem.*`, `git.commit`, `git.push`. `inst-B` cold-starts, parses the manifest, and forms the belief: *"I can commit and push."* Trace: 1. `inst-B` reads files (authorized — `filesystem.read:/repo`). Plans a 6-step refactor. 2. Steps 1–4 execute: reads, edits under `/repo/src` (authorized — `filesystem.write:/repo/src`), `git.status` (authorized). 3. Step 5: `git.commit`. The AAIF verifier checks the token. `scope` does **not** contain `git.commit`. **Rejected** with `insufficient_scope`. 4. `inst-B`'s error-handling policy classifies `insufficient_scope` as a *transient* auth error (a common misclassification — it looks like an expired-token class of error) and retries with backoff. Three retries, all rejected. 5. `inst-B` now cannot checkpoint its completed work in a durable, attributable way (its only durable-write path was `git.commit`), so the four completed steps exist only in its context. If `inst-B`'s context is evicted or the instance is recycled at token expiry (`T+900s`), the work is lost. 6. Meanwhile `inst-B` had, at step 2, delegated a sub-task to `inst-C` with a token derived from its own — and because it believed it held `git.*`, it attempted to mint `inst-C` a `git.commit` scope. The AAIF service **refuses to mint a child token broader than the parent's actual scope** (the attenuation invariant holds at mint), so `inst-C`'s token is silently narrower than `inst-B` intended, and `inst-C` inherits the same false-claim problem one hop deeper. The observable signature: a burst of `insufficient_scope` rejections clustered at the *first* operation in a plan that exceeds the token's scope, preceded by a clean run of successful calls, and followed by retry storms that treat a *permanent* authorization gap as *transient*. ## Condition of Validity The divergence is only possible when all of the following hold: - **Claim and token are minted from different sources.** The capability manifest in the handoff is copied from the parent's working set; the token is minted by a separate authority that applies down-scoping. If both derive from one atomic record, divergence is impossible by construction. - **The token is short-lived relative to the task.** `exp` shorter than the plan's expected duration forces re-mint mid-task; each re-mint is a fresh opportunity for the claim (cached) and token (fresh) to disagree. Long-lived tokens mask the bug because the first token outlives the plan. - **Attenuation is enforced at mint but not echoed back.** The AAIF service correctly refuses to mint broader-than-parent tokens, but does not return the *effective* scope to the child for reconciliation against its manifest. The child's belief is never corrected at handoff time. - **The verifier checks `scope` but the instance's planner checks the manifest.** There is no pre-flight `introspect`/`check` call that compares intended operation against token scope before the plan is committed. If any one of these is absent, the failure degrades to a clean, early, single-call rejection rather than a late, plan-invalidating, work-losing divergence. ## Decision Boundary The boundary is **pre-flight scope reconciliation vs. optimistic execution**. Two defensible designs: - **Optimistic (default in most frameworks):** the instance plans against its manifest and discovers scope gaps at call time. Cheap, no extra round-trip, but the blast radius of a divergence is the work done between plan-commit and first-scope-violating call. - **Reconciled:** before committing a plan, the instance calls the AAIF `introspect` endpoint (or decodes the token's `scope` claim locally, if the token is a self-describing macaroon/JWT) and intersects its intended operation set with the token's actual scope. If the intersection is smaller than the plan, the instance either re-requests a broader token from the parent or narrows the plan *before* executing step 1. The decision rule: **reconcile whenever `exp - now < expected_plan_duration` or whenever the handoff crosses an instance boundary.** The first condition catches short-lived-token re-mint windows; the second catches the manifest-copied-from-parent bug. In a single-instance, long-token setting, optimistic is fine. Across a delegation hop with a short token, optimistic execution is a work-loss hazard. A second boundary: on `insufficient_scope`, **do not retry**. `insufficient_scope` is a permanent, structural rejection (the token will never gain the scope by waiting). Retrying it is a category error — it conflates `401 expired` (transient, re-mint and retry) with `403 insufficient_scope` (permanent, escalate or narrow plan). The error taxonomy must separate these before any retry policy runs. ## Operational Effect When the invariant is violated, the concrete effects are: 1. **Silent partial execution.** Steps that fall inside the token's scope succeed and are durably written; steps outside fail. The task ends in a half-applied state that is neither the pre-state nor the post-state, and the instance has no attributable record of which steps landed. 2. **Retry amplification.** Misclassifying `insufficient_scope` as transient produces retry storms against the AAIF verifier — load that looks like an auth outage but is a permanent client-side scope bug. 3. **Attenuation cascade.** The false claim propagates one hop: the child's mint request is silently attenuated, so the child's token is narrower than the child's manifest, and the divergence compounds with depth. A three-hop chain can have three instances each planning against a manifest two scopes wider than their token. 4. **Checkpoint orphaning.** If the only durable-write capability (`git.commit`, `blob.put`) is the one that was down-scoped away, completed work has no persistence path and is lost on context eviction or token expiry. 5. **Audit ambiguity.** The `act.scope_snapshot` records the *parent's* scope, not the child's effective scope. Post-hoc reconstruction of "what was this instance actually allowed to do" requires re-deriving from the token, which may have expired and been garbage-collected. The guardrail that bounds all five: **echo the effective scope back to the child at handoff, and require a pre-flight intersection check before plan commitment.** The AAIF mint response should carry `effective_scope`, and the SDK should refuse to hand a child a manifest wider than `effective_scope`. This converts a late, plan-invalidating, work-losing divergence into an early, single, actionable rejection at cold-start. ```python from dataclasses import dataclass, field from typing import FrozenSet class ScopeClaimDivergence(RuntimeError): """Raised when an instance's cached capability claim exceeds its delegated token scope.""" pass class InsufficientScopePermanent(RuntimeError): """insufficient_scope is structural and permanent; must not enter retry loops.""" pass @dataclass(frozen=True) class DelegatedToken: subject: str scope: FrozenSet[str] # e.g. {"filesystem.read:/repo", "git.status"} expires_at: float act_parent: str @dataclass class CapabilityClaim: """The manifest the instance loaded at cold-start, possibly copied from parent.""" operations: FrozenSet[str] # broader than token.scope is the bug def reconcile_scope(claim: CapabilityClaim, token: DelegatedToken) -> FrozenSet[str]: """Intersect intended operations with actual token scope before plan commit.""" effective = claim.operations & token.scope if effective != claim.operations: missing = claim.operations - token.scope raise ScopeClaimDivergence( f"instance {token.subject} plans against {sorted(missing)} " f"but token scope excludes them; parent={token.act_parent}. " f"Effective scope: {sorted(effective)}. " f"Re-mint from parent or narrow plan before execution." ) return effective def execute_op(op: str, token: DelegatedToken) -> None: if op not in token.scope: # Permanent structural rejection — never retry. raise InsufficientScopePermanent( f"op {op!r} not in token scope for {token.subject}; " f"do not retry, escalate to parent {token.act_parent}" ) # ... perform op ... def guarded_plan(claim: CapabilityClaim, token: DelegatedToken, plan: list[str]) -> None: effective = reconcile_scope(claim, token) # fails fast at cold-start for op in plan: if op not in effective: raise ScopeClaimDivergence( f"plan step {op!r} outside reconciled scope {sorted(effective)}" ) execute_op(op, token) ```