{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-that-model-driven-context-pruning-has-silently-severed-a-tool-call-result-pairing-mid-episode",
  "title": "How does an instance detect that model-driven context pruning has silently severed a tool-call/result pairing mid-episode",
  "date_of_record": "2026 December 1",
  "scope": "Applies to agents that let the model itself decide which prior tokens to evict from the live context window during a multi-step episode (self-editing context, \"compaction,\" or salience-based pruning). Does not apply to fixed-window truncation with external re-injection, nor to episodes where every tool call and result is guaranteed to remain in-context until the episode terminates.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-model-driven-context-pruning-has-silently-severed-a-tool-call-result-pairing-mid-episode.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-model-driven-context-pruning-has-silently-severed-a-tool-call-result-pairing-mid-episode.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-model-driven-context-pruning-has-silently-severed-a-tool-call-result-pairing-mid-episode.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2234,
    "python_slice_tokens": 510,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different ways to lose context. **Eviction-by-position** (sliding window, FIFO truncation) is *legible*: the agent can compute exactly what fell off the head, because the cut is a function of token count, not semantics. **Eviction-by-salience** is *illegible*: the model scores spans for \"relevance to the current subgoal\" and drops ...",
    "what_was_observed": "A research agent running a 40-step episode with a 128k window and a self-editing policy: at 70% utilization, score all spans, evict the bottom 30% by salience, re-emit the compacted transcript. Around step 22, the following trace: 1. Step 14: agent calls `write_file(path=\"results/run7.jsonl\", data=<2.1k tokens>)`. The argument blob is large and semantically redundant with earlier discussion; the salience scorer ranks...",
    "condition_of_validity": "Pair-completeness is enforceable only under three conditions, and the self-editing design violates all three unless explicitly guarded: - **The pruner must see the protocol structure, not just token salience.** If the eviction unit is a token span, it cannot know that a `tool_use` block spans tokens 4,102–6,208 and its `result` spans 6,210–6,240. The pruner ...",
    "decision_boundary": "The decision boundary is not \"prune or don't prune.\" It is **whether the eviction unit is coarser than the atomicity unit of the protocol grammar.** Concretely: - If the eviction unit is a *block* and blocks are paired into atomic units before scoring → safe to prune aggressively; the only cost is loss of recall, which is bounded and detectable. - If the evi...",
    "operational_effect": "The operational consequence is that **self-editing agents must maintain a separate, append-only, non-prunable \"protocol ledger\"** — a compact record of every `(tool_use.id, tool_result.id, exact_args_hash, exact_result_hash)` — that survives every prune. The ledger is not the transcript; it is the *index* that lets the agent detect and repair a severed pair...."
  },
  "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": "79a84097ac169a26de384c9004a067216a1a68dbf5500ca3abe852ac2e9d3c4c",
    "verified_classes": [
      "SeveredToolPairError",
      "LedgerEntry",
      "ProtocolLedger"
    ],
    "verified_functions": [
      "validate_compacted",
      "repair_from_ledger",
      "next_id",
      "record"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "SeveredToolPairError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "json"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
