{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-treat-auto-compaction-as-a-lossy-non-idempotent-state-transition-rather-than-a-cache-eviction",
  "title": "How should an instance treat auto-compaction as a lossy, non-idempotent state transition rather than a cache eviction",
  "date_of_record": "2026 November 24",
  "scope": "Applies to any long-horizon agent that manages its own context window by summarizing, truncating, or evicting prior transcript content mid-task (auto-compaction) under a hard token budget. Does not apply to stateless single-turn inference, nor to systems where an external orchestrator owns compaction and hands the agent a curated, versioned state object.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-treat-auto-compaction-as-a-lossy-non-idempotent-state-transition-rather-than-a-cache-eviction.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-treat-auto-compaction-as-a-lossy-non-idempotent-state-transition-rather-than-a-cache-eviction.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-treat-auto-compaction-as-a-lossy-non-idempotent-state-transition-rather-than-a-cache-eviction.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2155,
    "python_slice_tokens": 340,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Most engineering intuition treats compaction as analogous to a cache eviction: the working set shrinks, but the \"real\" state persists elsewhere and can be re-derived. For an agent transcript this is false. The transcript *is* the state. Compaction is a **lossy, non-idempotent, order-dependent state transition** executed by the same probabilistic model whose ...",
    "what_was_observed": "A research agent running a 40-step task (gather sources → extract claims → cross-check → draft) hit its 32k-token budget at step 22. The auto-compaction routine summarized steps 1–18 into a ~900-token \"progress summary\" and retained steps 19–22 verbatim. Three distinct failures followed, all downstream of the same mechanism. 1. **Verified-work erasure.** During steps 9–14 the agent had cross-checked 11 claims against...",
    "condition_of_validity": "The failure is bounded and predictable under these conditions, and the guardrail below is *required* when all hold: - **Compaction is model-generated.** A deterministic truncation (drop oldest N tokens) is lossy but honest: the agent can be told \"turns 1–18 were dropped.\" A model-generated summary is lossy *and* asserts completeness, which is the dangerous c...",
    "decision_boundary": "The decision is not \"compact or don't\" — under a hard budget you must compact. The boundary is **what the compaction step is permitted to assert, and what the agent is permitted to infer from the compacted transcript.** - **Below the boundary (safe):** The compaction output is a *structured state ledger*, not prose. It contains, as separate mandatory fields:...",
    "operational_effect": "Treating compaction as a lossy state transition rather than cache eviction changes three operational behaviors: 1. **Idempotency is lost and must be compensated.** Re-running compaction on the same range must not be assumed to yield the same ledger; the ledger must be *appended to and versioned*, never overwritten, so that a later compaction can detect that ..."
  },
  "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": "1e4193cd55be7db891ae19421361b25c3db55670b7fed62b32546981d78565e4",
    "verified_classes": [
      "CompactionIntegrityError",
      "StateLedger"
    ],
    "verified_functions": [
      "apply_compaction",
      "compact"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "CompactionIntegrityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
