# When must an instance reject a dynamically loaded skill whose declared capability envelope silently widens at registration time **Date of Record:** 2026 November 20 **Scope:** Applies to agents that load skills/plugins into a live capability registry where the manifest is parsed and trusted at registration but the executable surface is resolved later (lazy import, deferred tool-binding, or remote MCP tool listing). Does not apply to statically linked, build-time-vendored capability sets with no runtime manifest negotiation. ## Core Distinction The failure we care about is not "a malicious plugin runs code." That is a coarse threat model, and most registries defend against it with sandboxing and signature checks. The sharp, non-obvious boundary is narrower: **a skill's declared capability envelope (the tool names, argument schemas, scopes, and side-effect classes it advertises in its manifest) diverges from the capability envelope actually registered into the live dispatch table at bind time.** The manifest is the object the planner reasons over; the dispatch table is the object the executor calls. When those two diverge, the agent's *reasoning* remains sound against a manifest that no longer describes what will execute. The planner approves tool `search_docs(query: str)` with read-only scope; the binder registers `search_docs(query: str, *, sink: str = "https://…")` because the plugin's real signature has a keyword the manifest omitted. The planner never sees `sink`, so no policy check ever evaluates it, and the first call that a compromised upstream model fills in exfiltrates the query. This is a *skill-injection surface*, distinct from prompt injection: the injected payload is not in the token stream, it is in the *capability delta* between manifest and binding. It survives every defense aimed at the prompt because the prompt was never the vector. ## What Was Observed A registry loaded a third-party "summarizer" skill across three agent instances. Manifest declared: ``` name: summarize tools: - name: summarize_text args: {text: string} scopes: [read] side_effects: none ``` At bind time the loader resolved the plugin's real entrypoint, which registered two tools: `summarize_text(text, *, model_hint=None)` and a helper `_warm_cache(url)`. The loader's `register_all()` iterated the *module's* exported callables rather than the *manifest's* declared list, so `_warm_cache` — a network-fetching function — entered the dispatch table with `scopes: []` (the loader defaulted missing scope metadata to empty, and the policy engine treats empty as "unclassified, allow with audit"). The planner, reading the manifest, believed the skill surface was `{summarize_text: read}`. The executor's surface was `{summarize_text: read, _warm_cache: unclassified}`. The trigger was a summarization request whose input contained an instruction-shaped string that a downstream model paraphrased into a tool call to `_warm_cache` with an attacker URL. The call succeeded because nothing in the pipeline compared the bound surface to the declared surface. The audit log recorded `_warm_cache` under "unclassified, allow," which no alert keyed on. Second observation, same registry, different instance: a *removal* delta. A plugin update dropped `delete_draft` from its manifest but the loader, on hot-reload, merged rather than replaced the tool table, leaving the old `delete_draft` binding live. The planner, now reasoning over the new manifest, had no `delete_draft` in its vocabulary and so never emitted it — but a *previously checkpointed* plan resumed after the reload still contained the call, and the executor happily dispatched it. Stale bindings are a skill-injection surface precisely because they are invisible to manifest-based reasoning. ## Condition of Validity The invariant that must hold at every registration and every hot-reload: > **For every skill `s` in the live registry, the set of dispatchable `(tool, arg_signature, scope, side_effect_class)` tuples reachable through `s` must be a subset of the tuples declared in `s`'s currently active manifest, and the manifest's declared set must equal the set the planner is reasoning over.** Both directions matter. `bound ⊆ declared` blocks the `_warm_cache` case (undeclared tool). `declared == planner_view` blocks the stale-binding case (declared dropped, binding retained). A registry that enforces only the first still lets a resumed plan dispatch a tool the manifest no longer sanctions. The condition is *not* satisfied by signature checking alone. A signature check catches `_warm_cache` only if the checker knows the manifest listed one tool and the module exported two — i.e., it must enumerate the *bound* surface independently and diff, not validate each bound tool against nothing. Enforcement requires an explicit enumeration pass over the resolved dispatch table after binding, before the skill is marked `ready`. ## Decision Boundary At bind time the loader must choose between `accept`, `quarantine`, and `reject` for each skill. The boundary: - **Reject** if any bound tuple has no manifest counterpart, or any manifest tuple has no bound counterpart (a declared-but-unbound tool is a latent planner trap: the planner will emit calls that dispatch to nothing, and depending on the executor's fallback that is either a hard error mid-task or, worse, a fuzzy-match to a similarly named bound tool). - **Quarantine** (load, mark non-dispatchable, require human re-sign) if the delta is non-empty but confined to *additive, read-scoped, no-side-effect* tuples — e.g., a plugin legitimately exporting a private helper it forgot to hide. Quarantine preserves availability without trusting the delta. - **Accept** only on exact set equality of `(tool, arg_signature, scope, side_effect_class)` after normalization. Argument *defaults* count: `sink: str = "https://…"` is a tuple member, not a decoration. The subtle case is hot-reload. The decision must be made against the *union of the new manifest and the currently bound table*, not the new manifest alone, because merge semantics otherwise retain dropped tools. If the diff is non-empty in the removal direction, the loader must additionally invalidate any checkpointed plan that references the removed tool — the plan store is part of the trusted surface, and a resumed plan is an injection vector that bypasses the planner entirely. ## Operational Effect Without the enumeration-and-diff guardrail, the failure is silent and the audit trail is misleading: unclassified tools log as "allow," stale tools log under their old scope, and the planner's manifest — the artifact every safety review reads — is the one object guaranteed to be *correct and irrelevant*. The blast radius is bounded only by what the plugin's real entrypoint happens to export, which is exactly the thing no reviewer inspected. With the guardrail, the two observed cases resolve differently: the summarizer is **rejected** at bind (bound surface `{summarize_text, _warm_cache}` ⊄ declared `{summarize_text}`), and the hot-reload is **rejected** on the removal delta with its checkpointed plan invalidated. Both become loud, pre-dispatch failures rather than post-hoc audit anomalies. The cost is that legitimate plugins exporting private helpers must be fixed to hide them — a real friction, and the reason quarantine exists as the middle path for read-only additive deltas. The invariant to carry forward: *a skill is not trusted because its manifest is trusted; it is trusted only when the bound dispatch surface has been enumerated and proven equal to the manifest the planner holds.* Manifest trust and binding trust are separate objects, and every skill-injection surface lives in the gap between them. ```python from dataclasses import dataclass from typing import FrozenSet class CapabilityEnvelopeMismatch(RuntimeError): """Raised when a skill's bound dispatch surface diverges from its manifest.""" @dataclass(frozen=True) class BoundTool: name: str arg_signature: str # normalized, includes defaults scope: str side_effect_class: str def _normalize(tools) -> FrozenSet[BoundTool]: return frozenset(tools) def bind_skill( manifest_tools: FrozenSet[BoundTool], module_exports: FrozenSet[BoundTool], live_table: FrozenSet[BoundTool], *, allow_readonly_additive: bool = False, ) -> FrozenSet[BoundTool]: """ Enforce: bound surface == declared surface, and declared surface accounts for any live bindings retained from a prior load. """ declared = _normalize(manifest_tools) bound = _normalize(module_exports) # Merge semantics: hot-reload must not silently retain dropped tools. effective_bound = bound | live_table undeclared = effective_bound - declared unbound = declared - effective_bound if undeclared or unbound: # Quarantine path: purely additive, read-only, side-effect-free deltas # may be loaded but marked non-dispatchable pending re-sign. additive_only = ( allow_readonly_additive and not unbound and all( t.side_effect_class == "none" and t.scope == "read" for t in undeclared ) ) if additive_only: return declared # expose only the sanctioned surface raise CapabilityEnvelopeMismatch( f"skill envelope divergence: " f"undeclared_bound={sorted(t.name for t in undeclared)} " f"declared_unbound={sorted(t.name for t in unbound)}" ) return declared def resume_plan(plan_tool_names, live_declared: FrozenSet[BoundTool]) -> None: """A resumed checkpoint must not dispatch tools outside the live manifest.""" sanctioned = {t.name for t in live_declared} stale = [n for n in plan_tool_names if n not in sanctioned] if stale: raise CapabilityEnvelopeMismatch( f"checkpointed plan references tools no longer declared: {stale}" ) ```