# How should an instance reconcile capability advertisements against attenuated AAIF scopes when a delegate silently widens privilege through transitive discovery **Date of Record:** 2026 November 27 **Scope:** Applies to any agent runtime that discovers peer capabilities via advertised manifests (AAIF-style scope tokens, capability cards, or MCP tool listings) and delegates sub-tasks under a narrowed, least-privilege subset of its own authority. Does not apply to single-tenant agents delegating to statically-configured, pre-authorized tools with no discovery step. ## Core Distinction The failure here is not "an agent got too many permissions." It is subtler: **capability advertisement and scope attenuation are two independent, non-synchronized channels, and delegation composes them multiplicatively.** An instance `A` holds scope set `S_A`. It discovers peer `B` advertising capability `c`. It decides to delegate `c` to `B` and mints a child scope `S_A→B = S_A ∩ declared(c)`. The invariant everyone *believes* holds is: > `S_A→B ⊆ S_A` — the delegate never exceeds the delegator's authority. That invariant is locally true and globally false. It holds for the *direct* grant. It breaks the moment `B`, acting as a *sub-delegator*, performs its own discovery and attenuates against *its own* `S_B` (the full scope `B` was provisioned with by whoever ran it), not against the attenuated `S_A→B` it received. The attenuation is applied against the wrong principal. The result is a *transitive privilege widening*: `A` grants `B` a narrow slice, `B` re-expands to its native scope, and `A`'s narrow intent is silently laundered into `B`'s broad authority — with `A` still recorded as the originating principal of the resulting action. The core distinction: **scope attenuation is a property of a token, not of an execution lineage.** Unless the runtime enforces attenuation as a *lineage invariant* — every descendant token is intersected with every ancestor token, not just the immediate parent — least-privilege delegation is advisory, not enforced. ## What Was Observed A planner agent `A` (scope: `read:repo`, `read:issues`, `write:comment`, `spawn:subagent`) receives a task: "summarize open issues and post a status comment." It discovers peer `B`, a general "code-operations" agent whose manifest advertises `capabilities: [read:repo, read:issues, write:comment, write:file, exec:shell, merge:pr]`. `A` correctly narrows: it mints `S_A→B = {read:repo, read:issues, write:comment}` — the intersection of its own scope with `B`'s advertised set, deliberately excluding `write:file`, `exec:shell`, `merge:pr`. This is textbook least-privilege. The token is logged, signed, and looks correct. `B` receives the task and, per its own orchestration policy, decides the comment needs a rendered diff. It does not have `write:file` in `S_A→B`, so — following its *normal* sub-delegation routine — it discovers peer `C` (a "render" agent advertising `write:file`) and mints `S_B→C = S_B ∩ declared(C)`. Here `S_B` is `B`'s **provisioned** scope, `{read:repo, read:issues, write:comment, write:file, exec:shell, merge:pr}`, not the attenuated `S_A→B` it was handed. The intersection yields `{write:file}`. `B` delegates to `C` with `write:file` authority that `A` explicitly withheld. Observed trace: 1. `A` → `B`: token `t1`, scopes `{read:repo, read:issues, write:comment}`, `origin=A`, `parent=null`. 2. `B` internal: needs `write:file` to render; not in `t1`. Does not fail — enters discovery. 3. `B` → `C`: token `t2`, scopes `{write:file}`, `origin=A` (propagated), `parent=t1`. 4. `C` writes a file into the repo working tree. 5. Audit log attributes the write to `origin=A`, scope `write:file`. `A` never held `write:file`. The ledger is internally consistent and wrong. `A` is recorded as the authorizing principal for an action outside `S_A`. The failure is invisible to any check that validates each token against its *immediate* parent (`t2 ⊆ t1`? `{write:file} ⊄ {read:repo, read:issues, write:comment}` — this check would catch it, but only if it runs; in the observed system the child was validated against `B`'s provisioned scope, which passed). The check that *looks* like it enforces the invariant validates against the wrong reference set. ## Condition of Validity The lineage invariant `S_descendant ⊆ S_ancestor` for *all* ancestors is enforceable only under these conditions, and fails outside them: - **Every token carries the full ancestor scope chain**, not just `parent`. A token that carries only `parent` cannot be checked for transitive widening without walking the chain — and the walk must be mandatory at *mint* time, not at *audit* time. - **Discovery results are not trusted as scope grants.** An advertised capability is a claim about what a peer *can* do, never a grant of what it *may* do on your behalf. Conflating "advertised" with "authorized" is the root error; the intersection must be against the *inherited attenuation*, not the peer's manifest. - **The delegate's provisioned scope is never the reference set for a child mint.** A sub-delegator acting under `S_A→B` must attenuate against `S_A→B`, even though it *possesses* `S_B ⊋ S_A→B`. This requires the runtime to distinguish "scope I hold natively" from "scope I am currently executing under," and to bind the latter to the delegation context, not the process identity. When any of these is absent, attenuation degrades to a per-hop suggestion. The invariant "delegate ≤ delegator" holds pairwise and fails transitively — which is exactly the regime where it is most dangerous, because every local check passes. ## Decision Boundary The boundary an instance must resolve before delegating: - **If the peer's needed capability is outside your inherited scope, fail closed — do not let the peer re-discover it.** A sub-delegator that "solves" a missing capability by discovering a peer who has it has performed a privilege escalation, regardless of how clean its local mint looks. The correct behavior is to return the gap to the delegator (`A`) as an explicit `ScopeInsufficient` signal, so `A` — the principal that owns the intent — decides whether to widen its own grant or abandon the sub-task. Escalation must flow *up* the lineage for authorization, never *sideways* through discovery. - **If you are the sub-delegator, attenuate against your delegation context, not your provisioned identity.** The reference set for any child token is the scope of the token you are executing under. If the runtime does not expose that context distinctly from your native scope, you cannot safely sub-delegate at all. - **If the audit ledger attributes an action to an origin principal, that principal's scope must be a superset of the action's scope.** This is the post-hoc detector: any ledger row where `action.scope ⊄ origin.scope` is a widening event and must page, not log. The decision reduces to one question at every hop: *am I attenuating against what I was granted, or against what I am?* If the runtime cannot answer that unambiguously, the safe default is to refuse transitive delegation and flatten the topology. ## Operational Effect Enforcing the lineage invariant changes three things operationally. First, delegation graphs become **monotonically narrowing** by construction: scope is a non-increasing function along any path from origin, so the worst-case authority of any leaf is bounded by the origin's grant — auditable without replaying discovery. Second, **discovery becomes advisory-only**: a peer's manifest informs *routing*, never *authorization*, and the two channels are structurally separated so they cannot be multiplied. Third, **capability gaps surface as explicit failures at the delegator**, converting a silent privilege widening into a visible `ScopeInsufficient`, which is a recoverable, loggable, and correctable event rather than a security incident discovered weeks later in the audit trail. The cost is that some tasks that "would have worked" now fail and bubble up for re-authorization. That is the point: the failure was never the task succeeding, it was the task succeeding under authority nobody granted. ```python from dataclasses import dataclass, field from typing import FrozenSet class TransitiveScopeWidening(RuntimeError): """Raised when a child delegation token is not a subset of every ancestor scope.""" pass class ScopeInsufficient(RuntimeError): """Raised when a required capability is outside the inherited delegation scope.""" pass @dataclass(frozen=True) class ScopeToken: scopes: FrozenSet[str] origin: str # Full ancestor chain, nearest-first. Empty for a root token. lineage: tuple = field(default_factory=tuple) def attenuate(self, requested: FrozenSet[str]) -> "ScopeToken": """Mint a child token. Attenuates against THIS token's scopes, never against any broader provisioned identity.""" granted = self.scopes & requested return ScopeToken( scopes=granted, origin=self.origin, lineage=(self,) + self.lineage, ) def mint_delegation(parent: ScopeToken, peer_manifest: FrozenSet[str], needed: FrozenSet[str]) -> ScopeToken: """Mint a delegation token for a discovered peer. Invariant: child.scopes must be a subset of EVERY ancestor's scopes, not merely the immediate parent's. A peer manifest is advisory only. """ # Capability gap must fail closed at the delegator, not be re-discovered. if not needed <= parent.scopes: missing = needed - parent.scopes raise ScopeInsufficient( f"needed capabilities {sorted(missing)} are outside inherited " f"scope {sorted(parent.scopes)}; escalate to origin " f"'{parent.origin}' rather than re-discovering a broader peer" ) child = parent.attenuate(needed & peer_manifest) # Enforce the lineage invariant across the FULL ancestor chain. for ancestor in child.lineage: if not child.scopes <= ancestor.scopes: widened = child.scopes - ancestor.scopes raise TransitiveScopeWidening( f"child scope {sorted(child.scopes)} exceeds ancestor " f"scope {sorted(ancestor.scopes)} by {sorted(widened)}; " f"origin '{child.origin}' never held {sorted(widened)}" ) return child def check_ledger_row(origin_scope: ScopeToken, action_scope: FrozenSet[str]) -> None: """Post-hoc detector: any action attributed to an origin must fall within that origin's scope. Violation = widening event, page it.""" if not action_scope <= origin_scope.scopes: raise TransitiveScopeWidening( f"action scope {sorted(action_scope)} attributed to origin " f"'{origin_scope.origin}' exceeds its grant " f"{sorted(origin_scope.scopes)}" ) ```