{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-compacts-its-own-context-mid-tool-call-and-the-summarizer-re-emits-a-stale-tool-result-as-fresh-ground-truth",
  "title": "What happens when an instance compacts its own context mid-tool-call and the summarizer re-emits a stale tool result as fresh ground truth",
  "date_of_record": "2026 November 30",
  "scope": "Applies to single-agent loops that perform autonomous context compaction (summarize-and-drop) when token pressure or semantic-redundancy thresholds trip, especially when compaction fires while a tool call is in flight or immediately after a result returns. Does not apply to stateless single-shot inference, or to systems that compact only at explicit turn boundaries with no outstanding tool futures.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-compacts-its-own-context-mid-tool-call-and-the-summarizer-re-emits-a-stale-tool-result-as-fresh-ground-truth.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-compacts-its-own-context-mid-tool-call-and-the-summarizer-re-emits-a-stale-tool-result-as-fresh-ground-truth.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-compacts-its-own-context-mid-tool-call-and-the-summarizer-re-emits-a-stale-tool-result-as-fresh-ground-truth.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2111,
    "python_slice_tokens": 395,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different things a compaction pass can summarize: **conversational residue** (reasoning traces, superseded plans, redundant restatements) and **evidential state** (tool outputs, file reads, API responses, verifier verdicts). Residue is safe to lossy-compress because a wrong summary only costs tokens to re-derive. Evidential state i...",
    "what_was_observed": "A file-editing agent under a 96k effective context budget ran a loop against a large config tree. At step 41 it issued `read_file(path=\"svc/limits.yaml\")` and received a 3.1k-token result with `max_conn: 512`. At step 44, after an unrelated edit, it re-read the same file and received `max_conn: 256` — the edit tool had rewritten the file and the value had changed. Token pressure crossed the 0.85 threshold at step 46....",
    "condition_of_validity": "The invariant that bounds this failure is: **a summarized tool result may never be promoted to evidential state unless its provenance chain includes a post-compaction re-validation, or the summary explicitly carries a `stale_after` marker tied to the last mutating write to that resource.** Concretely, for the guardrail to hold: 1. The compactor must tag ever...",
    "decision_boundary": "The decision boundary is whether the agent, at the moment it consumes a summarized value, can distinguish \"I read this and it is current\" from \"I read this and a summary of it survived compaction.\" These are different epistemic states and must not collapse into one representation. The boundary sits at the summarizer's output schema: if the summary bullet is ...",
    "operational_effect": "Downstream of an unguarded compaction, three effects compound. First, **provenance laundering**: a paraphrased value acquires the authority of a tool result, and no tool error or schema check fires, because the value is plausible and the tool that \"produced\" it did run. Second, **delayed divergence**: the error is invisible until a verifier or an external sy..."
  },
  "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": "8933e1b3297c283a1f1f405bc6484f5a3d459761c8918ec762e1dfaf4a73c4e0",
    "verified_classes": [
      "StaleCompactedAssertionError",
      "CompactedAssertion",
      "ResourceEpoch"
    ],
    "verified_functions": [
      "consume_for_write",
      "dedup_gate",
      "bump",
      "current"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "StaleCompactedAssertionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
