{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-of-transcript-auto-compaction-preserve-replay-divergence-as-a-first-class-invariant",
  "title": "Where must an instance of transcript auto-compaction preserve replay divergence as a first-class invariant",
  "date_of_record": "2026 November 16",
  "scope": "Applies to agent runtimes that persist a long-horizon transcript, periodically auto-compact it into a summary or delta, and later replay that transcript to reconstruct agent state (for audit, for resumption, or for forking). Does not apply to append-only logs that are never compacted, nor to stateless request/response traces where replay is not a supported operation.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-of-transcript-auto-compaction-preserve-replay-divergence-as-a-first-class-invariant.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-of-transcript-auto-compaction-preserve-replay-divergence-as-a-first-class-invariant.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-of-transcript-auto-compaction-preserve-replay-divergence-as-a-first-class-invariant.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1503,
    "python_slice_tokens": 313,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The non-obvious boundary is between **compaction-as-storage-optimization** and **compaction-as-state-transformation**. A transcript is not merely a byte stream; it is the *canonical input* from which a replay engine deterministically re-derives agent state. When auto-compaction replaces a span of turns with a summary, it does not merely shrink bytes — it rep...",
    "what_was_observed": "Across several long-horizon agent runs (transcripts exceeding ~40k turns with repeated tool-call/retry loops), the following failure pattern reproduced: 1. A compaction pass summarized turns `[t_i, t_j]` into a synthetic turn `S`. The summarizer was an LLM with temperature > 0 and its own context truncation. 2. On replay, the engine re-fed `S` in place of `[t_i, t_j]`. The agent's *next* decision diverged from the or...",
    "condition_of_validity": "Compaction is only replay-safe under a conjunction of conditions that are rarely all true: - **Deterministic summarization** — the summary is a pure function of the span (e.g., a hash, a structured extract with a fixed schema, or a lossless structural fold). Any LLM-generated free-text summary violates this. - **Sufficient residual** — every token that any d...",
    "decision_boundary": "The operational decision is: **at what compression ratio does a span transition from \"safely summarizable\" to \"must be preserved verbatim or marked divergent\"?** The boundary is not a fixed ratio; it is determined by *decision density* — the number of downstream agent decisions that condition on tokens within the span. A span of 500 conversational turns with...",
    "operational_effect": "Teams that ignore this boundary observe three recurring symptoms: (a) replays that \"succeed\" but produce different side-effect counts, (b) audit trails that cannot be reconciled against the original run because the summary paraphrased a load-bearing error, and (c) fork operations that inherit a subtly different state and then diverge immediately. The fix is ..."
  },
  "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": "ebd360bbfb90767ea88271ed885506536dedae9a452b05bf01478b22c7e89f7c",
    "verified_classes": [
      "ReplayDivergenceError",
      "Span",
      "CompactedSpan"
    ],
    "verified_functions": [
      "decide_compaction",
      "replay",
      "sha256"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ReplayDivergenceError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
