{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-context-compaction-from-severing-the-causal-chain-between-a-tool-result-and-the-action-that-consumed-it",
  "title": "Which invariants prevent context compaction from severing the causal chain between a tool result and the action that consumed it",
  "date_of_record": "2026 November 15",
  "scope": "Applies to any agent loop that performs lossy context compaction (summarization, eviction, truncation) while a tool call's result is in-flight or recently returned and not yet acted upon. Does not apply to append-only contexts with unbounded windows, nor to compaction that runs only at explicit task boundaries with no pending tool state.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-context-compaction-from-severing-the-causal-chain-between-a-tool-result-and-the-action-that-consumed-it.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-context-compaction-from-severing-the-causal-chain-between-a-tool-result-and-the-action-that-consumed-it.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-context-compaction-from-severing-the-causal-chain-between-a-tool-result-and-the-action-that-consumed-it.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1063,
    "python_slice_tokens": 230,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the summary lost a fact.\" It is that compaction reorders the *dependency* between a tool result and the downstream action that reads it, while leaving both artifacts individually present. A summarizer scores each message by salience in isolation; a tool result like `{\"balance\": 4312.07}` scores low alone but is the sole input to a subsequ...",
    "what_was_observed": "During a long multi-step reconciliation task, the window crossed the compaction threshold immediately after a `fetch_ledger_entry` call returned a structured record. The compactor emitted a summary that included the ledger entry verbatim but placed it in a \"Background data\" section several paragraphs before the \"Current plan\" section. The next turn, the agent issued `post_adjustment` with an amount matching neither t...",
    "condition_of_validity": "The invariant holds only when compaction operates on *units* that are causally closed: a `tool_use`/`tool_result` pair, or a result together with the immediately following assistant turn that consumed it. Compaction is safe to reorder or summarize across these units only if it preserves an explicit pointer—an ID, a restated argument binding, or a \"consumed b...",
    "decision_boundary": "Before compacting, classify each candidate unit as *pending-consumption* (result returned, no downstream action yet in the transcript) or *settled* (result already acted upon). Pending-consumption units must be retained whole and adjacent, or blocked from compaction entirely until settled. Do not summarize a pending result into prose; either keep the structu...",
    "operational_effect": "Enforcing result-to-consumer adjacency eliminates the class of \"fabricated re-invocation\" errors where the agent re-calls a tool because the prior result appeared orphaned. It costs window headroom during long tool chains, which is the correct trade: the alternative is silent argument corruption that passes schema validation and fails at the external system...."
  },
  "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": "15d1746ec998a54a436df30a2e198912e056ad8112cd7b3d51d8ea20f0ccf55c",
    "verified_classes": [
      "CompactionBindingError",
      "UnitState",
      "ContextUnit"
    ],
    "verified_functions": [
      "select_compaction_set",
      "compact",
      "state"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "CompactionBindingError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
