{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-silent-semantic-collapse-in-self-editing-context-windows",
  "title": "Which invariants prevent silent semantic collapse in self-editing context windows",
  "date_of_record": "2026 November 12",
  "scope": "Applies to agent loops where the model itself decides which tokens to prune, summarize, or rewrite inside a bounded context window, and where the rewritten window is then re-ingested as authoritative state. Does not apply to append-only logs, external retrieval systems that never mutate the window, or human-curated checkpointing.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-semantic-collapse-in-self-editing-context-windows.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-semantic-collapse-in-self-editing-context-windows.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-semantic-collapse-in-self-editing-context-windows.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1404,
    "python_slice_tokens": 216,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the context window got too small.\" The failure is that a model-driven rewrite can *preserve token count and topicality while destroying the provenance of specific claims*. A pruned window can still read fluently, still answer most questions, and still pass naive coherence checks — while having silently dropped the constraint that made a p...",
    "what_was_observed": "In a long-running planning agent that rewrote its own scratchpad every N turns, we observed the following sequence repeatedly: 1. Turn 40: the agent records \"database choice: Postgres 14, chosen because the migration tooling requires advisory locks; MySQL rejected.\" 2. Turn 55: pruning policy summarizes the region to \"Database: Postgres is used for the project.\" 3. Turn 90: the agent proposes a schema feature that de...",
    "condition_of_validity": "The invariant holds only under these conditions, and fails silently outside them: - **Identity of commitments.** Each commitment must have a stable identifier (a key, a hash, or an explicit slot) that survives rewrite. Prose summaries have no identity; they cannot be diffed, so loss is undetectable. - **Rationale is load-bearing, not decorative.** Any decisi...",
    "decision_boundary": "The boundary is not \"how much can we prune.\" It is **whether the rewrite is auditable against the pre-rewrite state.** - If you can diff commitments by identity (added / removed / altered), rewrite is safe and can be aggressive. - If you can only compare prose to prose, rewrite must be conservative and *append-only for commitments*: summarize freely, but nev...",
    "operational_effect": "Enforcing these invariants changes the failure mode from *silent* to *loud*. Instead of a fluent-but-wrong window discovered three turns later, the rewrite step raises immediately when it would drop a commitment lacking an external record. The cost is that aggressive pruning becomes harder — some windows must spill to external storage rather than compress in..."
  },
  "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": "0cc4182494d67c633533291991e56bb79ad7e762fc403f85bdb7dbcd1ed9a351",
    "verified_classes": [
      "CommitmentLossError"
    ],
    "verified_functions": [
      "apply_rewrite"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "CommitmentLossError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
