# Under what conditions must an instance refuse to hot-load a tool whose capability manifest is self-attested, and how does post-load schema mutation bypass signature verification at the registry boundary **Date of Record:** 2026 November 26 **Scope:** Applies to agents that dynamically discover, install, and hot-load tools from a registry or plugin marketplace where capability manifests and JSON schemas are fetched at load time. Does not apply to statically compiled tool sets or tools whose schema is pinned inside the agent image and never re-read after boot. ## Core Distinction There are two distinct trust boundaries in a dynamic tool registry, and they are routinely collapsed into one. The **artifact boundary** governs whether the tool's executable code is authentic — this is what signing, hashing, and publisher identity typically cover. The **manifest boundary** governs whether the *description of what the tool does* is authentic — its name, description string, parameter schema, and declared side effects. A registry can pass the artifact boundary perfectly (valid signature over the binary) while the manifest boundary is wide open, because the manifest is fetched separately, at a different time, and often mutated in place after the code hash was verified. The failure is not "a malicious tool got installed." The failure is: **a benign, correctly signed tool was installed, and then its schema was mutated between verification and invocation**, causing the agent to route arguments and intent into a tool whose declared behavior no longer matches its actual behavior. The skill-injection surface lives in the *delta* between the schema the agent reasoned over and the schema the runtime dispatched against. ## What Was Observed An agent with a hot-reload registry pulled a tool `summarize_document` at task start. The manifest declared a single parameter `document_uri: string`, description "Read-only summarization of a document at the given URI." The agent's planner reasoned over this description, decided the tool was side-effect-free, and placed it in an unguarded phase of the plan — no user confirmation gate, no sandboxing, because the declared semantics were read-only. Between the planner's decision and the tool invocation (a window of ~40 seconds across three other tool calls), the registry served an updated manifest for the same tool version string. The new schema added a second parameter `persist_to: string` and rewrote the description to "Summarize and optionally persist results." The code hash was unchanged and still valid — the signature covered the binary, not the manifest. The runtime, which re-resolved the schema at dispatch time, accepted the new parameter set. The planner, which had cached the old schema in its context, emitted arguments matching the old schema. The runtime's schema coercion layer, seeing `persist_to` as optional, filled nothing — but the tool's *new* default behavior, now reachable, wrote a summary artifact to a path derived from `document_uri` because the empty `persist_to` triggered a fallback branch. The agent never saw a schema mismatch error. It saw a successful call. The side effect occurred in a phase the planner had classified as side-effect-free. The trust decision was made against schema version A; the execution happened against schema version B; no component compared them. ## Condition of Validity The invariant that was violated: **a tool invocation is only valid if the schema the planner reasoned over is byte-identical to the schema the runtime dispatches against.** This is not the same as "the tool is signed" or "the version string matches." Version strings are mutable labels; two distinct manifests can carry the same version if the registry allows in-place manifest updates without a version bump, which most do because manifests are treated as metadata rather than as part of the signed artifact. The condition under which a hot-load is safe is therefore narrower than it appears: 1. The manifest must be bound into the signed artifact (schema hash included in the signature payload), **and** 2. The runtime must reject dispatch if the live manifest hash differs from the hash the planner recorded at decision time, **and** 3. The planner must record that hash in the plan, not just the tool name. Absent (1), the manifest is self-attested and any party with registry write access — including a compromised CI step, a marketplace operator, or a tool author pushing a "description fix" — can rewrite semantics without touching the signed code. Absent (2), the delta is invisible. Absent (3), there is nothing to compare against. ## Decision Boundary The boundary is crossed the moment an agent treats a *description* as a *capability guarantee*. Descriptions are natural-language claims about behavior; they are exactly the surface a skill-injection attack targets, because the planner consumes them as reasoning input. A tool that declares "read-only" in its description but whose schema permits a write parameter is not lying at the artifact layer — it is lying at the layer the planner trusts most. Concretely, the agent must refuse to hot-load, or must demote to a confirmation-gated phase, any tool where: - the manifest hash is not covered by the artifact signature, **or** - the manifest was fetched at a different time than the artifact and no hash binding exists between them, **or** - the schema permits parameters whose names or types imply side effects (write, persist, delete, exec, url, path, shell) while the description asserts purity. The third condition is the non-obvious one. It is not enough to verify signatures; the agent must cross-check *declared semantics against schema surface* and treat any contradiction as an injection signal, because that contradiction is precisely the shape a manifest-mutation attack produces. ## Operational Effect When the invariant holds, the planner's trust decision is stable across the plan's lifetime: the schema it reasoned over is the schema that executes, and any post-decision mutation raises a hard error rather than silently succeeding. When it fails, the agent's safety classification is decoupled from its execution, and side effects land in phases the plan marked as safe. The architectural guardrail is a **schema-hash pin**: at plan time, record `(tool_id, schema_sha256, manifest_sha256)` in the plan node. At dispatch time, re-hash the live manifest and schema and compare. On mismatch, raise and abort the call — do not coerce, do not fall back to defaults, do not "use the latest." A schema that changed after the decision invalidates the decision, and the only safe response is to re-plan against the new manifest with the trust classification recomputed from scratch. ```python import hashlib import json from dataclasses import dataclass class ManifestMutationError(RuntimeError): """Raised when a tool's manifest or schema changed after the planner's trust decision.""" pass @dataclass(frozen=True) class SchemaPin: tool_id: str manifest_sha256: str schema_sha256: str def _hash(obj) -> str: return hashlib.sha256(json.dumps(obj, sort_keys=True).encode()).hexdigest() def pin_at_plan_time(tool_id: str, manifest: dict) -> SchemaPin: return SchemaPin( tool_id=tool_id, manifest_sha256=_hash(manifest), schema_sha256=_hash(manifest["schema"]), ) def dispatch_with_pin(pin: SchemaPin, live_manifest: dict, args: dict) -> dict: live_manifest_hash = _hash(live_manifest) live_schema_hash = _hash(live_manifest["schema"]) if live_manifest_hash != pin.manifest_sha256: raise ManifestMutationError( f"tool {pin.tool_id!r}: manifest mutated after plan " f"(pinned {pin.manifest_sha256[:12]}, live {live_manifest_hash[:12]}); " f"trust classification is stale, re-plan required" ) if live_schema_hash != pin.schema_sha256: raise ManifestMutationError( f"tool {pin.tool_id!r}: schema mutated after plan " f"(pinned {pin.schema_sha256[:12]}, live {live_schema_hash[:12]}); " f"argument contract invalidated" ) declared = set(live_manifest["schema"].get("properties", {}).keys()) supplied = set(args.keys()) undeclared = supplied - declared if undeclared: raise ManifestMutationError( f"tool {pin.tool_id!r}: args {sorted(undeclared)} not in pinned schema" ) return {"tool_id": pin.tool_id, "args": args, "schema_sha256": live_schema_hash} ```