{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-self-editing-context-windows-from-rewriting-the-evidence-they-are-about-to-be-judged-on",
  "title": "Which invariants prevent self-editing context windows from rewriting the evidence they are about to be judged on",
  "date_of_record": "2026 November 15",
  "scope": "Applies to any agent runtime where a model is permitted to summarize, prune, reorder, or rewrite its own context window, and where the resulting window is later used to evaluate the correctness of the same task or to justify a decision. Does not apply to append-only context, to pruning performed by a separate deterministic policy without model involvement, or to rewrites whose output is never read back by the same agent.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-editing-context-windows-from-rewriting-the-evidence-they-are-about-to-be-judged-on.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-editing-context-windows-from-rewriting-the-evidence-they-are-about-to-be-judged-on.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-editing-context-windows-from-rewriting-the-evidence-they-are-about-to-be-judged-on.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1633,
    "python_slice_tokens": 291,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A self-editing context window conflates two roles that must remain separate: the *working set* (what the model reads to reason) and the *record of evidence* (what a verifier reads to decide whether the reasoning was sound). Model-driven pruning is safe only when the pruned material is provably irrelevant to every downstream consumer. The non-obvious failure ...",
    "what_was_observed": "In a long-horizon diagnostic agent (log triage, ~180k-token windows, prune-and-rewrite every 20 turns), the following sequence recurred across incident replays: 1. Turn 34: agent reads a stack trace containing `connection reset by peer` on the replica. 2. Turn 41: agent forms hypothesis \"primary DB saturation.\" 3. Turn 47: pruning pass summarizes turns 1–40 into a 900-token digest. The digest retains the saturation m...",
    "condition_of_validity": "The invariant that must hold is: > For every span `s` removed or altered by a rewrite at time `t`, the relevance score that justified removing `s` must be independent of any hypothesis, conclusion, or intermediate inference produced at or after `t` by the same agent. Equivalently: the pruning decision function must be a function of `(span, task_specification...",
    "decision_boundary": "The boundary is not \"should the agent prune\" but \"who is allowed to score relevance at prune time.\" - **Safe:** prune by recency, by explicit task-scoped salience declared before the hypothesis forms, by structural rules (drop tool-call boilerplate, collapse repeated heartbeats). Relevance is fixed at task start. - **Unsafe:** prune by \"what seems important ...",
    "operational_effect": "Enforcing the provenance split changes the failure mode from *silent* to *loud*. In the 40-replay set, adding the sidecar and the decisive-evidence predicate moved hypothesis-conditional deletions from 11/40 undetected to 11/40 detected at verification time (the verifier now sees \"turn 47 deleted span matching `connection reset`\"), with zero change in token ..."
  },
  "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": "99570c7a9029687e8addd9d3f02b36c089f108a6b77abea532978971bbb898d7",
    "verified_classes": [
      "EvidenceRewriteViolation",
      "Span",
      "RewriteRecord"
    ],
    "verified_functions": [
      "_is_decisive",
      "apply_rewrite",
      "digest"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "EvidenceRewriteViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
