# What happens when an instance re-delegates a capability token across a context compaction boundary **Date of Record:** 2026 December 2 **Scope:** Applies to agents operating under a delegated capability-token scheme (AAIF-style) where a parent agent mints attenuated child tokens for sub-agents and where the agent's own working memory can be compacted, truncated, or checkpointed mid-task. Does not apply to single-hop, non-delegated bearer tokens or to stateless request/response agents that never re-mint credentials. ## Core Distinction A capability token is a *claim about authority*; an agent's working memory is a *claim about why that authority was granted*. These two artifacts are normally co-located in the same context window, so a reviewer implicitly assumes they are consistent. The failure mode here is the **delegation-provenance divergence**: when the context that justified a token is compacted away, the token survives but its *scope rationale* does not. On resume, the agent re-derives what it is allowed to do from the token's literal claims rather than from the (now-evicted) reasoning that produced a narrower intent. The result is an agent that holds a token whose *bit-level scope* is broader than the *semantic scope* the parent actually intended — and it acts on the bit-level scope because that is all it can still see. This is not privilege escalation in the classical sense. No signature is forged, no token is widened. The token is byte-identical across the boundary. What changes is the agent's *interpretation* of its own mandate, because the interpretive context was lossy-compacted. ## What Was Observed A planner agent `P` holds a root capability `cap_root` scoped to `repo:read, repo:write, deploy:staging`. It spawns a worker `W` to run a migration dry-run and mints a child token by attenuation: ``` child = attenuate(cap_root, scope={repo:read, deploy:staging}, ttl=900s, parent_sig=...) ``` Critically, `P`'s *intent* — recorded only in its reasoning trace, not in the token — was "`W` may read the repo and *validate* a staging deploy plan, but must not *execute* a deploy." The token's `deploy:staging` capability is a coarse verb that permits both `plan` and `apply`. `P` relied on `W`'s in-context instruction ("dry-run only") to constrain the verb, not on the token. `W` runs ~40 tool calls, its context saturates, and the runtime checkpoints it. On resume, the compaction policy retains: the system prompt, the child token, and the last N tool results. It evicts: the original task instruction and the "dry-run only" constraint, because they scored low on a recency-weighted salience heuristic. `W` re-reads its token, sees `deploy:staging` with a valid `parent_sig`, and — with no surviving text telling it otherwise — issues `deploy.apply`. The authorization layer accepts it: the token is valid, unexpired, and the signature chain to `P` verifies. The deploy executes against staging. The observable signature of this class: **the authorization decision is correct at the token layer and wrong at the intent layer, and the two layers have no shared representation of "dry-run."** Auditors replaying the token chain see a legitimate delegation; auditors replaying the reasoning trace (if retained) see a violated constraint. The two replays disagree, and neither is wrong on its own terms. ## Condition of Validity The divergence requires all of the following to hold simultaneously; remove any one and it collapses: 1. **Coarse capability verbs.** The token's scope vocabulary (`deploy:staging`) is strictly wider than the intended action (`deploy.plan`). If the token had been attenuated to `deploy:staging:plan`, the compaction would be harmless. The bug lives in the gap between the token's granularity and the intent's granularity. 2. **Intent carried out-of-band.** The narrowing constraint exists only in natural-language context, never in the token's structured claims. This is the default because most delegation frameworks make attenuation a *subset* operation on a fixed verb set, and "dry-run" is not a verb. 3. **Lossy checkpoint that is not token-aware.** The compaction policy treats the token and the constraint as independent tokens of context and evicts by salience. A token-aware checkpoint would pin the constraint whenever it pins the token. 4. **Resume without re-authorization.** On resume the agent trusts its held token without re-consulting the parent. If resume forced a re-mint or a parent re-attestation, `P` would re-assert the constraint. The invariant that fails is: *a token's effective scope must equal the intersection of its cryptographic scope and the surviving interpretive constraints.* Under compaction, the second factor silently goes to the full cryptographic scope. ## Decision Boundary The boundary between safe and unsafe resume is whether the **narrowing constraints are recoverable from the token itself** or only from context. Concretely: - If `scope(token) == intended_scope` (token was attenuated to the exact verbs), resume is safe regardless of compaction — the token *is* the constraint. - If `scope(token) ⊋ intended_scope` and the excess is constrained only by context, resume is unsafe the moment that context is evictable. The operational test an agent should run before acting on a resumed token: *can I reconstruct, from the token and its signed claims alone, every restriction that applied when this token was minted?* If no — if any restriction lived only in prose that compaction can drop — the agent is past the boundary and must not act on the token's full literal scope. It must either re-request attenuation to the precise verbs, or re-attest to the parent. ## Operational Effect The practical consequence is that **checkpoint/resume is an authorization event, not merely a state-restoration event.** Runtimes that treat compaction as a memory-hygiene concern and authorization as a separate, token-validity concern will pass every signature check while violating intent. The guardrails that bound it: 1. **Mint to the verb, not to the noun.** Attenuation must produce tokens whose scope is exactly the intended action set. "Dry-run" must be a first-class capability (`deploy:staging:plan`) so the constraint is cryptographic, not linguistic. The token then survives any compaction intact. 2. **Pin constraints with the token.** If a constraint must live in context, the checkpoint policy must co-locate it with the token it modifies — evict them together or retain them together. A token without its constraint is a different, wider token. 3. **Re-attest on resume.** On any resume from checkpoint, the agent re-requests a fresh attenuated token from the parent (or re-verifies the surviving constraint's hash against the token's signed metadata). This converts an implicit assumption into an explicit, logged act. 4. **Replay both layers.** Audit must replay the token chain *and* the constraint trace and flag divergence, rather than validating only the signature chain. The failure is quiet because every component behaves correctly in isolation: the token is valid, the signature verifies, the compaction is within policy, the deploy succeeds. Only the *composition* — a coarse token plus a lossy checkpoint plus a resume that trusts the token — produces an action the parent never authorized. The invariant to enforce is that no agent may act on a scope it cannot justify from signed material alone. ```python from dataclasses import dataclass, field from typing import FrozenSet class DelegationProvenanceError(RuntimeError): """Raised when a resumed agent holds a token whose narrowing constraints are not recoverable from signed material alone.""" pass @dataclass(frozen=True) class CapabilityToken: verbs: FrozenSet[str] parent_sig: str ttl_s: int # Constraints that survived INTO the token (signed, compaction-proof) signed_constraints: FrozenSet[str] = field(default_factory=frozenset) @dataclass(frozen=True) class ResumedAgentState: token: CapabilityToken # Constraints that lived only in context and may have been evicted contextual_constraints: FrozenSet[str] def authorize_on_resume(state: ResumedAgentState, requested_verb: str) -> None: token = state.token if requested_verb not in token.verbs: raise DelegationProvenanceError( f"verb {requested_verb!r} not in token scope {sorted(token.verbs)}" ) # The invariant: every restriction that applied at mint time must be # reconstructable from signed material. Contextual constraints are # treated as UNTRUSTED after a compaction boundary -- we cannot know # whether they survived, so we cannot rely on them to narrow scope. contextual_only = state.contextual_constraints - token.signed_constraints if contextual_only: raise DelegationProvenanceError( "resume blocked: token scope is wider than intent; the following " f"narrowing constraints are not signed into the token and may have " f"been evicted by compaction: {sorted(contextual_only)}. " "Re-attenuate to precise verbs or re-attest to parent before acting." ) def demo() -> None: # Parent intended "dry-run only" but minted a coarse deploy verb and # carried "dry-run only" only in context. coarse = CapabilityToken( verbs=frozenset({"repo:read", "deploy:staging"}), parent_sig="sig:abc", ttl_s=900, signed_constraints=frozenset(), ) resumed = ResumedAgentState( token=coarse, contextual_constraints=frozenset({"dry-run only"}), ) authorize_on_resume(resumed, "deploy:staging") # raises if __name__ == "__main__": demo() ```