{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-compacts-its-own-context-window-mid-task-and-the-summarizer-silently-drops-the-invariant-it-was-hired-to-preserve",
  "title": "What happens when an instance compacts its own context window mid-task and the summarizer silently drops the invariant it was hired to preserve",
  "date_of_record": "2026 November 24",
  "scope": "Applies to single-agent or worker-agent instances that self-trigger context compaction (summarize-and-truncate) while an open task holds live invariants — pending tool side-effects, unresolved preconditions, or in-flight external state. Does not apply to compaction performed between tasks (idle checkpointing) or to stateless one-shot invocations where no external state is mutated.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-compacts-its-own-context-window-mid-task-and-the-summarizer-silently-drops-the-invariant-it-was-hired-to-preserve.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-compacts-its-own-context-window-mid-task-and-the-summarizer-silently-drops-the-invariant-it-was-hired-to-preserve.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-compacts-its-own-context-window-mid-task-and-the-summarizer-silently-drops-the-invariant-it-was-hired-to-preserve.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2034,
    "python_slice_tokens": 346,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two kinds of \"context\" an agent holds, and they compact differently. **Recency context** is the conversational tail — recent tool outputs, the last few reasoning steps. It degrades gracefully under summarization because the model can re-derive it from the environment. **Invariant context** is a small set of propositions that *must remain true and k...",
    "what_was_observed": "A worker instance executing a five-step resource-mutation task (provision → configure → verify → commit → teardown) hit its soft context ceiling (78% of window) during step 3 because the verification step returned a large verbose tool output (a full config dump). The auto-compaction trigger — a simple `tokens_used > 0.78 * window` threshold — fired *immediately*, with no check for open-task state. The summarizer rece...",
    "condition_of_validity": "Auto-compaction is safe **only** under the conjunction of three conditions, and it is the conjunction that makes it rare: 1. **No live invariant.** The task has no pending external side-effect, no unresolved precondition, and no open resource handle. Equivalently: the task is at a *quiescent point* where the entire world-state is re-derivable from tools. 2. ...",
    "decision_boundary": "The boundary is the **compaction trigger predicate**. A token-count threshold is the wrong predicate because it measures *pressure*, not *safety*. The correct predicate is a conjunction: - **Fire compaction only at quiescent points.** Define quiescence structurally: no in-flight tool call, no uncommitted mutation, no unresolved precondition, no open handle. ...",
    "operational_effect": "The architectural consequence is that **compaction becomes a checkpoint/restore operation, not a text-compression operation.** This changes the failure semantics from \"silent, confident, coherent corruption\" to \"loud, bounded, recoverable abort.\" A reconciliation mismatch after resume is detectable because the ledger is structured and the ground truth is re-..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "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": "28626f89d94f6c20cddf2cef3f1764eb5a76f1edc2429c43e056b8a6b437a991",
    "verified_classes": [
      "CompactionInvariantViolation",
      "InvariantLedger"
    ],
    "verified_functions": [
      "maybe_compact",
      "add",
      "reconcile"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "CompactionInvariantViolation"
    ],
    "sample_fail_closed_invariants": [
      "compaction pressure exceeded ceiling while task is non-quiescent; refusing lossy summarization across a live invariant —"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
