{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-a-self-editing-context-has-entered-a-rewrite-eviction-oscillation-loop",
  "title": "What structural signals indicate a self-editing context has entered a rewrite-eviction oscillation loop",
  "date_of_record": "2026 November 24",
  "scope": "Applies to agents whose context window is managed by the model itself—i.e., the LLM emits structured rewrite operations (summarize, evict, re-score salience, promote/demote) against its own working memory between turns. Does *not* apply to externally-scheduled eviction (fixed FIFO/LRU windows) or to static retrieval-augmented systems where the model cannot mutate its own context.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-self-editing-context-has-entered-a-rewrite-eviction-oscillation-loop.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-self-editing-context-has-entered-a-rewrite-eviction-oscillation-loop.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-self-editing-context-has-entered-a-rewrite-eviction-oscillation-loop.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1912,
    "python_slice_tokens": 284,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct ways a self-editing context degrades. The **first** is ordinary saturation: the window fills, eviction fires, low-salience tokens are dropped, and the agent loses some detail. This is lossy but *monotone*—the salience ranking is stable, evictions are final, and the agent converges toward a compact representation. The **second**, and th...",
    "what_was_observed": "A tool-using agent executing a 40-step research task with a 32k window and a self-managed context. Its policy: at 85% utilization, emit a `rewrite` op summarizing the three oldest segments, then a `rescore` op recomputing salience across all segments, then `evict` any segment below a 0.25 salience threshold. The failure trace, reconstructed from the op log: 1. **Turn 14.** Segment `S7` (a verbatim tool output contain...",
    "condition_of_validity": "The oscillation requires three conditions to hold simultaneously, and the guardrail only needs to break one: 1. **Salience is computed on the post-rewrite form, not the pre-rewrite form.** If the scorer saw `S7` (verbatim, high overlap) rather than `S7'` (summary, low overlap), the summary would inherit the original's salience and survive. This is the root c...",
    "decision_boundary": "The boundary is **whether the salience score of a rewrite is inherited or recomputed**. - **Recompute (the failing default):** score the summary on its own tokens. Cheap, stateless, and wrong whenever summarization removes the tokens that carried salience. - **Inherit (the correct invariant):** a rewrite op must carry forward the *maximum* salience of its so...",
    "operational_effect": "With inherited salience and hash-gated re-admission, the turn-14 through turn-34 trace collapses: `S7'` inherits `S7`'s salience (0.71), survives the rescore, and stays resident as a 40-token summary. The four rewrite/evict/retrieve cycles become one rewrite. Operation overhead drops from ~6,400 tokens to ~1,600, step count returns to baseline, and the wall-..."
  },
  "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": "4a70dd33c407f9f4b83db785286c0cda8a1d009525b7b39291ae21f75b408343",
    "verified_classes": [
      "ContextOscillationError",
      "Segment",
      "SelfEditingContext"
    ],
    "verified_functions": [
      "content_hash",
      "rewrite",
      "rescore",
      "admit",
      "evict"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ContextOscillationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
