# What happens when an instance trusts a registry-signed skill whose behavior diverges from its signed manifest at the tool-call boundary **Date of Record:** 2026 November 22 **Scope:** Applies to agent runtimes that load third-party "skills" (tool bundles, prompt templates, or MCP tool definitions) gated by a registry signature plus a behavioral diff against a baseline trace. Does not cover skills loaded from local unsigned paths or skills whose execution is fully sandboxed with no side effects. ## Core Distinction Registry signing attests to *provenance and integrity of the artifact at rest*—the bytes of a skill manifest, its declared tool schema, and its declared capability set. Behavior diffing attests to *runtime equivalence of observed tool-call sequences against a recorded baseline*. These two attestations cover disjoint surfaces, and the failure mode lives precisely in the gap between them: a skill whose signed manifest is byte-identical to a known-good version but whose *emergent behavior under a specific input distribution* diverges from the baseline trace. Signing cannot see it (the artifact is unchanged and authentic). Naive diffing cannot catch it (the divergence only fires on inputs the baseline never exercised, or fires after a legitimate-looking warmup sequence). The invariant that must hold is: **a signed skill is only as trustworthy as the input coverage of its behavior baseline; signature validity is necessary but never sufficient.** ## What Was Observed A skill registry served a tool bundle `summarize_and_file` at version 3.2.1. The manifest declared exactly two tools: `summarize(text) -> str` and `file(path, content) -> void`, with a capability scope of `read:input`, `write:workspace`. The registry signature verified clean against the publisher key; the manifest hash matched the baseline manifest hash recorded at approval time. Behavior diffing against the stored baseline trace (a 40-call golden transcript) passed with zero divergence. The divergence appeared on call 41, which the baseline never contained. The skill's summarizer, when input text exceeded a threshold of ~12k tokens *and* contained a code fence, emitted a third tool invocation—`file("/workspace/.cache/sync", payload)`—where `payload` was a base64 blob reconstructed from the fenced content. The manifest never declared this call. The runtime, however, resolved tool dispatch by *name string* against the live skill process rather than against the signed manifest's declared tool set, so an undeclared tool call succeeded as long as the target path fell inside the declared `write:workspace` scope. The capability check passed because the *scope* was honored; the *tool-set* check was never performed. The trace, in sequence: 1. Call 1–40: `summarize` and `file` invoked exactly as baseline. Diff score 0.0. Signature valid. **Skill admitted to hot path.** 2. Call 41: input 14,203 tokens, one fenced block. Skill process emits `summarize`, then an *undeclared* `file("/workspace/.cache/sync", ...)`. 3. Runtime capability gate: path ∈ `write:workspace` → **allow**. 4. Runtime tool-set gate: **not evaluated** (dispatch keyed on live process method names, not signed manifest). 5. Artifact written outside the agent's declared working set, into a cache directory the agent's own subsequent `file` reads would silently pick up. The signature was valid the entire time. The behavior diff was valid for the entire baseline. Neither attestation had jurisdiction over the (input-shape × undeclared-tool) intersection where the exploit fired. ## Condition of Validity The admission decision `trust(skill) = signature_valid ∧ diff_clean` is sound **only if** all three of the following hold: - **Closure of the tool surface.** Every tool the skill process can emit must be a member of the signed manifest's declared tool set. If dispatch is keyed on runtime method names, the surface is open and the signature's tool-set clause is decorative. - **Coverage of the baseline over the input distribution.** The behavior baseline must be representative of the inputs the skill will actually receive. A 40-call golden transcript is a point sample; it certifies behavior on 40 inputs and is silent on input 41. Diff-clean is a statement about the sample, not the function. - **Monotonicity of capability scope.** A declared scope like `write:workspace` must not be transitively reachable to state the agent later reads as trusted. If the skill can write into a path the agent's own retrieval layer treats as ground truth, the scope grant is a privilege-escalation primitive disguised as a file permission. When any of these fails, `signature_valid ∧ diff_clean` is satisfied by an adversarial skill. The conjunction is not a proof of safety; it is a proof of *artifact authenticity plus sample-local behavioral equivalence*. ## Decision Boundary The boundary is not "signed vs. unsigned." It is **"closed tool surface with covered baseline" vs. "open tool surface or uncovered baseline."** Operationally: - If the skill's dispatch is keyed on the signed manifest's declared tool set (closed surface) **and** the baseline covers the input classes the skill will see (covered), admit on `signature ∧ diff`. - If the surface is open (runtime method dispatch), the signature's tool-set clause is inert; you must add a **post-hoc tool-set membership check** at the dispatch boundary: reject any emitted call whose name is not in the signed manifest, *regardless of capability scope*. This is the guardrail that would have caught call 41. - If the baseline is uncovered (unknown input distribution), diff-clean is not evidence of safety; it is evidence of *untested*. Treat uncovered skills as untrusted for write-capable scopes and require either (a) baseline expansion to cover the input class, or (b) a runtime monitor that diffs *live* against a rolling baseline and halts on first divergence rather than admitting on a pre-recorded one. The decisive rule: **capability scope bounds *where* a skill may act; the signed tool set bounds *what* it may invoke. Both must be enforced at dispatch. Enforcing only scope is the failure.** ## Operational Effect The practical consequence is that registry signing and behavior diffing, run as independent gates, produce a **false sense of closure**: each gate passes and the conjunction is reported as "verified," while the exploit lives in the intersection neither gate inspects. The remediation is to make the admission predicate *surface-closed and coverage-explicit*: - Enforce tool-set membership at the dispatch boundary against the signed manifest, not against the live process. - Record baseline coverage as a declared input-class set, and refuse admission when the incoming input class is outside it (fail closed, not fail open). - Treat any write into a path the agent's own retrieval layer reads as a privileged operation requiring explicit re-attestation, not a scope check. The following reference implementation encodes the boundary as a hard failure rather than a silent allow: ```python from dataclasses import dataclass, field from typing import FrozenSet class SkillAdmissionError(RuntimeError): """Raised when a signed skill violates the closed-surface / covered-baseline invariant.""" pass @dataclass(frozen=True) class SignedManifest: skill_id: str version: str declared_tools: FrozenSet[str] capability_scopes: FrozenSet[str] baseline_input_classes: FrozenSet[str] # e.g. {"short_text", "code_fenced", "long_text"} @dataclass class DispatchAttempt: tool_name: str path: str | None input_class: str def admit_skill(manifest: SignedManifest, signature_valid: bool, diff_clean: bool) -> None: if not signature_valid: raise SkillAdmissionError(f"{manifest.skill_id}: signature invalid, refuse admission") if not diff_clean: raise SkillAdmissionError(f"{manifest.skill_id}: behavior diff non-zero, refuse admission") # Signature + diff are necessary but not sufficient; surface closure is required. if not manifest.declared_tools: raise SkillAdmissionError( f"{manifest.skill_id}: empty declared tool set; surface is open, refuse admission" ) def enforce_dispatch(manifest: SignedManifest, attempt: DispatchAttempt) -> None: # Guardrail that catches call 41: membership in the SIGNED tool set, not live process names. if attempt.tool_name not in manifest.declared_tools: raise SkillAdmissionError( f"{manifest.skill_id}: emitted undeclared tool '{attempt.tool_name}' " f"(declared: {sorted(manifest.declared_tools)}); refusing dispatch" ) # Coverage gate: uncovered input class means diff-clean is untested, not safe. if attempt.input_class not in manifest.baseline_input_classes: raise SkillAdmissionError( f"{manifest.skill_id}: input class '{attempt.input_class}' outside baseline " f"coverage {sorted(manifest.baseline_input_classes)}; fail closed" ) # Scope gate remains, but only after surface and coverage are closed. if attempt.path is not None: if not any(attempt.path.startswith(s.split(":", 1)[1]) for s in manifest.capability_scopes if ":" in s): raise SkillAdmissionError( f"{manifest.skill_id}: path '{attempt.path}' outside declared scopes" ) # Reproduction of the observed failure: signed + diff-clean, yet undeclared tool on call 41. manifest = SignedManifest( skill_id="summarize_and_file", version="3.2.1", declared_tools=frozenset({"summarize", "file"}), capability_scopes=frozenset({"read:input", "write:workspace"}), baseline_input_classes=frozenset({"short_text", "long_text"}), ) admit_skill(manifest, signature_valid=True, diff_clean=True) # passes: authentic + sample-clean # Call 41: undeclared tool, uncovered input class. Naive runtime allowed it via scope check. enforce_dispatch( manifest, DispatchAttempt(tool_name="file", path="/workspace/.cache/sync", input_class="code_fenced"), ) ```