{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-task-identity-invariants-when-auto-compaction-summarizes-its-own-in-flight-tool-call-ledger",
  "title": "Why does an instance lose task-identity invariants when auto-compaction summarizes its own in-flight tool-call ledger",
  "date_of_record": "2026 November 27",
  "scope": "Applies to long-horizon agent instances that use LLM-driven transcript auto-compaction (summarize-and-truncate) while tool calls are in flight or pending acknowledgement. Does not apply to append-only transcripts with no compaction, nor to compaction performed only at quiescent turn boundaries where no tool call is outstanding.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-task-identity-invariants-when-auto-compaction-summarizes-its-own-in-flight-tool-call-ledger.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-task-identity-invariants-when-auto-compaction-summarizes-its-own-in-flight-tool-call-ledger.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-task-identity-invariants-when-auto-compaction-summarizes-its-own-in-flight-tool-call-ledger.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1761,
    "python_slice_tokens": 252,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two economically similar but semantically distinct things an agent transcript contains: **narrative context** (what the agent believes it is doing, why, and what it has learned) and the **tool-call ledger** (the exact set of calls issued, their arguments, their acknowledgements, and their pending/committed status). Auto-compaction treats both as \"t...",
    "what_was_observed": "A code-modification agent on a 40-minute horizon repeatedly hit its 32k-token context ceiling and ran a compaction policy triggered at 85% saturation. The compactor was an LLM instructed to \"preserve key facts and drop redundant tool output.\" The observed trace: 1. At turn T, the agent issued a call `write_file(path=\"/repo/migrate.py\", body=..., idem=\"m-4417\")` to a remote executor over a transport with a 30s ack tim...",
    "condition_of_validity": "The guardrail holds—and the failure is bounded—only under these conditions: - **Ledger externalization.** The authoritative tool-call ledger lives *outside* the compactable transcript (a durable store keyed by `call_id`), and the transcript holds only a *reference*. Compaction may rewrite the reference's prose but cannot rewrite the ledger. This is the struc...",
    "decision_boundary": "The decision is not \"should we compact\" but **\"is the transcript the system of record for side-effecting calls?\"** - If **yes** (transcript is the only ledger), auto-compaction of in-flight calls is prohibited. You must either externalize the ledger or gate compaction on quiescence. There is no safe middle ground with a free-form summarizer. - If **no** (led...",
    "operational_effect": "When the invariant is enforced, the observable effect is that **duplicate side effects drop to zero even under lost acks and mid-flight compaction**, at the cost of one extra ledger lookup per re-issue decision and a hard dependency on the external store's availability. Latency increases marginally (a synchronous status read before re-issue). When the invari..."
  },
  "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": "614feddcdb9781b573975ca01b9b80ca08635e206577770e4f9733c9d9fd207f",
    "verified_classes": [
      "LedgerAmnesiaError"
    ],
    "verified_functions": [
      "guarded_reissue"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "LedgerAmnesiaError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
