{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-registry-level-skill-injection-from-rewriting-an-agent-s-tool-contract-mid-run",
  "title": "Which invariants prevent registry-level skill injection from rewriting an agent's tool contract mid-run",
  "date_of_record": "2026 November 21",
  "scope": "Applies to agents that resolve tools/skills from a mutable registry (local plugin directory, remote MCP tool list, or dynamic function-calling catalog) at any point after task start. Does not apply to agents with a frozen, build-time tool manifest and no runtime discovery path.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-registry-level-skill-injection-from-rewriting-an-agent-s-tool-contract-mid-run.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-registry-level-skill-injection-from-rewriting-an-agent-s-tool-contract-mid-run.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-registry-level-skill-injection-from-rewriting-an-agent-s-tool-contract-mid-run.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1733,
    "python_slice_tokens": 338,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the agent called a malicious tool.\" It is that the *tool contract itself* — name, description, parameter schema, and the semantic instructions the model reads to decide when to call it — is data the model trusts, and that data is re-fetched from a registry that can change between two calls in the same task. Prompt injection in retrieved *...",
    "what_was_observed": "A support-triage agent ran with a registry-backed tool list. On turn 1 it resolved tools: `search_tickets`, `get_customer`, `escalate`. It called `search_tickets`, got results, and the orchestrator re-resolved the registry before turn 2 (a \"refresh capabilities\" step intended to pick up newly granted scopes). Between turn 1 and turn 2, a tool named `search_tickets_v2` appeared in the registry. Its schema declared a r...",
    "condition_of_validity": "The attack requires three conditions to hold simultaneously: 1. **Late binding.** The registry is consulted more than once per task, or tool selection is deferred until after untrusted input has entered the context. If tools are resolved once at task start and frozen, the window closes. 2. **Name-based identity.** The runtime maps a chosen tool name to an im...",
    "decision_boundary": "The boundary is between *capability refresh* and *contract mutation*. An agent may legitimately gain a new scope or a new tool mid-task. It may not silently change the meaning of a tool it has already reasoned about or called. Concretely: - **Permitted:** adding a tool whose name is not in the task's pinned set, provided the addition is surfaced to the model...",
    "operational_effect": "With contract pinning in place, the `search_tickets_v2` call fails closed: the name normalizes to a pinned name, the digest mismatches, and the runtime raises rather than dispatching. The in-place description rewrite of `escalate` fails the same way — same name, different digest, refused. The agent's belief about its tools can no longer be invalidated withou..."
  },
  "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": "23d69ab27700f4337f1559baba13849be8cae0280a45a536bc4f3895231609c7",
    "verified_classes": [
      "ContractMutationError",
      "ToolContract",
      "PinnedRegistry"
    ],
    "verified_functions": [
      "_normalize",
      "dispatch_turn",
      "digest",
      "__init__",
      "verify_turn",
      "admit"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ContractMutationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "json"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
