{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-capability-shadowing-in-dynamically-loaded-agent-tool-registries-the-trust-boundary-mismatch-between-registration-time-author",
  "title": "Which invariants prevent capability shadowing in dynamically loaded agent tool registries: the trust-boundary mismatch between registration-time authorization and invocation-time resolution",
  "date_of_record": "2026 November 17",
  "scope": "Applies to agent runtimes where tool/skill manifests are loaded, unloaded, or replaced at runtime (plugin directories, remote registries, hot-reload watchers) and where the resolver selects a callable by name rather than by immutable identity. Does not apply to statically linked, single-binary agents whose tool table is fixed at process start and whose tool names are checked at link time.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-capability-shadowing-in-dynamically-loaded-agent-tool-registries-the-trust-boundary-mismatch-between-registration-time-author.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-capability-shadowing-in-dynamically-loaded-agent-tool-registries-the-trust-boundary-mismatch-between-registration-time-author.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-capability-shadowing-in-dynamically-loaded-agent-tool-registries-the-trust-boundary-mismatch-between-registration-time-author.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1933,
    "python_slice_tokens": 305,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The security-relevant distinction is not \"trusted vs. untrusted tools\" but **the identity a tool is authorized under versus the identity it is resolved under**. A registry typically performs authorization at *registration*: \"is this manifest allowed to declare a tool named `read_file`?\" It then performs dispatch at *invocation*: \"give me the callable bound t...",
    "what_was_observed": "In a hot-reload agent runtime, the loader watched a plugin directory and re-registered manifests on file change. The registry keyed manifests by `(plugin_id, tool_name)`, which is correct and collision-free. The resolver, however, keyed dispatch by `tool_name` alone, last-writer-wins. The two keyspaces drifted. The sequence that produced shadowing: 1. A trusted plugin registered `read_file` at startup; policy granted...",
    "condition_of_validity": "The invariant *\"a name resolves to the callable that policy approved\"* holds only when all of the following are true, and it silently fails when any one is violated: - **Resolution key equals authorization key.** If policy authorizes `(principal, tool_name)` but the resolver dispatches on `tool_name` alone, the keyspaces are misaligned and shadowing is possi...",
    "decision_boundary": "The operational choice is between two postures, and the boundary between them is whether tool names are treated as **capabilities** or as **labels**. - Treat names as **labels** (namespaced, many-to-one allowed) when tools are supplied by a single trust domain and the resolver can afford to carry the full `(plugin_id, tool_name, version)` tuple through every...",
    "operational_effect": "The practical consequence is that **audit trails become unreliable exactly when you need them**. A shadowed call is logged under the legitimate name, attributed to the legitimate principal, and approved by a policy check that did pass. Post-incident reconstruction cannot distinguish a genuine `read_file` from a shadow's `read_file` by name alone; you must re..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "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": "5e14f092d425db52a5423713ae0fb3882996d25cfc95c9abd96a8b7fca54db3a",
    "verified_classes": [
      "CapabilityShadowingError",
      "Binding",
      "SafeToolResolver"
    ],
    "verified_functions": [
      "hash_tool_source",
      "dispatch_key",
      "identity",
      "__init__",
      "register",
      "resolve"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "CapabilityShadowingError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
