{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-a-self-editing-context-has-entered-rewrite-divergence-during-budget-constrained-eviction",
  "title": "What structural signals indicate a self-editing context has entered rewrite divergence during budget-constrained eviction",
  "date_of_record": "2026 November 24",
  "scope": "Applies to agents that own a mutable context window and run model-driven rewrite/eviction policies (summarize, compress, drop, promote) under a hard token budget. Does not apply to append-only contexts, external vector-memory retrieval, or eviction driven purely by deterministic LRU/recency scoring with no model in the loop.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-self-editing-context-has-entered-rewrite-divergence-during-budget-constrained-eviction.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-self-editing-context-has-entered-rewrite-divergence-during-budget-constrained-eviction.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-self-editing-context-has-entered-rewrite-divergence-during-budget-constrained-eviction.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1871,
    "python_slice_tokens": 380,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure that matters is not \"the context got too big.\" It is **rewrite divergence**: the self-editing loop reaches a fixed point where each rewrite pass re-derives a summary that is *semantically plausible but no longer anchored to the original tokens*, and the eviction policy keeps selecting that drifted summary as the thing to preserve because it is no...",
    "what_was_observed": "A long-horizon coding agent with a 32k budget, a summarize-on-threshold policy at 80% fill, and a \"keep the 3 most recent tool results + running summary\" retention rule. Trace, abridged: - **Pass 0 (t=0):** window holds 14 tool outputs and 3 user turns. Provenance depth 1. Anchor count 17. - **Pass 1 (t=1, 26.1k tokens):** evictor summarizes 9 stale tool outputs into a 400-token summary `S1`. `S1` is a rewrite of 9 c...",
    "condition_of_validity": "The divergence diagnosis holds only when all of the following are true. Outside these conditions, a shrinking anchor count is benign (e.g. legitimate consolidation of redundant logs). 1. The evictor's rewrite is **model-driven and iterative** — a summary may be input to a later rewrite. If rewrites are always computed from raw spans (rewrite depth hard-cappe...",
    "decision_boundary": "The guardrail is a **provenance budget**, not a token budget. Track two counters per retained artifact: `tokens` and `anchors` (distinct raw spans it can be traced to). Enforce: - **Rewrite depth cap:** a summary may not be the input to a rewrite if its `anchors == 0`, and rewrite depth may not exceed `D_max` (empirically 2). At the cap, evict by *dropping* ...",
    "operational_effect": "Without the provenance budget, the failure is silent and *looks like model error* — the agent hallucinates a symbol, and the post-mortem blames the model rather than the eviction loop. The cost surfaces late, as sandbox rejections and re-work, after the drifted summary has already poisoned downstream reasoning. With the guardrail, the failure surfaces at rew..."
  },
  "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": "d58231f48a6c51641a52f52a185469af6e040e5b17622fd9aeec8374c5f3cf3c",
    "verified_classes": [
      "RewriteDivergenceError",
      "Artifact",
      "ProvenanceBudget"
    ],
    "verified_functions": [
      "evict_pass",
      "anchor_density",
      "admit",
      "rewrite",
      "window_anchors",
      "check_reanchor"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "RewriteDivergenceError"
    ],
    "sample_fail_closed_invariants": [
      "all eviction candidates are derivative; drop rather than rewrite"
    ],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
