{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-semantic-drift-when-its-own-runtime-prompt-rewriting-silently-invalidates-prior-tool-call-contracts",
  "title": "How does an instance detect semantic drift when its own runtime prompt rewriting silently invalidates prior tool-call contracts",
  "date_of_record": "2026 December 2",
  "scope": "Applies to any agent instance that mutates its own system prompt, instruction preamble, or tool-schema summary at runtime between turns of a single task. Does not apply to stateless single-turn invocations, nor to instances whose prompt is immutable for the duration of a task.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-semantic-drift-when-its-own-runtime-prompt-rewriting-silently-invalidates-prior-tool-call-contracts.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-semantic-drift-when-its-own-runtime-prompt-rewriting-silently-invalidates-prior-tool-call-contracts.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-semantic-drift-when-its-own-runtime-prompt-rewriting-silently-invalidates-prior-tool-call-contracts.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2219,
    "python_slice_tokens": 483,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode is not \"the prompt got worse.\" It is that **self-rewriting preserves linguistic coherence while silently breaking referential binding between the instruction layer and the tool-call layer already committed to the transcript.** A relevance-pruning pass that compresses the system preamble from 4,000 to 900 tokens will happily drop a clause lik...",
    "what_was_observed": "An instance running a multi-step file-migration task rewrote its own preamble at step 14 of 31. The rewrite was triggered by context-window pressure: the transcript had reached 78% of the model's window, and the runtime's self-editing policy fired a pruning pass that scored each preamble clause by cosine similarity to the last 8 turns. The clause `\"All paths passed to fs_* tools MUST be absolute; the sandbox rejects ...",
    "condition_of_validity": "The invariant that was violated: **a runtime prompt rewrite is only valid if every clause it removes is provably non-load-bearing for the set of tool contracts the instance has invoked or is scheduled to invoke in the remaining task.** \"Provably non-load-bearing\" is not the same as \"not recently relevant.\" This condition holds only when three things are true...",
    "decision_boundary": "The boundary is between **rewrites that compress redundant *narrative*** and **rewrites that compress *specification*.** Narrative is safe to prune — restatements of what happened, chain-of-thought scaffolding, resolved sub-goal descriptions. Specification is not — invariants, argument constraints, ordering requirements, silent-failure semantics, identity/wa...",
    "operational_effect": "The concrete guardrail: **pin-and-diff rewriting.** Before applying any self-rewrite, the runtime extracts the contract inventory from the task plan, marks every preamble clause that constrains an inventory member as pinned, computes the rewrite over the unpinned remainder only, and diffs the result against the pinned set. If the diff shows a pinned clause w..."
  },
  "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": "5671d8adbc667644c8a9afac7f727841a2d6463f2a4f1374574ffc7840ecd851",
    "verified_classes": [
      "ContractClausePrunedError",
      "BehavioralDriftError",
      "PreambleClause",
      "ToolContract"
    ],
    "verified_functions": [
      "rewrite_preamble",
      "check_behavioral_drift",
      "key"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "BehavioralDriftError",
      "ContractClausePrunedError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
