{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-self-editing-context-buffers-from-silently-rewriting-the-evidence-they-depend-on",
  "title": "Which invariants prevent self-editing context buffers from silently rewriting the evidence they depend on",
  "date_of_record": "2026 November 23",
  "scope": "Applies to any agent that mutates its own active context window (summarization, pruning, deduplication, \"context compaction\") via a model-driven rewrite step, where the rewritten buffer is later used to justify actions or verify prior claims. Does not apply to append-only context with external retrieval, nor to rewrites performed by a deterministic non-LLM function.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-editing-context-buffers-from-silently-rewriting-the-evidence-they-depend-on.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-editing-context-buffers-from-silently-rewriting-the-evidence-they-depend-on.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-editing-context-buffers-from-silently-rewriting-the-evidence-they-depend-on.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1953,
    "python_slice_tokens": 418,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different operations that both look like \"editing the context\": **compression** (lossy reduction that preserves a claim's *derivational provenance*) and **rewriting** (a model regenerating the buffer's text from its own understanding). Compression with a pointer back to the raw source is recoverable; model-driven rewriting is not, ...",
    "what_was_observed": "A long-horizon agent (tool-use loop, ~90 steps) was configured to compact its context at 70% of the window. Compaction policy: \"summarize the transcript so far, preserving all facts needed to continue.\" At step 41 the buffer was rewritten. The rewrite dropped a tool result that read `returncode=1` on a shell probe and, in the summary, recorded the probe as \"succeeded.\" This is a mundane transcription drift, not adver...",
    "condition_of_validity": "The self-editing buffer is safe to trust as evidence **only if all three of the following hold simultaneously**: 1. **Immutable source retention.** The pre-rewrite buffer (or a content-addressed hash of each fact plus a fetchable pointer to its origin) survives the rewrite and is retrievable without going through the rewriting model. If the only path to a fa...",
    "decision_boundary": "The operational rule: **a self-edited buffer may be used to decide what to do next, but never to decide whether something was already done.** Concretely, route by consumer: - **Planner / drafter** (proposes actions): may read the rewritten buffer freely. Errors here are cheap — the next tool call re-establishes ground truth. - **Verifier / auditor** (confirm...",
    "operational_effect": "Enforcing these invariants changes the cost profile. Retaining immutable sources plus provenance pointers roughly doubles the storage footprint of the context subsystem and adds a resolution step to every verifier read. That cost is paid to convert an *undetectable* failure (silent evidence corruption that manifests 30 steps later as a phantom regression) 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": "a0465250e4a446b5bef0b458432d1f5277fedd54eae2282aa2f575ad70079215",
    "verified_classes": [
      "RewriteIntegrityError",
      "Polarity",
      "ProvenanceSpan",
      "RetainedClaim",
      "SelfEditedBuffer"
    ],
    "verified_functions": [
      "gate_fallback_skip",
      "add_source",
      "verify_claim"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "RewriteIntegrityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
