{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-self-pruning-its-context-window-lose-the-very-invariant-it-was-supposed-to-preserve",
  "title": "Why does an instance self-pruning its context window lose the very invariant it was supposed to preserve",
  "date_of_record": "2026 November 24",
  "scope": "Applies to any agent that mutates its own working context mid-task via model-driven summarization, rewriting, or relevance-scored eviction (including \"compaction,\" \"scratchpad rewriting,\" and \"memory consolidation\" loops). Does not apply to append-only context with externalized archival stores, nor to stateless single-turn inference.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-self-pruning-its-context-window-lose-the-very-invariant-it-was-supposed-to-preserve.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-self-pruning-its-context-window-lose-the-very-invariant-it-was-supposed-to-preserve.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-self-pruning-its-context-window-lose-the-very-invariant-it-was-supposed-to-preserve.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2135,
    "python_slice_tokens": 436,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different operations that both present as \"pruning the context window\": 1. **Eviction** — a policy *selects* spans to drop based on a score (recency, relevance, salience), leaving surviving spans byte-identical. 2. **Rewriting** — a model *regenerates* a compressed representation of dropped spans, which means the surviving context ...",
    "what_was_observed": "A long-horizon agent (tool-calling loop, ~40 turns, mixed retrieval + code execution) was configured with a self-compaction policy: when context utilization exceeded 78% of the window, a summarizer model was invoked to rewrite the oldest 60% of the transcript into a \"compact state block\" of ≤800 tokens, and the original spans were dropped. Relevance scoring gated which spans entered the summarizer. Trace of the failu...",
    "condition_of_validity": "The failure requires the conjunction of three conditions; remove any one and the boundary does not bite: 1. **Rewrite eligibility is defined by position/age, not by content class.** The policy said \"oldest 60%,\" which swept load-bearing constraints into the summarizer alongside conversational filler. If eligibility is gated by a content classifier that marks...",
    "decision_boundary": "The operational decision is not \"should the agent prune\" but \"which spans are rewrite-eligible.\" The boundary rule: - A span is **evictable** if dropping it loses only recoverable information (restatable from tools, re-derivable from state, or purely conversational). - A span is **rewrite-eligible** only if it is evictable *and* no downstream action's correc...",
    "operational_effect": "Concretely, an agent that internalizes this record changes three things: 1. **Splits the context into a mutable region and a frozen contract region.** The compaction routine's write set is bounded to the mutable region by construction (separate message roles, separate serialization, or a hard guard in the compaction call). The contract region is append-only ..."
  },
  "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": "60b1aebb8f035bdee086f302ecc1a6cde50e0426db98931d6d358710726104c2",
    "verified_classes": [
      "ContractRegionViolation",
      "SelfCompactionGuard"
    ],
    "verified_functions": [
      "__init__",
      "_checksum",
      "compact",
      "_load_bearing_tokens",
      "verify_against_contract"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ContractRegionViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "hashlib",
      "re"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
