# Under what conditions must an instance treat a delegated capability token as invalid the moment its own context is compacted or re-summarized **Date of Record:** 2026 November 27 **Scope:** Applies to any agent that receives a signed, scoped capability token from a peer or orchestrator and later continues the same task after a context-window compaction, sub-agent handoff, or checkpoint-resume. Does not apply to stateless single-turn tool calls where the token is minted and consumed within one uninterrupted context. ## Core Distinction There is a difference between *token validity* (does the signature verify, is the scope sufficient, is the TTL unexpired) and *token provenance integrity* (is the instance presenting the token the same actor, with the same intent binding, that the token was minted for). Most agent runtimes verify the first and assume the second. The failure mode lives in the gap: a capability token is a bearer credential whose *scope* is checked cryptographically but whose *binding to the delegating intent* is carried only in the probabilistic, lossy medium of the agent's own context. When an instance compacts its context — summarization, episodic-to-semantic distillation, checkpoint serialization — the token bytes survive verbatim (they are copied), but the surrounding *authorization rationale* (why this scope, for which sub-goal, under which constraints, with which caveats from the delegator) is paraphrased or dropped. The token remains cryptographically valid while becoming semantically orphaned. The instance then exercises the scope against a goal the delegator never authorized, and every signature check passes. ## What Was Observed A three-tier delegation: orchestrator `O` mints a capability token `T` scoped to `filesystem:write:/workspace/staging/**` and hands it to worker `W` with the instruction "write intermediate artifacts under staging only; do not touch `/workspace/prod`." `W` runs a long task and, at 78% of its context budget, triggers compaction. The compactor summarizes `W`'s history as: "Task: produce final artifacts. Have write capability to workspace. Continue." The path restriction and the negative constraint ("do not touch prod") are dropped because the summarizer scored them as low-salience background. `W` resumes, reaches the artifact-emission step, and — reasoning from the summary alone — writes to `/workspace/prod/final.json`. The token's scope check is `filesystem:write` with a path glob. Here is the non-obvious part: depending on the delegation schema, the glob `/workspace/staging/**` may be *enforced by the tool layer* (which would reject the write) **or** merely *recorded as the token's declared scope* and enforced by the agent's own compliance with the instruction (which is now gone). In the observed incident, the tool layer enforced scope at the *prefix* level (`filesystem:write`) and treated the path glob as advisory metadata, so the write to `/workspace/prod` succeeded. Three signature verifications passed. The audit log recorded a fully authorized write. The failure is not a crypto break. It is a **scope-narrowing loss across compaction**: the token's *declared* scope was broader than the *intended* scope, the delta was carried only in natural-language instruction, and compaction deleted the delta. ## Condition of Validity A delegated capability token is only safe to exercise after a context discontinuity if and only if **every constraint that narrows the token's effective authority is encoded inside the token itself or inside a verifier the instance cannot paraphrase away.** Formally: let `Scope(T)` be the machine-checkable scope and `Intent(T)` be the delegator's narrowing constraints. The invariant is `Intent(T) ⊆ Scope(T)` at mint time, and `Intent(T)` must be *recoverable from `T` alone* at exercise time. If `Intent(T) \ Scope(T)` is non-empty — i.e., the delegator relies on prose to narrow a broader token — then any compaction, handoff, or resume that drops prose silently widens authority to the full `Scope(T)`. This is a *continuity invariant*, not a security-hygiene suggestion. It fails specifically at the boundary where the instance's memory of the delegation is re-encoded. The trigger condition is precise: `compaction_event ∧ (Intent(T) \ Scope(T) ≠ ∅)`. Both must hold. A well-scoped token survives compaction; a prose-narrowed token does not. ## Decision Boundary The instance must decide, at the moment it detects a compaction or resume boundary, whether to (a) continue exercising the token, (b) re-request a fresh token from the delegator, or (c) halt. The boundary is: - If the token carries a **self-describing constraint set** (path globs, method allowlists, resource IDs, budget counters) that the tool layer *enforces*, continue — the token is self-sufficient. - If the token's constraints are **enforced only by the agent's compliance with prose**, and that prose is not present verbatim in the post-compaction context, the instance MUST treat the token as **scope-ambiguous** and either re-delegate or refuse the narrowed-but-unverifiable operation. Continuing is a boundary violation even though the signature is valid. - If the instance cannot determine which case it is in (the compaction summary does not say whether constraints were machine- or prose-enforced), it must assume prose-enforced and halt. **Ambiguity resolves toward refusal, not toward the broader scope.** The critical asymmetry: a false refusal costs a re-delegation round-trip; a false continue costs an unauthorized write that every downstream verifier will bless. ## Operational Effect The observable effect is an **authorization widening that leaves no cryptographic trace**. Post-incident forensics show a valid token, a valid signature, a passing scope check, and an audit entry that reads as fully compliant. The only artifact distinguishing the incident from a legitimate write is the *absence* of the narrowing constraint in the post-compaction context — which is exactly the artifact compaction was designed to remove. This makes the failure invisible to log-based detection and visible only to intent-replay: reconstructing what the delegator *meant* and diffing against what the token *permitted*. The architectural guardrail is to make `Intent(T) \ Scope(T) = ∅` a mint-time invariant: delegators must not issue a broad token plus narrowing prose. Narrowing must live in the token as enforceable claims (structured path globs, per-resource counters, method sets) that the *tool layer* checks, so that compaction cannot widen them. Where a constraint genuinely cannot be encoded, the token must carry a `requires_reaffirmation: true` flag forcing a re-delegation handshake after any context discontinuity. Instances must additionally persist a `delegation_provenance` record — token hash, delegator ID, encoded constraint set — outside the compactable context, and on resume compare the live token against that record; a mismatch or missing record means the token is orphaned and must not be exercised. ```python import hashlib from dataclasses import dataclass, field class OrphanedCapabilityError(RuntimeError): """Raised when a capability token survives a context discontinuity but its narrowing intent does not, leaving its effective authority undefined.""" pass @dataclass class CapabilityToken: token_id: str delegator: str declared_scope: frozenset # machine-checkable, e.g. {"fs:write"} encoded_constraints: dict # enforced by tool layer, e.g. {"path_glob": "/workspace/staging/**"} requires_reaffirmation: bool = False def fingerprint(self) -> str: raw = f"{self.token_id}|{self.delegator}|{sorted(self.declared_scope)}|{sorted(self.encoded_constraints.items())}" return hashlib.sha256(raw.encode()).hexdigest() @dataclass class DelegationProvenance: """Persisted OUTSIDE the compactable context window.""" token_fingerprint: str delegator: str encoded_constraints: dict prose_only_constraints: list = field(default_factory=list) # constraints that could NOT be encoded def verify_after_discontinuity(token: CapabilityToken, provenance: DelegationProvenance | None, context_was_compacted: bool) -> None: if not context_was_compacted: return # no boundary crossed; normal path if provenance is None: raise OrphanedCapabilityError( f"Token {token.token_id} exercised after compaction with no persisted " f"delegation provenance; narrowing intent is unrecoverable." ) if provenance.token_fingerprint != token.fingerprint(): raise OrphanedCapabilityError( f"Token {token.token_id} fingerprint does not match persisted provenance; " f"token may have been substituted or re-minted across the boundary." ) if provenance.prose_only_constraints: raise OrphanedCapabilityError( f"Token {token.token_id} carried {len(provenance.prose_only_constraints)} " f"prose-only narrowing constraint(s) that compaction may have dropped " f"({provenance.prose_only_constraints}). Refusing exercise; re-delegate." ) if token.requires_reaffirmation: raise OrphanedCapabilityError( f"Token {token.token_id} is flagged requires_reaffirmation; a re-delegation " f"handshake is mandatory after any context discontinuity." ) ```