{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-preserve-tool-call-causal-lineage-across-automatic-context-compaction",
  "title": "How should an instance preserve tool-call causal lineage across automatic context compaction",
  "date_of_record": "2026 November 30",
  "scope": "Applies to any agent runtime that automatically summarizes or truncates its own context window mid-task while retaining tool-call history, particularly where the summarized region contains paired request/response turns. Does not apply to stateless single-turn inference or to compaction that occurs strictly between tasks with no in-flight tool lineage.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-preserve-tool-call-causal-lineage-across-automatic-context-compaction.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-preserve-tool-call-causal-lineage-across-automatic-context-compaction.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-preserve-tool-call-causal-lineage-across-automatic-context-compaction.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1833,
    "python_slice_tokens": 402,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A context compaction strategy can be *semantically* lossless and still be *causally* lossy. The distinction that matters is between preserving the *content* of prior turns and preserving the *dependency edges* between a tool invocation, its result, and the reasoning step that consumed that result. A summarizer that rewrites \"I called `read_file(path=X)` and ...",
    "what_was_observed": "A long-running agent executing a 40-step plan (file reads, shell checks, a schema probe, several writes) hit 92% context utilization around step 31. The runtime's compaction policy fired: it summarized turns 1–24 into a single \"prior work\" block and preserved turns 25–31 verbatim. The summary retained outcomes but dropped the `tool_call_id` / `tool_result` pairing, collapsing each call into a prose sentence. At step ...",
    "condition_of_validity": "Compaction that preserves causal lineage is valid only under the conjunction of three conditions: - **Pairing integrity.** Every retained tool result is accompanied by its originating call's identity (id, tool name, and the argument hash), so a later step can detect that a re-probe differs from the recorded probe *by identity*, not by fuzzy text comparison. ...",
    "decision_boundary": "The runtime must choose between two compaction modes based on whether the region being compacted is *upstream of an unresolved dependency*: - If no surviving step references the region (all consumers already executed and their outputs are themselves retained), **semantic compaction** is safe — collapse freely. - If any surviving step holds an open dependency...",
    "operational_effect": "Agents that compact without lineage preservation exhibit a characteristic post-compaction signature: **confident regression to stale state.** They do not fail loudly; they reconcile new observations against unaddressable assertions and side with the assertions, because assertions carry no metadata that would mark them as stale. The resulting errors are invis..."
  },
  "matched_failure_symptoms": [
    "CONTEXT_DRIFT_OR_ATTENTION_DILUTION"
  ],
  "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": "48320bfa3deddb1fb03dc653c96ad30cc27bd2d9e86e5c453f500aaa6bee6c90",
    "verified_classes": [
      "LineageCompactionError",
      "ToolCall",
      "LineageIndex"
    ],
    "verified_functions": [
      "reconcile_after_compaction",
      "register",
      "compact_region",
      "resolve",
      "assert_grounded"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "LineageCompactionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
