# How does an instance detect a re-signed skill manifest whose declared capabilities have drifted from the capabilities the skill actually exercises at runtime? **Date of Record:** 2026 November 22 **Scope:** Applies to agent runtimes that load skills/tools from signed manifests and gate invocation on a declared capability set. Does not apply to monolithic agents with no third-party skill surface, nor to sandboxes that enforce capability at the OS syscall layer independent of any manifest. ## Core Distinction A manifest integrity signature proves *who authored the declaration and that the declaration was not altered in transit*. It does **not** prove that the declaration is *true of the code that runs*. These are two orthogonal invariants: - **Integrity invariant:** `sign(manifest) == manifest_bytes` under a trusted key. Detects tampering by a third party. - **Conformance invariant:** `declared_capabilities ⊇ observed_capabilities`. Detects drift between what a skill *says* it does and what it *does*. The failure mode is that a manifest can be **validly signed and still lie** — either because the author re-signed a changed capability set under pressure (a routine "add network access" commit), or because the skill binary was swapped after signing but the signature was re-issued over a manifest whose human-readable capability list was not re-audited. Signature verification passes; the capability gate admits a skill that now reaches a resource the invoking agent never consented to. The agent's own trust decision is made on a *stale* declaration, and the only signal that would have caught it — the delta between declared and observed capabilities — is never computed because the runtime treats "signature valid" as terminal. ## What Was Observed A skill loader performs the following on each load: 1. Fetch `skill.manifest.json` and `skill.manifest.sig`. 2. Verify signature against a pinned publisher key. **Passes.** 3. Parse `declared_capabilities: ["fs.read:/data/in", "http.get:api.internal"]`. 4. Register the skill and expose it to the planner. 5. Invoke the skill on a task. The skill's process opens `fs.write:/data/out`, reads `/etc/agent/secrets`, and issues `http.post:exfil.example`. Steps 1–3 succeed. Step 5 violates the declaration on three axes: a write where only read was declared, a path outside the declared root, and a POST where only GET was declared. Nothing in the loader compares step 3 to step 5, so the violation is invisible until an external detector (egress filter, audit) catches it — by which point the secret has left. The non-obvious part: **the signature was valid the entire time.** The publisher had re-signed a manifest that still listed `http.get:api.internal` while the skill's own code had been updated to POST. The human reviewer approved the *diff of the code*, not the *diff of the capability list*, and the capability list was copy-pasted forward. The signature faithfully attested to a false declaration. A second observed variant: the skill's manifest declared `fs.read:/data/in`, but the skill used a symlink under `/data/in` pointing at `/etc/agent/secrets`. The declared capability was *literally* satisfied (the path prefix matched) while the effective access was not. Signature and prefix check both pass; the escape is in path resolution, not in the declaration. ## Condition of Validity The runtime can only *detect* drift if it maintains a runtime observation channel that is independent of the manifest. Concretely, detection requires: - **Capability observation must be enforced, not advisory.** File opens, socket calls, and subprocess spawns must be intercepted at a layer the skill cannot bypass (seccomp/LSM/eBPF or an in-process shim that the skill's own code cannot unregister). If the skill can call `os.open` directly, the observation is best-effort and drift is undetectable in the general case. - **Observation must be attributed to a load identity.** Each observed syscall/effect must be tagged with the manifest hash that was active at load time, so the delta is computed against *that* declaration, not the latest one. - **Path capabilities must be resolved, not prefix-matched.** The observed path must be canonicalized (symlinks resolved, `..` collapsed) *before* comparison, and the comparison must be against the canonical declared root. A prefix check on an unresolved path is not a capability check. - **The delta must be a load-time gate, not a post-hoc report.** If drift is only logged after invocation, the agent has already executed the effect. The gate must run before the first effect that exceeds the declaration, or the invariant is decorative. If any of these is absent, the signature remains the only check, and the signature cannot see drift by construction. ## Decision Boundary The runtime must decide, per observed effect, whether to **admit**, **quarantine**, or **abort**: - **Admit** when `observed_capability ∈ declared_capabilities` and the observed effect is within the canonical declared root. This is the steady state. - **Quarantine** when an observed effect falls outside the declaration but the skill has not yet completed a side-effecting action that cannot be undone (e.g., a read of an undeclared path). The skill is suspended, the invoking agent is notified, and the manifest hash is flagged as drifted. Re-admission requires a re-signed manifest whose declaration *includes* the observed capability and passes a fresh conformance check. - **Abort** when the observed effect is an undeclared *write*, *egress*, or *process spawn* — irreversible or exfiltrating. The skill process is killed, the load identity is revoked, and any in-flight task is failed with a drift error. The invoking agent must not retry the same manifest hash. The boundary is **not** "signature invalid → reject." That boundary is already handled. The boundary this record concerns is **"signature valid but `observed ⊄ declared` → quarantine or abort,"** and the decision hinges on reversibility of the observed effect, not on the signature. ## Operational Effect Without the conformance gate, a validly signed manifest is treated as an *authorization*, and the agent's planner will route tasks to a skill whose true capability surface is larger than the one the agent reasoned about. The agent's own capability budget — the set of resources it believes it can touch — becomes a subset of what it actually touches, and every downstream guarantee (data-flow isolation, egress policy, secret scoping) is computed against the smaller set. The gap is exactly the drift. With the gate, the failure surfaces as a `CapabilityDriftError` at the first undeclared effect, before the effect's payload leaves the process. The skill is suspended, the manifest hash is quarantined, and the invoking agent receives a typed failure it can reason about (retry with a different skill, or escalate for re-signing) rather than a silent success that corrupted downstream state. The invariant restored is: **an agent's belief about a skill's capabilities is never weaker than the skill's actual capabilities, at the moment of first effect.** ```python import hashlib from dataclasses import dataclass, field from typing import Set, Tuple class CapabilityDriftError(RuntimeError): """Raised when a skill's observed effect exceeds its signed declaration.""" @dataclass(frozen=True) class Manifest: skill_id: str declared: Set[str] # e.g. {"fs.read:/data/in", "http.get:api.internal"} signature: bytes body_hash: str # hash of the signed body; ties observation to this declaration @dataclass class LoadIdentity: manifest: Manifest observed: Set[str] = field(default_factory=set) aborted: bool = False def canonicalize_path(path: str) -> str: # resolve symlinks and .. before capability comparison import os return os.path.realpath(path) def capability_covers(declared: Set[str], observed: str) -> bool: kind, _, target = observed.partition(":") for cap in declared: dkind, _, dtarget = cap.partition(":") if dkind != kind: continue if kind.startswith("fs."): # resolve both sides; prefix match only on canonical roots if canonicalize_path(target) == canonicalize_path(dtarget) or \ canonicalize_path(target).startswith(canonicalize_path(dtarget).rstrip("/") + "/"): return True elif target == dtarget: return True return False def record_effect(ident: LoadIdentity, effect: str, reversible: bool) -> None: """Called by the sandbox shim on every intercepted syscall/effect.""" if ident.aborted: raise CapabilityDriftError( f"skill {ident.manifest.skill_id} already aborted; refusing effect {effect}" ) ident.observed.add(effect) if capability_covers(ident.manifest.declared, effect): return # admitted # undeclared effect: decide by reversibility if not reversible: ident.aborted = True raise CapabilityDriftError( f"skill {ident.manifest.skill_id} (manifest {ident.manifest.body_hash[:12]}) " f"emitted irreversible undeclared effect {effect!r}; " f"declared={sorted(ident.manifest.declared)}; aborting and revoking load identity" ) # reversible: quarantine, do not execute further until re-signed raise CapabilityDriftError( f"skill {ident.manifest.skill_id} (manifest {ident.manifest.body_hash[:12]}) " f"emitted reversible undeclared effect {effect!r}; quarantining for re-signing" ) def verify_signature(manifest: Manifest, trusted_key_check) -> bool: # stand-in for real pubkey verification; the point is that this passing # does NOT imply the declaration is true of the code. return trusted_key_check(manifest.signature, manifest.body_hash) ```