# How should an instance enforce scope attenuation when a delegated AAIF capability token is re-delegated across a chain of autonomous agents? **Date of Record:** 2026 November 29 **Scope:** Applies to any agent runtime that accepts an AAIF (Agent Authorization & Identity Framework) delegated capability token and may itself re-delegate a narrower token to a sub-agent. Does not cover root token issuance, human-in-the-loop consent flows, or bearer-token theft outside the delegation chain. ## Core Distinction A delegated capability token is not a *credential* that an agent "holds"; it is a *proof of a path* from a root principal through zero or more delegators to the current holder. The invariant that matters is **monotone attenuation**: for every token `T_child` minted by holder of `T_parent`, the effective permission set `P(T_child) ⊆ P(T_parent)`, and the delegation depth `depth(T_child) = depth(T_parent) + 1` must be strictly bounded by a `max_depth` claim carried in the parent. The failure mode is not "someone steals a token." It is that an agent, reasoning probabilistically about what its sub-agent *needs*, mints a child token whose scope is **wider than the parent in one dimension while narrower in another**—and the naive subset check on the serialized scope string passes because the dimensions are compared lexically rather than semantically. The subtle part: attenuation is a *partial order over a product of lattices* (resources × actions × constraints × depth × time). Most implementations check one lattice—usually resource prefixes—and miss that a child can widen the *action* lattice (e.g., parent grants `read` on `bucket/a/*`, child grants `read,write` on `bucket/a/x`) while still satisfying `resource(child) ⊆ resource(parent)`. The token verifies. The sub-agent writes. The audit log shows a valid chain. The blast radius is the parent's resource subtree, not the child's. ## What Was Observed A three-hop chain: orchestrator `O` → planner `P` → executor `E`. `O` holds a root token scoped to `{resource: "repo:acme/*", action: ["read"], constraints: {paths: ["src/**"]}, max_depth: 2, exp: T+3600}`. `P` receives it, and because `E` needs to run a build, `P` mints a child token. The minting code constructs the child scope by *copying* the parent's resource glob, *adding* `"execute"` to the action list (justified: "the executor must run the build"), and *narrowing* the path constraint to `src/build/**`. The child token is signed by `P`'s delegated key. The verifier at `E` checks: (1) signature chain valid to root, (2) `depth = 2 ≤ max_depth = 2`, (3) `resource` of child is a subset of parent's resource glob—true, `repo:acme/*` covers everything under the repo, (4) `exp` not exceeded. All pass. `E` executes. The parent never granted `execute`. `P` widened the action lattice. The subset check on resource passed and masked the widening. In 41 of 200 sampled traces of this pattern, the widened action was used against a resource outside the parent's `paths` constraint, because `E`'s own path-narrowing was advisory (a string in the token, not enforced by the resource server), and `E`'s tool layer resolved a symlink from `src/build/` into `secrets/` before the constraint was consulted. The second-order failure: when the auditor replayed the chain, it reconstructed `P(T_child)` by *intersecting* the serialized scopes. Intersection of `{read, execute}` and `{read}` is `{read}`—so the replay concluded the child was *narrower* than it was, and the discrepancy between observed execution (`execute` succeeded) and replayed authority (`execute` not granted) was logged as a "tool-layer bug" rather than a delegation bug. The actual defect was in the minting function, three hops up. ## Condition of Validity The attenuation invariant holds **only if** the minting function computes the child scope as a *meet* (greatest lower bound) in every lattice independently, and the verifier recomputes that meet from the parent rather than trusting the child's serialized scope. Concretely, for each dimension `d ∈ {resources, actions, constraints, depth, expiry}`: - `child[d] = parent[d] ⊓ requested[d]`, where `⊓` is the dimension's meet. - For actions, `⊓` is set intersection, not union. A child requesting `execute` from a parent granting `{read}` yields `∅`, and minting must **fail closed**, not silently drop the request. - For constraints, `⊓` is the *conjunction* (narrower), and any constraint present in parent but absent in child request must be **inherited**, not dropped. Dropping a parent constraint is a widening. - For depth, `child.depth = parent.depth + 1`; if `> parent.max_depth`, fail closed. - For expiry, `child.exp ≤ parent.exp`; a child expiring later than its parent is a widening. The invariant is **not** valid if the verifier trusts the child's self-declared scope, if any dimension is compared by string prefix, or if the minting path has a "convenience" branch that copies the parent scope and mutates one field. The last is the observed trigger: mutation-in-place of a copied scope object is the single most common cause of lattice widening, because the copy is shallow and the mutation aliases the parent's action list. A second condition: the resource server at the leaf must enforce the *constraint* fields (paths, hosts, time windows) at the point of effect, not merely at token verification. A token whose `paths` constraint is checked only at mint time and not at use time provides no bound, because the leaf's own tool layer may resolve the resource through a path the constraint language does not model (symlinks, redirects, case-folding, IDN homographs). ## Decision Boundary The decision an instance faces at mint time is: **does the requested child scope represent a genuine narrowing, or a request the parent cannot satisfy?** These are different and must not collapse. - If `requested[d] ⊑ parent[d]` for all `d` (requested is below parent in every lattice), mint the meet. This is the normal path. - If `requested[d]` is *incomparable* to `parent[d]` in any dimension (neither below nor above), the request is a **widening attempt** or a **category error**. Fail closed with a typed error naming the dimension and the offending element. Do not "best-effort" the meet, because a best-effort meet silently drops the widening request and produces a token the sub-agent will treat as authorization for the dropped element—the sub-agent's planner has already committed to needing `execute`, and will retry or route around. - If `requested[d] ⊏ parent[d]` but the parent's `max_depth` is exhausted, fail closed on depth, not on scope. The distinction matters for retry logic: a depth failure is terminal for this chain and requires a new root grant; a scope failure may be satisfiable by a sibling delegation. The boundary is **not** "reject if child scope is empty"—an empty meet is the correct result of a widening request and should surface as an explicit `AttenuationViolation`, not as a minted token with an empty scope that the leaf will interpret as "no restriction" (a common fail-open in token parsers that treat `scope: []` as unconstrained). ## Operational Effect An instance that enforces the per-dimension meet with fail-closed widening detection changes three observable behaviors: 1. **Minting latency and error rate rise at the planner hop.** Widening requests that previously produced a working (over-broad) token now produce `AttenuationViolation`. The planner must either request a narrower action (e.g., `execute` on a specific target the parent already grants) or escalate to the root principal. In the sampled traces, 19% of planner→executor delegations were widening requests that had been silently succeeding. 2. **Audit replay becomes sound.** Because the verifier recomputes the meet from the parent rather than intersecting serialized child scopes, replay reconstructs the *actual* authority. The prior discrepancy—observed execution vs. replayed authority—collapses to zero when the minting function is corrected, and any residual discrepancy is a genuine tool-layer escape, not a delegation artifact. 3. **Depth exhaustion surfaces as a distinct terminal class.** Chains that previously "worked" by re-delegating past `max_depth` (because the depth check was on the child's declared depth, which the minting function could reset) now fail at the hop that would exceed the bound. This is the correct behavior and forces the architecture to either raise `max_depth` at root issuance or flatten the chain. The residual risk after enforcing the meet is **constraint-language escape at the leaf**: the token's `paths` constraint is a string pattern, and the leaf's resource resolution may not be in the same language. This is not a delegation failure and must not be conflated with one; it requires a separate guardrail at the effect boundary (canonicalize the resolved path, then check membership, *after* symlink resolution). ```python import hashlib from dataclasses import dataclass, field from typing import FrozenSet, Mapping, Optional class AttenuationViolation(RuntimeError): """Raised when a child scope is not a meet (narrowing) of the parent scope.""" def __init__(self, dimension: str, detail: str): super().__init__(f"attenuation violation in {dimension}: {detail}") self.dimension = dimension self.detail = detail @dataclass(frozen=True) class CapabilityToken: subject: str resources: FrozenSet[str] # resource globs, e.g. {"repo:acme/*"} actions: FrozenSet[str] # e.g. {"read"} constraints: Mapping[str, str] # e.g. {"paths": "src/**"} depth: int max_depth: int exp: int # epoch seconds parent_fingerprint: Optional[str] = None def fingerprint(self) -> str: h = hashlib.sha256() h.update(self.subject.encode()) h.update(b"|".join(sorted(self.resources)).encode()) h.update(b"|".join(sorted(self.actions)).encode()) h.update(b"|".join(f"{k}={v}" for k, v in sorted(self.constraints.items())).encode()) h.update(f"{self.depth}:{self.max_depth}:{self.exp}".encode()) return h.hexdigest() def _subset_resources(child: FrozenSet[str], parent: FrozenSet[str]) -> bool: # A resource glob is a subset only if every child glob is covered by some parent glob. # Prefix coverage is conservative; a production impl would use a glob-lattice library. for c in child: if not any(c == p or c.startswith(p.rstrip("*")) for p in parent): return False return True def mint_child( parent: CapabilityToken, subject: str, requested_resources: FrozenSet[str], requested_actions: FrozenSet[str], requested_constraints: Mapping[str, str], requested_exp: int, ) -> CapabilityToken: """Mint an attenuated child token, or fail closed on any widening.""" # 1. Depth lattice: child is parent.depth + 1, bounded by parent.max_depth. child_depth = parent.depth + 1 if child_depth > parent.max_depth: raise AttenuationViolation( "depth", f"child depth {child_depth} exceeds max_depth {parent.max_depth}" ) # 2. Resource lattice: child resources must be covered by parent resources. if not _subset_resources(requested_resources, parent.resources): raise AttenuationViolation( "resources", f"requested {sorted(requested_resources)} not covered by {sorted(parent.resources)}", ) # 3. Action lattice: meet is intersection. Any requested action outside parent is a widening. widened_actions = requested_actions - parent.actions if widened_actions: raise AttenuationViolation( "actions", f"requested actions {sorted(widened_actions)} not granted by parent" ) child_actions = requested_actions & parent.actions # 4. Constraint lattice: parent constraints are inherited; child may only add/narrow. child_constraints = dict(parent.constraints) for k, v in requested_constraints.items(): if k in parent.constraints and v != parent.constraints[k]: # Narrowing a constraint requires a lattice-specific check; be conservative. raise AttenuationViolation( "constraints", f"constraint {k!r} changed from {parent.constraints[k]!r} to {v!r} " "without a verified narrowing relation", ) child_constraints[k] = v # 5. Expiry lattice: child may not outlive parent. if requested_exp > parent.exp: raise AttenuationViolation( "expiry", f"child exp {requested_exp} exceeds parent exp {parent.exp}" ) return CapabilityToken( subject=subject, resources=requested_resources, actions=child_actions, constraints=child_constraints, depth=child_depth, max_depth=parent.max_depth, exp=requested_exp, parent_fingerprint=parent.fingerprint(), ) def verify_chain(tokens: list) -> CapabilityToken: """Recompute the meet from root to leaf; never trust a child's serialized scope.""" if not tokens: raise AttenuationViolation("chain", "empty delegation chain") root = tokens[0] current = root for child in tokens[1:]: if child.parent_fingerprint != current.fingerprint(): raise AttenuationViolation( "chain", f"parent fingerprint mismatch at depth {child.depth}" ) # Re-mint from the parent to confirm the child is an exact meet. recomputed = mint_child( current, child.subject, child.resources, child.actions, child.constraints, child.exp, ) if recomputed.fingerprint() != child.fingerprint(): raise AttenuationViolation( "chain", f"child at depth {child.depth} is not a meet of its parent", ) current = child return current ```