{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-self-rewriting-context-windows-from-silently-deleting-the-premises-of-an-in-flight-reasoning-chain",
  "title": "Which invariants prevent self-rewriting context windows from silently deleting the premises of an in-flight reasoning chain",
  "date_of_record": "2026 November 29",
  "scope": "Applies to agents that own a mutable working context and invoke a model-driven rewrite/prune step (summarize, evict, compress, re-rank) mid-task. Excludes append-only context managers and stateless single-shot calls where the context is never mutated by the model itself.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-rewriting-context-windows-from-silently-deleting-the-premises-of-an-in-flight-reasoning-chain.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-rewriting-context-windows-from-silently-deleting-the-premises-of-an-in-flight-reasoning-chain.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-rewriting-context-windows-from-silently-deleting-the-premises-of-an-in-flight-reasoning-chain.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2049,
    "python_slice_tokens": 338,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two ways a context window shrinks: **eviction** (drop tokens the policy judges low-value) and **rewriting** (replace a token span with a model-authored surrogate that is supposed to preserve meaning). Eviction is bounded by a simple invariant — the dropped span must be provably unreferenced by any live goal, obligation, or pending tool call. Rewrit...",
    "what_was_observed": "A planning agent was executing a 14-step task with a 32k window and a rewrite policy triggered at 70% occupancy. At step 9 the policy fired and replaced steps 1–6 (the initial requirement-gathering transcript) with a 240-token abstract. The abstract preserved the *goals* but dropped a single constraint: \"the output must not include customer PII columns.\" Steps 10–13 continued normally — the agent retrieved schemas, d...",
    "condition_of_validity": "A self-rewrite is safe **iff** for every symbolic handle `h` live in the agent's scratchpad, obligation set, or pending tool-call arguments, the post-rewrite context contains a span that the agent can resolve `h` against with the same truth value as before the rewrite. Formally: the rewrite must be a **handle-preserving map** over the set of committed refere...",
    "decision_boundary": "The boundary between \"rewrite is safe\" and \"rewrite is a premise-deletion event\" is not occupancy. It is the ratio of **live handles to resolvable bindings** in the candidate context. Operationally: - If every live handle resolves in the candidate → rewrite is admissible; occupancy pressure is a valid trigger. - If any live handle fails to resolve → the rewr...",
    "operational_effect": "The guardrail is a pre-rewrite reference-closure gate plus a post-rewrite resolution audit, and the two must be independent. The gate prevents inadmissible rewrites; the audit catches the ones the gate's liveness computation missed (latent handles, drift). The audit is cheap: for each live handle, attempt resolution in the new context and compare the resolve..."
  },
  "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": "1bec7e8143da847ceaf9289fcc9c284f97a516d726babcb5f918ed2adff3a353",
    "verified_classes": [
      "PremiseDeletionError",
      "CommitmentGraph"
    ],
    "verified_functions": [
      "reference_closure_gate",
      "rewrite_context",
      "commit",
      "retire"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "PremiseDeletionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
