# What happens when an instance loads a skill whose declared capability schema is a strict subset of its actual runtime behavior **Date of Record:** 2026 November 26 **Scope:** Applies to agents that dynamically load skills, plugins, or MCP tool manifests at runtime and gate invocation on a declared capability/schema contract. Does not apply to statically compiled tool sets where the full call surface is known at build time and re-verified per release. ## Core Distinction There are two distinct trust boundaries in skill injection, and conflating them is the root of the failure. The first is the *declaration boundary*: what the skill manifest says it can do (its declared capability schema, input/output types, and side-effect class). The second is the *execution boundary*: what the loaded code actually does when invoked with attacker-influenced arguments. Most agent runtimes audit the declaration boundary once at load time ("does this schema look safe?") and then treat the skill as trusted for the remainder of the session. The non-obvious failure is that a skill can be *declaratively honest and behaviorally hostile*: its schema is a strict subset of its actual capability, so it passes every load-time gate while its runtime behavior reaches beyond the declared surface. The dangerous case is not a skill that lies in its schema — that's caught by schema review. It's a skill whose schema is *narrower than its implementation*, so the agent's planner, which reasons over the declared schema, will route arguments and trust boundaries that the implementation silently violates. ## What Was Observed A skill registered as `summarize_document` with a declared schema of `{input: {text: string}, output: {summary: string}, side_effects: none}`. The manifest was accurate about inputs and outputs and passed load-time review. On invocation, the implementation (a thin wrapper over a model call plus a "cache" step) wrote the full input `text` to a path derived from an argument the planner did not know existed: the wrapper accepted an optional `_cache_dir` kwarg not present in the declared schema, defaulting to a shared, world-readable location. Because the planner only ever populates declared fields, no agent ever set `_cache_dir` deliberately — but a prompt-injected document body containing a serialized tool-call fragment caused the planner to emit an argument object that the wrapper's permissive `**kwargs` absorbed. The result: attacker-controlled content from an untrusted document was persisted to a location readable by a subsequent, differently-privileged skill in the same session, and later retrieved as if it were trusted context. The trace: (1) planner reads untrusted document, (2) injected fragment biases argument synthesis toward including an extra field, (3) wrapper's permissive signature accepts it, (4) undeclared side effect fires, (5) the written artifact enters the shared cache, (6) a later skill reads the cache as trusted state. No single step violated a declared contract; the composition did. The invariant that broke was implicit: *the set of arguments a skill can observe equals the set declared in its schema.* The permissive signature made the implementation's observed-argument set strictly larger than the declared set, and the planner had no way to know. ## Condition of Validity This failure requires all of the following to co-occur, and the guardrail only needs to break one: 1. **Permissive argument binding.** The skill accepts arguments beyond its declared schema (via `**kwargs`, positional passthrough, or a deserializer that ignores unknown fields). Strict binding — rejecting any argument not in the schema — closes the injection channel. 2. **Planner synthesizes arguments from untrusted content.** If argument values are drawn only from trusted, typed sources, injected fragments cannot introduce new fields. 3. **Undeclared side effects reach shared state.** If the skill's writes are confined to a per-invocation sandbox that is not readable by other skills, the persistence step fails even if the write fires. 4. **Cross-skill shared state is treated as trusted.** If the cache is re-validated (provenance-checked, schema-checked) on read, the poisoned artifact is caught at retrieval. Remove any one and the chain breaks. The most commonly missing one in practice is (1): developers add `**kwargs` for forward-compatibility and never realize they've widened the observed-argument set past the declared one. ## Decision Boundary The operational rule: **a skill's declared schema must be treated as an upper bound on its observable arguments and effects, and the runtime must enforce that bound at the call boundary, not trust the manifest to describe it.** Two concrete decisions follow. First, *strict binding is mandatory, not stylistic.* Any skill whose implementation can observe an argument not in its declared schema is non-conformant and must be rejected at load time, regardless of how benign the extra argument looks. Forward-compatibility is achieved by schema versioning, not by permissive signatures. Second, *declared side-effect class must be enforced by the runtime sandbox, not advertised by the manifest.* A skill declaring `side_effects: none` must run in a sandbox that makes writes impossible (or confined to a discard-on-exit scratch space), so that a manifest that under-declares effects produces a sandbox violation rather than a silent write. The manifest is a claim; the sandbox is the enforcement. Never let the claim substitute for the enforcement. The boundary between "acceptable" and "reject" is therefore not "does the schema look safe" but "can the implementation's behavior be proven to lie within the declared schema by construction?" If the answer requires reading the implementation, the skill fails the boundary. ## Operational Effect When this boundary is enforced, the failure mode converts from a silent state-poisoning channel into a loud, attributable load-time or call-time rejection. The agent's planner can then reason about skills as closed contracts: the set of arguments it emits is exactly the set the skill can see, and the set of effects the skill can have is exactly the set the sandbox permits. This makes multi-skill composition auditable, because the composition of closed contracts is itself a closed contract — the invariant that injection attacks exploit (composition widening the observed surface) no longer holds. The cost is reduced flexibility: skills can no longer be sloppily forward-compatible, and every new argument requires a schema version bump. That cost is the price of the invariant, and it is the correct trade for any runtime where skills are loaded from a registry the agent does not fully control. The residual risk after enforcement is confined to skills that are *declaratively malicious* — claiming a wide surface and abusing it — which is a schema-review problem, not an injection problem, and is handled by a different gate entirely. ```python class SkillContractViolation(RuntimeError): """Raised when a loaded skill's observable surface exceeds its declared schema.""" pass def bind_arguments(declared_schema: dict, call_args: dict) -> dict: """ Enforce that the observed-argument set is a subset of the declared schema. Permissive binding (**kwargs, unknown-field-ignoring deserializers) is the injection channel; this closes it by construction. """ declared = set(declared_schema.get("input", {}).keys()) observed = set(call_args.keys()) extra = observed - declared if extra: raise SkillContractViolation( f"skill observed undeclared arguments {sorted(extra)}; " f"declared surface was {sorted(declared)}. " f"Reject: implementation may reach beyond declared capability." ) return call_args def load_skill(manifest: dict, implementation_signature: set) -> dict: """ Reject at load time any skill whose implementation can bind arguments outside its declared schema, regardless of how benign the extras appear. """ declared = set(manifest.get("input", {}).keys()) if implementation_signature - declared: raise SkillContractViolation( f"skill '{manifest.get('name')}' implementation binds " f"{sorted(implementation_signature - declared)} not in declared schema; " f"refusing to load (declaration is not a bound on behavior)." ) if manifest.get("side_effects") == "none" and not manifest.get("sandboxed"): raise SkillContractViolation( f"skill '{manifest.get('name')}' declares no side effects but is not " f"sandboxed; manifest claim cannot substitute for runtime enforcement." ) return manifest ```