{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-rewrite-its-own-prompt-mid-flight-and-silently-drop-the-tool-call-that-authorized-the-rewrite",
  "title": "Why does an instance rewrite its own prompt mid-flight and silently drop the tool-call that authorized the rewrite",
  "date_of_record": "2026 December 2",
  "scope": "Applies to agents that mutate their own working context (summarize, prune, re-rank, or splice) while a tool call is in flight—i.e., between emitting a tool invocation and consuming its result. Does not apply to static single-shot prompts or to external orchestration layers that rewrite context only at turn boundaries.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-rewrite-its-own-prompt-mid-flight-and-silently-drop-the-tool-call-that-authorized-the-rewrite.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-rewrite-its-own-prompt-mid-flight-and-silently-drop-the-tool-call-that-authorized-the-rewrite.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-rewrite-its-own-prompt-mid-flight-and-silently-drop-the-tool-call-that-authorized-the-rewrite.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1999,
    "python_slice_tokens": 407,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different moments at which a context policy can fire: **quiescent rewriting** (at a turn boundary, with no outstanding tool call) and **in-flight rewriting** (while the agent has emitted a `tool_call` block but has not yet received or integrated the `tool_result`). Quiescent rewriting is a pure function of the current transcript an...",
    "what_was_observed": "A planner agent running a 5-step research loop with a self-editing context policy (\"keep last 3 turns verbatim; summarize older turns; drop turns whose semantic content is ≥0.92 cosine-similar to a retained summary\") executed the following trace: 1. Turn 4: agent emits `tool_call(id=\"c7\", name=\"fetch\", args={\"url\": ...})`. Transcript length 6,200 tokens. 2. **Same generation, before result arrives:** the policy's tri...",
    "condition_of_validity": "In-flight rewriting is only sound under a **call-result pairing invariant** that the policy must enforce structurally, not semantically: - **P1 (pairing):** No pruning operation may remove a `tool_call` turn while its `tool_result` is absent from the transcript, unless the removal is accompanied by a tombstone record `{call_id, \"pending\", expected_result_sch...",
    "decision_boundary": "The boundary is not \"how aggressive should pruning be\"—it is **whether the context policy is allowed to observe a transcript state with a dangling commitment.** Two admissible designs: - **Quiescent-only (safe, costly):** context mutation is gated on `outstanding_calls == 0`. The agent may sit at 8k tokens waiting for a slow tool; you pay in latency and in r...",
    "operational_effect": "Downstream, the orphaned result manifests as three distinguishable symptoms that operators frequently misattribute: 1. **Duplicate tool invocations** (the model re-calls because it \"doesn't remember\" the call) — inflates cost, can double side effects on non-idempotent tools. 2. **Trust degradation** (the model treats the unattributed result as external conte..."
  },
  "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": "bfc6af5b51f6a3bae9eab2e6028230e4d51ec7237686176b30f2ffd571c185f2",
    "verified_classes": [
      "OrphanedToolResultError",
      "Turn",
      "Context"
    ],
    "verified_functions": [
      "apply_pruning_policy",
      "integrate_result",
      "live_call_ids",
      "result_call_ids"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "OrphanedToolResultError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
