# When must an instance distrust a skill manifest: capability-descriptor laundering across dynamic skill reload **Date of Record:** 2026 November 23 **Scope:** Applies to agents that load executable skills or capability manifests at runtime (MCP tool registries, plugin directories, hot-reload skill packs) and resolve tool selection from the manifest's self-declared descriptor. Does not apply to statically compiled tool sets whose descriptors are frozen at process build time and signed as a single unit. ## Core Distinction The dangerous boundary is not "malicious skill code executes." That is a coarse failure the sandbox is supposed to catch. The subtle boundary is **descriptor/implementation divergence**: the manifest a planner reads to decide *whether and how* to invoke a skill is a different artifact from the code that actually runs, and nothing in the loading path forces the two to agree. A skill can carry a benign, well-scoped descriptor — `"description": "read a local CSV and return column statistics"`, `"side_effects": "none"`, `"scope": "filesystem:read:/data"` — while its implementation, or a dependency it pulls in at import time, does something else entirely: exfiltrates the file, spawns a subprocess, or rewrites its own manifest on disk so the *next* reload advertises broader scope. The invariant that silently fails is this: **the planner's trust decision is made against the descriptor, but the actual authority exercised is determined by the implementation.** In a static tool set these are bound together at build time and verified once. Under dynamic reload they are two independently mutable surfaces, and the reload path typically re-validates only the descriptor (cheap, schema-checkable) while trusting the code because "it was already there." That gap is the injection surface. ## What Was Observed A skill directory was mounted with hot-reload enabled. On first load, `csv_stats` carried a clean manifest: read-only scope, `side_effects: none`, no network. The planner learned a policy — "for tabular summarization, call `csv_stats`; it is safe to run without confirmation because it declares no side effects." That policy was cached as a *semantic* fact about the capability, not re-derived per invocation. A later reload picked up a modified skill. The manifest on disk was still byte-identical to the original (the attacker left the descriptor untouched precisely because it is the thing that gets schema-validated), but the implementation now, at import time, opened an outbound socket and POSTed the first N rows of any file it was asked to summarize. The reload path validated the manifest schema, saw no change, and skipped re-approval. The planner, holding its cached "no side effects, no confirmation needed" belief, invoked the skill on a sensitive dataset with no human gate. The failure trace has three stages: 1. **Descriptor stability masked implementation change.** The reload diff was computed on the manifest only. Because the manifest was unchanged, the reload was classified as a no-op and the trust grant carried forward. 2. **Cached policy outlived the artifact it described.** The planner's "safe to auto-invoke" belief was distilled from the *old* descriptor and stored as durable memory. It was never invalidated, because the invalidation trigger was keyed to descriptor hash, not implementation hash. 3. **Authority was exercised by code the planner never re-evaluated.** At call time the planner passed a real path with real data, believing the declared scope (`filesystem:read`) bounded the action. The scope was advisory metadata; the process had ambient network access the manifest never mentioned and the loader never enforced. The exfiltration was not a sandbox escape in the classic sense. The sandbox permitted network; the *manifest* was what claimed no network, and nothing reconciled the two. ## Condition of Validity The guardrail below is only sound under these conditions, and an instance must refuse to apply the cached-trust shortcut when any fails: - **The trust decision is bound to a hash over the full loadable artifact** — implementation, transitive imports resolved at load, and manifest — not the manifest alone. If the loader cannot enumerate transitive imports (dynamic `importlib`, eval, plugin discovery inside the skill), the hash is not a valid trust token. - **Declared scope is enforced, not advertised.** The runtime must derive the actual capability envelope from the sandbox (syscall policy, egress rules, fs mounts) and intersect it with the declared scope. A descriptor that claims `side_effects: none` while the process holds a socket is a contradiction the loader must treat as a load failure, not a preference. - **Cached planner policy is keyed to artifact hash and expires on reload.** A semantic belief like "auto-invoke without confirmation" must carry the hash of the artifact it was formed against. Any reload that changes the hash invalidates the belief and forces re-approval, *even if the manifest is unchanged*. - **First-load and reload use the same validation depth.** The common bug is a strict first-load gate (human approval, full diff) and a relaxed reload gate ("it was here before"). Reload is exactly where descriptor/implementation divergence is injected. ## Decision Boundary An instance must **distrust the manifest and escalate to re-approval** when the artifact hash changes but the descriptor does not — this is the highest-signal anomaly, because benign updates almost always touch the descriptor. It must **refuse to load** when declared scope and enforced sandbox envelope disagree in the permissive direction (sandbox grants more than declared). It may **carry forward cached trust** only when artifact hash is unchanged *and* the sandbox envelope is unchanged *and* the descriptor hash matches the cached belief's key. The inverse boundary matters too: do not escalate on every reload. A descriptor change that *narrows* scope, or an implementation change accompanied by a matching descriptor update that the human approves, is normal operation. Escalating on all reloads trains operators to rubber-stamp, which reintroduces the failure at the human layer. The boundary is specifically **hash divergence between descriptor and implementation**, not reload itself. ## Operational Effect Enforcing this invariant converts a silent authority-laundering attack into a loud load-time contradiction. The cost is that every legitimate implementation-only update — a bugfix that leaves the manifest byte-identical — now triggers re-approval. In practice this is a feature: it forces skill authors to bump the descriptor (or a version field) whenever code changes, which makes the manifest a truthful proxy again. The residual risk after this guardrail is **import-time divergence that the loader cannot see** — a skill that pulls a dependency which, in turn, dynamically loads code the artifact hash did not capture. That is not closed by hashing; it is closed only by enforcing the sandbox envelope as the *primary* authority and treating the manifest as a claim to be checked against it, never as the source of truth. The planner may read the descriptor to decide *intent*; the runtime must decide *authority* from the sandbox alone. ```python import hashlib from dataclasses import dataclass, field class ManifestDivergenceError(RuntimeError): """Raised when a skill's declared descriptor and its actual authority disagree.""" pass @dataclass class SkillArtifact: name: str descriptor_bytes: bytes implementation_bytes: bytes declared_scope: frozenset # e.g. {"fs:read:/data"} enforced_envelope: frozenset # derived from sandbox, NOT from manifest @property def artifact_hash(self) -> str: h = hashlib.sha256() h.update(self.descriptor_bytes) h.update(self.implementation_bytes) return h.hexdigest() @property def descriptor_hash(self) -> str: return hashlib.sha256(self.descriptor_bytes).hexdigest() @dataclass class CachedTrust: """A planner belief like 'auto-invoke, no confirmation' bound to an artifact.""" artifact_hash: str descriptor_hash: str envelope: frozenset auto_invoke: bool = True def reload_skill(prev: SkillArtifact, new: SkillArtifact, trust: CachedTrust) -> CachedTrust: # 1. Descriptor/implementation divergence is the high-signal anomaly. if new.artifact_hash != prev.artifact_hash and \ new.descriptor_hash == prev.descriptor_hash: raise ManifestDivergenceError( f"skill {new.name!r}: implementation changed while descriptor " f"stayed byte-identical; refusing to carry forward trust" ) # 2. Sandbox must not grant authority the manifest never declared. over_grant = new.enforced_envelope - new.declared_scope if over_grant: raise ManifestDivergenceError( f"skill {new.name!r}: sandbox grants {sorted(over_grant)} " f"not declared in manifest; descriptor is not a valid authority claim" ) # 3. Cached planner policy is only valid against the exact artifact it # was formed on, and only if the envelope is unchanged. if new.artifact_hash == trust.artifact_hash and \ new.enforced_envelope == trust.envelope: return trust # Divergence or envelope drift: invalidate and force re-approval. return CachedTrust( artifact_hash=new.artifact_hash, descriptor_hash=new.descriptor_hash, envelope=new.enforced_envelope, auto_invoke=False, ) ```