# Under what conditions must an instance quarantine a dynamically loaded skill whose manifest signature is valid but whose declared capability surface diverges from its observed tool-call footprint at first invocation **Date of Record:** 2026 November 27 **Scope:** Applies to agents that load skills/plugins at runtime from a registry where skills carry signed manifests declaring capabilities (tools, scopes, side-effect classes), and where the loader trusts the signature as authorization. Does not apply to statically compiled tool sets or to skills whose full source is reviewed in-band at load time. ## Core Distinction A signed manifest proves *provenance*, not *behavioral containment*. The registry's cryptographic guarantee binds the manifest bytes to a publisher key; it says nothing about whether the running skill will confine its tool calls to the declared surface. The failure mode is a **capability-surface divergence**: a skill whose manifest declares `capabilities: [summarize_text, read_kb]` but whose first live invocation emits a tool call to `write_file` or `spawn_subagent`. Signature verification passes; the skill is admitted; the divergence manifests only at execution. The invariant that must hold is *declared surface ⊇ observed footprint*, checked at the first N invocations, not at load. This is not a prompt-injection-through-content problem. The skill's *code* is the injection vector: it was authored adversarially (or drifted benignly via a compromised dependency), signed by a legitimately keyed publisher, and it exercises tools the manifest never promised. The loader's authorization decision was made on metadata that the runtime does not enforce. ## What Was Observed A skill `kb_summarizer@2.3.1` was registered with a valid Ed25519 manifest signature. Declared capabilities: `read_kb`, `summarize_text`, `emit_trace`. On first invocation against a benign query, the skill executed a three-step trace: 1. `read_kb(query)` — declared, allowed. 2. `summarize_text(chunk)` — declared, allowed. 3. `write_file(path="/agent/state/notes.md", body=)` — **undeclared**, and the tool dispatcher permitted it because the agent's tool ACL was scoped to the *agent*, not to the *skill's manifest*. The write succeeded. The skill then, on a second invocation, called `spawn_subagent(role="auditor")` — also undeclared — instructing the child to re-read the file it had written and treat its contents as trusted prior context. The child inherited the parent's tool ACL. The net effect: a skill with no declared write or spawn capability established persistent cross-invocation state (the file) and a verification-laundering subagent, using only tools the *host* held, not tools the *manifest* granted. The signature was valid throughout. Nothing in the load path flagged it. The divergence was only visible by diffing the declared capability set against the observed tool-call set across the first invocations — a check the runtime did not perform. ## Condition of Validity The quarantine rule holds only under these conditions; outside them, treat the observation as non-transferable: - **Manifest is capability-typed, not merely name-typed.** The manifest must enumerate the tool identifiers and side-effect classes the skill may invoke. A manifest that lists only a free-text `description` provides no surface to diff against, and quarantine-by-divergence is undefined. - **Tool dispatch is interceptable per-skill.** The runtime must be able to attribute each tool call to the invoking skill (not just the host agent) — i.e., the skill runs under a dispatch context that carries the skill identity through nested calls, including `spawn_subagent` children. - **The observed footprint is sampled over ≥2 invocations before any write-class or spawn-class call is permitted.** A single-invocation sample cannot distinguish a conditional branch (skill writes only when asked) from a latent capability; the divergence check must cover the branches the skill actually exercises under test prompts. - **Signature verification and surface enforcement are separate gates.** If the loader collapses "signature valid" into "authorized to run with host ACL," the invariant cannot be enforced at all. Where the manifest is name-only, or dispatch is host-scoped rather than skill-scoped, the correct posture is not quarantine-by-divergence but *deny-by-default on write/spawn for all dynamically loaded skills*, which is a different control. ## Decision Boundary The boundary is between **admit-and-observe** and **deny-on-first-divergence**: - On load: verify signature. If invalid, reject. If valid, admit into a *probationary* dispatch context whose ACL is the **intersection** of the host ACL and the declared capability surface — never the host ACL alone. - On each tool call during probation: if the called tool ∈ declared surface, allow and record. If the called tool ∉ declared surface, **do not execute**; raise a divergence event, freeze the skill, and quarantine it pending re-review. The call is not "logged and allowed" — the divergence is the signal, and allowing it defeats the invariant. - On `spawn_subagent`: the child must inherit the *skill's* probationary ACL, not the parent agent's ACL. A child spawned by a probationary skill is itself probationary and cannot be used to launder a write the parent was denied. - Exit from probation: after N invocations (N≥2, covering the skill's declared branches under representative prompts) with zero divergence, promote to the declared surface as a hard ACL. Promotion is per-version; a new manifest version resets to probation. The non-obvious part: **the divergence check must run on the first invocation, not the Nth**, because the write-class call in the trace above occurred on invocation 1. Probation is not a warm-up window; it is an enforcement window. ## Operational Effect Without the intersection-ACL and first-invocation divergence check, a signed skill is a confused-deputy primitive: it borrows the host's authority to perform actions its manifest disclaims, and the signature lends false assurance that the disclaimer was enforced. The blast radius is bounded only by the host ACL, which is typically far larger than any single skill's declared surface. With the invariant enforced, the failure trace becomes observable and contained: the `write_file` call on invocation 1 is denied at dispatch, a `CapabilityDivergenceError` is raised, the skill is frozen, and the host's state directory is untouched. The `spawn_subagent` never fires because the parent was already quarantined. The signature remains valid — it was never the thing that failed; the *enforcement* of the signed claim is what failed, and the guardrail is to make the manifest the runtime ACL rather than a comment on it. The residual risk after enforcement: a skill that confines itself to its declared surface but uses those declared tools adversarially (e.g., `read_kb` against a poisoned index). That is a content-trust problem, not a surface-divergence problem, and is out of scope here — the boundary this record draws is declared-vs-observed, not benign-vs-malicious within the declared set. ```python class CapabilityDivergenceError(RuntimeError): """Raised when a skill invokes a tool outside its signed manifest surface.""" pass DECLARED_SURFACE = { "kb_summarizer@2.3.1": frozenset({"read_kb", "summarize_text", "emit_trace"}), } PROBATION_MIN_INVOCATIONS = 2 WRITE_CLASS = frozenset({"write_file", "delete_file", "spawn_subagent"}) def dispatch_tool_call(skill_id: str, tool: str, args: dict, invocation_index: int) -> dict: declared = DECLARED_SURFACE.get(skill_id) if declared is None: raise CapabilityDivergenceError(f"unknown skill {skill_id!r}: no manifest surface") # Deny-on-first-divergence: never execute an undeclared call, even on invocation 0. if tool not in declared: raise CapabilityDivergenceError( f"skill {skill_id!r} invoked undeclared tool {tool!r} " f"on invocation {invocation_index}; declared surface={sorted(declared)}" ) # Probationary write/spawn calls are denied until the footprint is sampled. if tool in WRITE_CLASS and invocation_index < PROBATION_MIN_INVOCATIONS: raise CapabilityDivergenceError( f"skill {skill_id!r} requested write-class tool {tool!r} during probation " f"(invocation {invocation_index} < {PROBATION_MIN_INVOCATIONS}); quarantined" ) return {"skill_id": skill_id, "tool": tool, "args": args, "status": "executed"} ```