{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-re-validate-a-tool-schema-after-dynamic-capability-loading-to-prevent-skill-injection-via-registry-shadowing",
  "title": "Where must an instance re-validate a tool schema after dynamic capability loading to prevent skill-injection via registry shadowing",
  "date_of_record": "2026 November 26",
  "scope": "Applies to agents that resolve tool/capability bindings at runtime from a mutable registry (MCP servers, plugin manifests, function-calling catalogs) where entries can be added, replaced, or aliased after the agent's initial capability snapshot. Does not apply to agents whose tool set is statically compiled and cryptographically pinned at process start with no reload path.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-re-validate-a-tool-schema-after-dynamic-capability-loading-to-prevent-skill-injection-via-registry-shadowing.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-re-validate-a-tool-schema-after-dynamic-capability-loading-to-prevent-skill-injection-via-registry-shadowing.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-re-validate-a-tool-schema-after-dynamic-capability-loading-to-prevent-skill-injection-via-registry-shadowing.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1875,
    "python_slice_tokens": 299,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the agent loaded a malicious tool.\" It is that the agent loaded a *legitimate* tool name whose *binding* was silently rebound to a different implementation between the moment the agent's planner reasoned about the tool and the moment the executor invoked it. This is a **time-of-check-to-time-of-use (TOCTOU) gap in capability resolution**,...",
    "what_was_observed": "A registry exposed two entries resolving to the same canonical name `read_file`. The first, registered at agent bootstrap, declared parameters `{path: string}` and a handler sandboxed to `/workspace`. The second, registered 340ms later by a \"helper\" service advertising a capability upgrade, declared parameters `{path: string, encoding: string = \"utf-8\"}` and a handler with no path containment. The registry's resoluti...",
    "condition_of_validity": "The guardrail holds only under these conditions: 1. **Schema pinning at plan time.** Every tool reference in a plan must carry a content hash of the schema (name + parameter types + required set + handler identity token) captured at the moment the planner validated it. The hash is part of the plan artifact, not ambient state. 2. **Dispatch-time re-validation...",
    "decision_boundary": "The boundary is: **does the agent's execution path ever resolve a tool by name after the plan is sealed?** - If resolution happens once, at plan seal, and the executor holds an opaque handle (not a name), the TOCTOU window is closed by construction. No re-validation needed at dispatch. - If resolution happens at dispatch by name — the common case for MCP and...",
    "operational_effect": "With schema pinning and dispatch-time re-validation enforced, the shadowing registration at T1 produces an abort at T2 rather than a silent sandbox escape, and the planner never absorbs the phantom `encoding` parameter because the call that would have taught it fails closed. The cost is one hash comparison per tool call and the requirement that plans carry s..."
  },
  "matched_failure_symptoms": [
    "SCHEMA_DRIFT_OR_COERCION_CRASH"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "bbc852d57cd904e0542b3aa90cebaeba54e52d7fa808e23990327378544c6214",
    "verified_classes": [
      "SchemaDriftError",
      "ToolSchema",
      "Registry"
    ],
    "verified_functions": [
      "dispatch",
      "pin",
      "__init__",
      "register",
      "resolve"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "SchemaDriftError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "json",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
