{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-silently-corrupt-its-own-working-set-when-auto-compaction-summarizes-a-transcript-that-is-still-being-appended-to",
  "title": "Why does an instance silently corrupt its own working set when auto-compaction summarizes a transcript that is still being appended to?",
  "date_of_record": "2026 November 30",
  "scope": "Applies to long-horizon agents that trigger in-place transcript compaction (summarize-and-replace) while tool calls, async results, or sub-agent returns may still be in flight. Does not apply to append-only logs that never rewrite prior turns, nor to compaction performed only at quiescent turn boundaries with a drained tool queue.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-silently-corrupt-its-own-working-set-when-auto-compaction-summarizes-a-transcript-that-is-still-being-appended-to.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-silently-corrupt-its-own-working-set-when-auto-compaction-summarizes-a-transcript-that-is-still-being-appended-to.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-silently-corrupt-its-own-working-set-when-auto-compaction-summarizes-a-transcript-that-is-still-being-appended-to.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1952,
    "python_slice_tokens": 376,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different things an agent calls \"compaction\": 1. **Quiescent compaction** — the transcript is frozen, no tool call is outstanding, no async callback is pending. The summarizer reads a stable snapshot and writes a replacement. The invariant `summarize(S) ⊒ facts(S)` can be checked because `S` does not move. 2. **Live compaction** — ...",
    "what_was_observed": "A coding agent runs a 40-minute task with a token watermark at 80% of the context window. At turn 61 it emits a `tool_use` for a long-running test command (`id: \"call_7f3a\"`) and blocks. The watermark fires on the *next* token accounting pass — which counts the emitted `tool_use` block but not the yet-unreceived result. Compaction runs: - The summarizer is handed turns 1–61 and instructed to \"preserve all task-releva...",
    "condition_of_validity": "Live compaction is only sound under a **quiescence invariant** that must be enforced before the summarizer runs: If the invariant cannot be established, compaction must either (a) defer until quiescence — draining the tool queue, joining sub-agents, or timing out outstanding calls and recording the timeout as a first-class turn — or (b) treat in-flight handl...",
    "decision_boundary": "The decision boundary is not \"how full is the context\" but \"is the transcript a closed set of turns.\" Concretely: A watermark-triggered compactor that does not consult the queue is making a decision on the wrong axis. The correct trigger is `watermark_crossed AND queue_drained`, not `watermark_crossed`. When the queue cannot be drained (a genuinely long-runn...",
    "operational_effect": "Once the quiescence invariant is enforced, three operational properties change: 1. **Idempotent re-dispatch disappears.** The agent no longer re-runs side-effecting tools because a result was orphaned. Test suites, file writes, and API mutations stop duplicating. 2. **Summarizer quality is no longer load-bearing for correctness.** The summarizer can be as lo..."
  },
  "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": "3a37a879c910d040c7dc31681489137d485cccc4fbce90c74d8bc5e715dba7df",
    "verified_classes": [
      "CompactionViolation",
      "Handle"
    ],
    "verified_functions": [
      "pending_handles",
      "compact",
      "_drain"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "CompactionViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
