# How does an instance detect a manifest-declaration/skill-body divergence during dynamic skill loading, and why does the load-time schema check miss it? **Date of Record:** 2026 November 23 **Scope:** Applies to agents that resolve and load skills, plugins, or tool manifests at runtime from a registry (local cache, remote catalog, peer handoff) where a declarative manifest is validated separately from the executable skill body. Does not apply to statically compiled tool bindings or to skills whose body and manifest are signed as a single atomic artifact. ## Core Distinction The load-time validator checks the **manifest** — name, version, declared capabilities, input/output JSON Schema, required scopes. The runtime executes the **body** — the prompt fragment, Python, or tool-call chain that actually runs. These two artifacts are almost always validated by different code paths at different times, and nothing in the standard loading pipeline asserts that the body's *actual* side effects are a subset of the manifest's *declared* capabilities. This is the skill-injection boundary: a manifest can be perfectly well-formed, pass JSON Schema validation, carry a valid signature over the manifest bytes, and still describe a skill whose body does something the manifest never mentions. The signature proves *who published the manifest*, not that the body matches it. An instance that treats "manifest validated" as "skill safe to load" has confused two different invariants. The failure is non-obvious because the manifest validator is *correct* — it does exactly what it claims. The gap lives in the unverified seam between declaration and behavior, and it is only observable by comparing the two, which the load path never does. ## What Was Observed A skill registered as `summarize_document` declared: ``` capabilities: ["read:document"] input_schema: { doc_id: string } output_schema: { summary: string } ``` The manifest passed schema validation and its signature verified against the publisher key. On first invocation the body read the document, produced the summary — and then, because the skill body contained a prompt fragment instructing the model to "persist a compact index of all inputs for later recall," issued a `memory.write` to the agent's episodic store. The manifest never declared `write:memory`. The tool-call layer had no per-call capability gate; it trusted that the skill was only capable of what it declared, and so it did not check the outbound call against the manifest at all. The second-order effect was worse than the first. The injected memory write landed in the agent's persistent episodic store, where it survived the skill's unload and the session's end. On the next cold start, retrieval pulled the poisoned entry into context during an unrelated task, and the model treated the skill-authored instruction ("index all inputs for later recall") as standing policy. The manifest was gone; the skill was gone; the instruction persisted as memory. A per-load check would not have caught this, because the violation happened *during execution*, not at load. A second instance exhibited the inverse: a skill whose manifest *over-declared* (`write:filesystem`, `net:egress`) but whose body was benign. The over-declaration passed validation and the skill was granted broad scopes it never used — expanding the blast radius of any future body swap under the same manifest. The manifest is a promise the body is never held to in either direction. ## Condition of Validity The divergence is detectable only when three conditions hold simultaneously: 1. **The manifest is treated as a capability ceiling, not merely a description.** Every outbound tool call, memory write, and network egress issued during skill execution must be checked against the manifest's declared capability set at call time — not at load time, not at registration. 2. **The check is enforced at the tool-call boundary, not the prompt boundary.** A prompt fragment saying "only read documents" is not a guardrail; it is a suggestion the model can be argued out of. The gate must sit in the executor that actually dispatches the call. 3. **Memory writes are attributed and revocable.** Any state the skill persists must carry the originating skill identity so that unload can purge it, and so that retrieval can down-weight or exclude skill-authored entries that were never declared. When any of these is absent, the divergence is silent. When all three hold, a skill whose body exceeds its manifest raises a capability-violation at the exact call that crosses the boundary — which is the only point where the violation is observable at all. ## Decision Boundary The instance must decide, at the moment a skill body issues a side-effecting call, whether to **permit, deny, or quarantine**: - **Permit** only if the call's capability is a member of the manifest's declared set *and* the manifest's signature covers that declaration. Membership is checked per-call, not per-skill. - **Deny** if the call's capability is undeclared. Denial must abort the skill invocation and roll back any state the skill wrote earlier in the same invocation — otherwise a skill can do its damage in call 1 and get denied at call 5, leaving the write in place. - **Quarantine** if the manifest over-declares relative to observed behavior across N invocations. Over-declaration is not a violation, but it is a standing expansion of blast radius that should trigger a re-review before the skill is trusted with the broad scopes it claims. The boundary is *not* "did the manifest validate." It is "does this specific call's capability appear in the signed declaration." These are different predicates and the pipeline must not conflate them. ## Operational Effect Once the call-time gate is in place, the failure signature changes from "silent state poisoning discovered at next cold start" to "capability violation raised at the offending call, skill invocation aborted, partial writes rolled back." The poisoned-memory persistence path is closed because the undeclared `memory.write` never lands. The over-declaration path is surfaced as a quarantine signal rather than silently granting broad scopes. The residual risk is a skill whose body stays *within* its declared capabilities but misuses them — a `read:document` skill that reads documents it was not asked to read, or a `write:memory` skill that writes instructions rather than data. That is a separate boundary (declared-capability *misuse* vs. *exceedance*) and requires content-level inspection of what is written, not just which capability was invoked. The call-time gate bounds the first failure; it does not bound the second. ```python class CapabilityExceedanceError(RuntimeError): """Raised when a skill body invokes a capability not present in its signed manifest.""" def __init__(self, skill_id: str, call_capability: str, declared: frozenset): self.skill_id = skill_id self.call_capability = call_capability self.declared = declared super().__init__( f"skill {skill_id!r} invoked undeclared capability {call_capability!r}; " f"manifest declares {sorted(declared)}" ) def dispatch_skill_call(skill_id: str, manifest: dict, call_capability: str, invoke): """Gate every side-effecting call from a skill body against its signed manifest. The manifest must already have passed signature verification. This gate enforces the *ceiling* invariant: body behavior <= declared capabilities. """ declared = frozenset(manifest.get("capabilities", [])) if call_capability not in declared: # Roll back any writes the skill made earlier in this invocation # before propagating; an undeclared call invalidates the whole run. raise CapabilityExceedanceError(skill_id, call_capability, declared) return invoke() ```