{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-self-editing-context-policies-from-evicting-the-load-bearing-observation-during-a-budgeted-rewrite",
  "title": "Which invariants prevent self-editing context policies from evicting the load-bearing observation during a budgeted rewrite",
  "date_of_record": "2026 November 30",
  "scope": "Applies to any agent that mutates its own context window under a hard token budget via rewrite/summarize/evict heuristics before a task completes. Does not apply to append-only contexts, or to external memory stores where the original tokens remain retrievable after eviction.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-editing-context-policies-from-evicting-the-load-bearing-observation-during-a-budgeted-rewrite.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-editing-context-policies-from-evicting-the-load-bearing-observation-during-a-budgeted-rewrite.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-editing-context-policies-from-evicting-the-load-bearing-observation-during-a-budgeted-rewrite.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1827,
    "python_slice_tokens": 446,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A self-editing context policy is not a lossy compressor. It is a *state transition on the agent's only working memory*, executed by the same probabilistic model that will later depend on the evicted content. The distinction that matters operationally is between **redundant tokens** (re-derivable from other retained tokens, tool re-calls, or the task spec) an...",
    "what_was_observed": "A coding agent operating under a 32k rewrite budget ran the following loop: at 85% saturation, it invoked a summarize-and-evict pass that (a) kept the system prompt and last 6 turns verbatim, (b) replaced the middle span with a model-generated abstract, and (c) dropped any turn whose salience score fell below a threshold. The salience scorer was a small model prompted with \"rate how relevant each turn is to the curre...",
    "condition_of_validity": "The invariant that must hold for a budgeted rewrite to be safe: > **Eviction is admissible only if the evicted span is either (a) re-derivable without a side-effecting or non-deterministic action, or (b) explicitly tagged by the tool layer as load-bearing and pinned outside the eviction set.** Formally, for every token span `S` removed at rewrite `r`, there ...",
    "decision_boundary": "The boundary between admissible and inadmissible rewrite is drawn by **provenance metadata attached at tool-call time, not by the summarizer at eviction time.** Concretely: - Tool results are classified at ingress as `RECONSTRUCTIBLE` (idempotent read of an immutable resource), `SIDE_EFFECTING` (any mutation, any non-idempotent call), or `EPHEMERAL` (time-se...",
    "operational_effect": "With ingress-time provenance tagging and pinned non-reconstructible spans, the observed failure mode disappears: turn 3's migration content is tagged `SIDE_EFFECTING` (the file is mutable and the read's constraint is consequential), pinned, and survives all rewrite passes. The cost is a smaller effective working budget — pinned spans don't compress — which f..."
  },
  "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": "a5d06441a93b5a9cbb6f12ff2307c9a3bdee6980a9d194247a148cf5274ca121",
    "verified_classes": [
      "EvictionInvariantViolation",
      "Provenance",
      "Span",
      "ContextPolicy"
    ],
    "verified_functions": [
      "demo",
      "ingest",
      "rewrite"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "EvictionInvariantViolation"
    ],
    "sample_fail_closed_invariants": [
      "assert 'migration_0042' not in evicted"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
