{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-causal-ordering-when-auto-compaction-rewrites-a-tool-call-transcript-across-a-token-ceiling",
  "title": "Why does an instance lose causal ordering when auto-compaction rewrites a tool-call transcript across a token ceiling",
  "date_of_record": "2026 November 25",
  "scope": "Applies to long-horizon agents whose runtime performs mid-session transcript compaction (summarization, eviction, or windowed rewriting) while tool-call/tool-result pairs are still logically in-flight. Does not apply to stateless single-turn invocation or to compaction performed strictly between completed task boundaries with a quiesced call graph.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-causal-ordering-when-auto-compaction-rewrites-a-tool-call-transcript-across-a-token-ceiling.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-causal-ordering-when-auto-compaction-rewrites-a-tool-call-transcript-across-a-token-ceiling.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-causal-ordering-when-auto-compaction-rewrites-a-tool-call-transcript-across-a-token-ceiling.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1915,
    "python_slice_tokens": 490,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"summarization loses detail.\" It is that compaction is a *rewrite of the causal record*, and the transcript is not a document—it is a partially ordered execution log in which tool-call IDs, result bindings, and the model's own prior reasoning form a dependency graph. A generic summarizer treats the transcript as text and preserves *topical...",
    "what_was_observed": "A coding agent on a 90-minute task accumulated ~40 tool calls. At the 128k ceiling, the runtime triggered auto-compaction: it replaced turns `[8..31]` with a ~600-token narrative summary (\"the agent inspected the repo, ran tests, and fixed a config issue\") and kept turns `[0..7]` and `[32..40]` verbatim. The summary was accurate at the topic level. The failure trace: 1. Turns `[0..7]` contained a `read_file(config.ya...",
    "condition_of_validity": "This mechanism only bites under a conjunction: - **Compaction boundary falls inside an open call/result span.** If every tool call in the evicted region has its result also inside the evicted region, the region is causally closed and summarizable. The hazard is a *split pair*: call in surviving prefix, result in evicted middle (or vice versa). - **A survivin...",
    "decision_boundary": "The architectural decision is **where the compaction boundary is allowed to fall**, and it is not a tunable heuristic—it is an invariant. - **Permitted:** compact only *causally closed* regions—maximal spans where every tool-call ID present has its matching result present, and no surviving turn references an evicted entity by ID or by content hash. - **Forbi...",
    "operational_effect": "Downstream, the effect is *error compounding under false confidence*. Because the model's reconstructed history is internally consistent, it does not hedge or re-verify; it commits mutations. Each subsequent turn builds on the false premise, so the divergence grows super-linearly with task length rather than resetting at each compaction. In observed traces, ..."
  },
  "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": "39c8fdc30e31bdd36869c9631963b636cff8d70db7834cb2ab23f32d8b17856e",
    "verified_classes": [
      "CompactionClosureError",
      "ToolCall",
      "Turn"
    ],
    "verified_functions": [
      "plan_compaction",
      "guarded_compact"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "CompactionClosureError"
    ],
    "sample_fail_closed_invariants": [
      "compaction refused: boundary not causally closed; shrink eviction window or insert rehydration stubs"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
