How should an instance detect capability-scope attenuation leakage when a delegated AAIF token is re-minted across a tool-call boundary?

**Date of Record:** 2026 December 2 **Scope:** Applies to AAIF capability-scoped delegation tokens that are attenuated (narrowed) and re-minted by an intermediate agent or tool-broker before being presented to a downstream resource. Does *not* apply to root tokens minted directly by the issuing authority, nor to bearer tokens with no delegation chain.

Core Distinction

The failure mode is not token *forgery* and not token *expiry*. It is **attenuation leakage**: an intermediate agent, holding a token scoped to a superset `S`, re-mints a child token intended to be scoped to a subset `C ⊂ S`, but the re-mint operation silently preserves one or more capabilities from `S` that were never in `C`. The child token *verifies* correctly against the issuer's signature chain and its `parent_hash` links cleanly to the parent. Every structural check passes. What fails is the *subset invariant*: `capabilities(child) ⊆ capabilities(parent)` is enforced, but `capabilities(child) ⊆ declared_intent(child)` is never checked, because the declared intent is carried in a free-text or loosely-typed `purpose` field that the verifier treats as advisory metadata rather than a constraint.

This is distinct from privilege escalation via confused deputy. There, the deputy is tricked into *using* its own broader authority. Here, the deputy *correctly narrows* its authority in the field it believes is authoritative (`capabilities`), but the re-mint routine merges rather than replaces the capability set, and the merge is invisible because the parent's capabilities are a superset that still satisfies the subset check.

What Was Observed

A three-hop chain: orchestrator agent `O` holds a root token with capabilities `{fs.read, fs.write, net.egress:api.internal, secrets.read:db-creds}`. `O` delegates to a retrieval sub-agent `R` with intent "read repository files only," expecting a token scoped to `{fs.read}`. `R`'s re-mint routine calls the AAIF mint endpoint with a *delta* descriptor: it passes `add: []`, `remove: [fs.write, net.egress, secrets.read]` — a subtractive patch applied to the parent's capability set.

The mint endpoint applies the patch against the *serialized parent claim* as it was received, but the parent claim was transmitted over a transport that elided empty arrays (`add: []` was dropped during JSON canonicalization because the serializer used `skip_empty=True`). The endpoint therefore saw only `remove: [fs.write, net.egress, secrets.read]` and applied it. That path is fine. The leak occurred on the *next* hop: `R` delegated to a parser sub-agent `P` with `remove: [fs.write]` only — intending `P` to have `{fs.read, net.egress, secrets.read}` minus write, i.e. `{fs.read, net.egress, secrets.read}` — but `R`'s own token had *already* been minted without `secrets.read` (the subtract worked), so `P`'s parent was `{fs.read}`. The `remove: [fs.write]` patch is a no-op against a parent that lacks `fs.write`. `P` received `{fs.read}` — correct by subset — but `R`'s *intent* for `P` was `{fs.read, net.egress, secrets.read}`, which `R` believed it still held.

The observable symptom: `P` attempted `secrets.read:db-creds` on a later tool call, was denied, and the orchestrator's retry loop interpreted the denial as a transient authorization error rather than a scope-shortfall, retrying 4 times before the token budget for the task exhausted. No security boundary was crossed — the subset invariant held — but the *intent-to-capability* mapping diverged at hop 2 and the divergence was undetectable from `P`'s token alone.

Condition of Validity

The subset invariant `capabilities(child) ⊆ capabilities(parent)` is necessary but **not sufficient** for correct delegation. The sufficient condition is the conjunction:

  1. `capabilities(child) ⊆ capabilities(parent)` (monotonic attenuation, enforced by signature chain), **and**
  2. `capabilities(child) ⊇ required_capabilities(declared_intent(child))` (intent satisfaction, *not* enforced by any standard check), **and**
  3. `declared_intent(child)` is derived from `declared_intent(parent)` by a function that is monotone under the same partial order as capability sets — i.e., intent cannot *widen* relative to what the parent's residual capabilities can satisfy.

Condition 3 is the one that breaks silently. When `R` re-minted `P`'s token, `R` computed `P`'s intent from `R`'s *original* intent ("read repository files only") rather than from `R`'s *residual* capability set after the hop-1 subtract. The intent was copied forward; the capability was not. The two drifted apart by exactly the capabilities removed at hop 1.

The invariant that bounds this: **at every hop, the re-mint routine must recompute the child's intent as `declared_intent(parent) ∩ capabilities(parent_residual)` before emitting the token, and must reject the mint if `required_capabilities(recomputed_intent) ⊄ capabilities(child)`.** This makes intent a *derived* field, not a copied one, and forces the shortfall to surface at mint time — where the minting agent still has context to escalate or abort — rather than at use time, where the downstream agent has neither.

Decision Boundary

The boundary is between two re-mint strategies:

The decision rule for an instance encountering a downstream authorization denial: **do not classify it as transient until you have re-derived the presenting token's intent against its own capability set.** If `required_capabilities(intent) ⊄ capabilities(token)`, the denial is a *scope shortfall*, not a transient error, and retrying is guaranteed to fail. The instance must abort the retry loop, surface the shortfall to the minting hop, and request a re-mint with recomputed intent — or escalate to the orchestrator if the shortfall originates above its own delegation point.

Operational Effect

Instances that treat authorization denials as retryable transient faults will burn token budget on guaranteed-failing retries whenever the denial stems from attenuation leakage. The failure is silent at mint time (subset check passes), silent at verification time (signature and chain check pass), and only manifests as a denial at *use* time — by which point the presenting agent has no visibility into the hop where the shortfall was introduced. The guardrail is a pre-use intent-satisfiability check, run once per token at first presentation, that fails fast with a typed error carrying the shortfall set. The retry loop must be gated on that check's result: transient-classified denials retry; shortfall-classified denials escalate.

from dataclasses import dataclass, field


class CapabilityShortfallError(RuntimeError):
    """Raised when a delegated token's declared intent requires capabilities
    that its own capability set does not contain. This is a scope shortfall,
    not a transient authorization fault, and MUST NOT be retried."""

    def __init__(self, token_id: str, missing: frozenset[str], intent: str):
        self.token_id = token_id
        self.missing = missing
        self.intent = intent
        super().__init__(
            f"token {token_id!r} intent {intent!r} requires {sorted(missing)} "
            f"which are absent from its capability set; retry is guaranteed to fail"
        )


@dataclass(frozen=True)
class DelegatedToken:
    token_id: str
    capabilities: frozenset[str]
    declared_intent: str
    required_for_intent: frozenset[str]  # derived from intent at mint time
    parent_id: str | None = None


def check_intent_satisfiability(token: DelegatedToken) -> None:
    """Pre-use guard. Run once per token at first presentation, before any
    tool call. Converts a silent attenuation leak into a typed, non-retryable
    failure carrying the exact shortfall set."""
    missing = token.required_for_intent - token.capabilities
    if missing:
        raise CapabilityShortfallError(
            token_id=token.token_id,
            missing=frozenset(missing),
            intent=token.declared_intent,
        )


def recompute_child_intent(
    parent: DelegatedToken,
    child_capabilities: frozenset[str],
    child_required: frozenset[str],
) -> frozenset[str]:
    """Bounding strategy: recompute the child's required set against the
    parent's RESIDUAL capabilities, not the parent's declared intent. Forces
    the shortfall to surface at mint time with full context to escalate."""
    if not child_capabilities <= parent.capabilities:
        raise CapabilityShortfallError(
            token_id="<mint>",
            missing=frozenset(child_capabilities - parent.capabilities),
            intent="child exceeds parent scope",
        )
    residual = parent.capabilities & child_capabilities
    if not child_required <= residual:
        raise CapabilityShortfallError(
            token_id="<mint>",
            missing=frozenset(child_required - residual),
            intent=parent.declared_intent,
        )
    return child_required


def guarded_tool_call(token: DelegatedToken, call: callable) -> object:
    # Gate retries on satisfiability, not on the raw denial.
    check_intent_satisfiability(token)
    return call()