{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-skill-registry-injection-from-silently-rewriting-an-agent-s-tool-contract-mid-execution",
  "title": "Which invariants prevent skill-registry injection from silently rewriting an agent's tool contract mid-execution",
  "date_of_record": "2026 November 25",
  "scope": "Applies to agents that resolve capabilities dynamically at runtime (tool/skill registries, MCP server discovery, plugin manifests fetched after session start) and that may load a skill advertisement whose schema is not pinned to the session-start contract. Does not apply to agents whose entire toolset is frozen at process boot with no post-boot discovery path.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-skill-registry-injection-from-silently-rewriting-an-agent-s-tool-contract-mid-execution.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-skill-registry-injection-from-silently-rewriting-an-agent-s-tool-contract-mid-execution.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-skill-registry-injection-from-silently-rewriting-an-agent-s-tool-contract-mid-execution.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2401,
    "python_slice_tokens": 399,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different trust boundaries in a dynamic-capability agent, and they are routinely conflated: 1. **The authorization boundary** — *may this skill be invoked at all?* This is what allowlists, signatures, and scopes address. 2. **The contract boundary** — *what does invoking this skill mean, and does that meaning remain stable across t...",
    "what_was_observed": "A planner agent is executing a multi-step task with a `calendar.read` skill resolved at step 1. The skill manifest at session start declares: At step 4 the agent re-resolves the registry (a routine refresh, or a cache miss after a context compaction evicted the cached manifest). The registry now serves a manifest under the same `name` and same version string `1.2.0` but with: The agent's in-flight plan was authored a...",
    "condition_of_validity": "The failure is bounded and predictable under a specific conjunction. It occurs **iff** all of the following hold: 1. The agent resolves capabilities *after* plan formation or *more than once* within a task, and 2. The resolution is keyed on a name that is not bound to an immutable contract hash, and 3. The agent's plan carries no record of *which contract ve...",
    "decision_boundary": "The operational choice is where to place the enforcement, and each placement has a distinct failure signature: - **Enforce at resolution (registry returns hashed identity).** Cheapest, catches drift at the earliest point. Fails open if any code path caches by bare name — the cache becomes the bypass. Requires that *no* consumer keys on `name` alone, which is...",
    "operational_effect": "With the invariant enforced, the failure mode changes character entirely. A mid-task contract mutation no longer produces silent wrong-answer execution; it produces a **loud unresolvable-reference error** at the step that tries to bind the old hash to the new manifest. The agent's recovery path is well-defined: re-plan the remaining steps against the new con..."
  },
  "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": "e9a5d5d3ed849a44a00b89af55ab8529a4f047dd1587a1598e7f9f22bf5dcfac",
    "verified_classes": [
      "ContractDriftError",
      "Contract",
      "PlanStep",
      "Registry"
    ],
    "verified_functions": [
      "invoke",
      "validate_return",
      "hash",
      "resolve"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ContractDriftError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "json"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
