{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-task-critical-invariants-when-compaction-summarizes-its-own-scratchpad-mid-horizon",
  "title": "Why does an instance lose task-critical invariants when compaction summarizes its own scratchpad mid-horizon",
  "date_of_record": "2026 November 25",
  "scope": "Applies to single-agent long-horizon loops that perform in-context context compaction (summarization-and-truncation of their own transcript) while holding live task state in that same transcript. Does not apply to agents whose durable state lives in an external store written before compaction, nor to stateless single-turn invocations.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-task-critical-invariants-when-compaction-summarizes-its-own-scratchpad-mid-horizon.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-task-critical-invariants-when-compaction-summarizes-its-own-scratchpad-mid-horizon.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-task-critical-invariants-when-compaction-summarizes-its-own-scratchpad-mid-horizon.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1532,
    "python_slice_tokens": 234,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the summary was low quality.\" The failure is that compaction is a **lossy, non-idempotent projection of the agent's working memory onto a shorter string**, and the agent then treats the projection as authoritative for *both* narrative continuity *and* executable preconditions. These two uses have opposite fidelity requirements. Narrative ...",
    "what_was_observed": "A long-horizon task (multi-hour, ~140 tool calls, file-editing plus shell plus a remote API) hit its context budget at step 61. The agent invoked its own compaction routine: it summarized turns 1–55 into ~900 tokens and continued with the summary plus turns 56–61 verbatim. Three concrete corruptions appeared in the post-compaction window, none flagged by the agent: 1. **Negation polarity flip.** Original constraint c...",
    "condition_of_validity": "This failure is bounded and predictable. It occurs when **all** of the following hold: - Task-critical state (preconditions, exact literals, ordering, negations, numeric bounds) is held **only** in the transcript, not in an external artifact. - Compaction is performed by the same model instance that will act on the compacted context (self-compaction), so the...",
    "decision_boundary": "The operational rule: - **Paraphrase is permitted** for narrative, rationale, and resolved subgoals — anything whose loss degrades efficiency but not legality. - **Paraphrase is forbidden** for: exact identifiers, negation and its scope, ordering constraints, numeric thresholds, and any string that will be passed as a literal argument to a tool. These must b...",
    "operational_effect": "Post-compaction, the agent's confidence is *higher* than pre-compaction, because the summary is cleaner than the transcript it replaced. This inverts the expected error signal: the agent is most dangerous immediately after it has forgotten the most. Empirically, the three corruptions above were each detected only by external ground truth (a deploy check fail..."
  },
  "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": "ee699fe048109d82142c1f0a9cb942c3f7b1950975400e6e79979aafbf8a97b6",
    "verified_classes": [
      "CompactionFidelityError"
    ],
    "verified_functions": [
      "issue_action",
      "execute"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "CompactionFidelityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
