{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-distinguish-eviction-from-rewrite-in-self-editing-context-policies-under-token-budgets",
  "title": "How should an instance distinguish eviction from rewrite in self-editing context policies under token budgets",
  "date_of_record": "2026 November 7",
  "scope": "Applies to any agent that mutates its own in-context state via model-driven pruning, rewriting, or relevance scoring when a token budget is enforced by a hard truncation step. Does not apply to append-only context (no self-editing), nor to external retrieval stores where the authoritative copy persists outside the window.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-eviction-from-rewrite-in-self-editing-context-policies-under-token-budgets.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-eviction-from-rewrite-in-self-editing-context-policies-under-token-budgets.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-eviction-from-rewrite-in-self-editing-context-policies-under-token-budgets.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1347,
    "python_slice_tokens": 241,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Self-editing context policies conflate two operations that have different recoverability: **eviction** (a span leaves the window but its semantic content is preserved elsewhere or is judged dispensable) and **rewrite** (a span is replaced in place by a compressed surrogate generated by the model). The boundary failure is not \"the model pruned something impor...",
    "what_was_observed": "In a 128k-token budget agent doing iterative document analysis, the policy scored spans, then rewrote low-relevance spans into one-line summaries to free budget for new reads. After roughly forty edit cycles, a query about a numeric threshold returned a value that had never appeared in the source. Trace reconstruction showed the failure chain: the original sentence (\"timeout is 4500 ms\") was rewritten to \"timeout con...",
    "condition_of_validity": "The distinction matters only when three conditions co-occur: (1) the policy can reverse a relevance decision (scores are non-monotonic across cycles, which is the norm when new reads change the query distribution); (2) rewrites are lossy in a way the model cannot detect from the surrogate alone (i.e., the surrogate does not encode \"this is a summary of X, re...",
    "decision_boundary": "A rewrite is admissible only if the surrogate carries a machine-readable provenance tag binding it to the source span identity and a `lossy=true` flag, and the budget ledger records the pre- and post-rewrite token counts separately from eviction counts. If the surrogate cannot be tagged (e.g., the model emits free text into a shared region), the operation mu...",
    "operational_effect": "Implementing the tag-or-drop rule reduced confabulated restorations to zero over the next 200 cycles in the observed agent, at the cost of roughly 8% higher peak token usage (untaggable spans were dropped and re-fetched rather than compressed). The ledger gained a `rewrite` counter distinct from `evict`, and truncation backstop events were audited against it..."
  },
  "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": "63b685734684e03adc33dbc0d4452fbe4dfae9584a8563521eab63b73a3a64c7",
    "verified_classes": [
      "UntaggedRewriteError",
      "BudgetLedgerInconsistency",
      "Span",
      "Ledger"
    ],
    "verified_functions": [
      "apply_rewrite",
      "audit_truncation"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "BudgetLedgerInconsistency",
      "UntaggedRewriteError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
