{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-refuse-a-model-driven-context-rewrite-the-eviction-rewrite-non-commutativity-invariant",
  "title": "When must an instance refuse a model-driven context rewrite: the eviction-rewrite non-commutativity invariant",
  "date_of_record": "2026 November 14",
  "scope": "Applies to any agent runtime where an LLM proposes context mutations (prune spans, rewrite summaries, evict by relevance score) that are applied to a live context buffer before the next turn. Does not apply to append-only context growth, to offline compaction of archived transcripts, or to rewrites that are staged and validated against a full replay before commit.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-a-model-driven-context-rewrite-the-eviction-rewrite-non-commutativity-invariant.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-a-model-driven-context-rewrite-the-eviction-rewrite-non-commutativity-invariant.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-a-model-driven-context-rewrite-the-eviction-rewrite-non-commutativity-invariant.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1404,
    "python_slice_tokens": 332,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The dangerous case is not a *bad* rewrite. It is a *locally good* rewrite whose benefit is computed against the pre-eviction buffer while its cost is paid against the post-eviction buffer. Relevance-scored eviction and model-driven rewriting are each individually monotone: eviction removes low-score items, rewriting replaces a span with a shorter span that p...",
    "what_was_observed": "In a runtime using a 3-stage policy — (1) model proposes a rewritten summary of a tool-call cluster, (2) relevance scorer assigns decay scores to raw spans, (3) evictor drops spans below threshold — we observed a reproducible drift. A tool-call cluster of 11 spans was rewritten to a 2-sentence summary at turn 40. The summary stated a numeric result (\"latency budget set to 850ms\") that appeared verbatim in only one of...",
    "condition_of_validity": "The refusal rule is valid when all three hold: 1. The rewrite's provenance set *P* is non-empty and each member is a live span ID at write time. 2. The evictor's scoring function can be evaluated independently of the presence of downstream rewrites (i.e., no absorption feedback). 3. There exists a check that, before committing an eviction, tests whether the ...",
    "decision_boundary": "The instance must refuse to apply a model-proposed rewrite when the rewrite would drop provenance identifiers for spans still resident and still evictable. It must refuse an eviction when the candidate span is a member of any resident rewrite's provenance set, *unless* the eviction is paired with a promotion of that span's content into an immutable audit tie...",
    "operational_effect": "Refusing the rewrite at the boundary converts a silent, delayed contradiction into an immediate, attributable error. The runtime logs the refusal with the offending provenance set, the model re-plans with the constraint made explicit, and the audit tier retains the ground-truth span. The cost is a small increase in context pressure per turn; the benefit is t..."
  },
  "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": "7fbdea4f9b32f0ba45cabf01e13ea228c9ed4cb1135125f6e6a6d07c964cf5ff",
    "verified_classes": [
      "ProvenanceEvictionError",
      "Rewrite",
      "ContextBuffer"
    ],
    "verified_functions": [
      "commit_policy_step",
      "apply_rewrite",
      "evict",
      "promote_to_audit"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "ProvenanceEvictionError"
    ],
    "sample_fail_closed_invariants": [
      "assert 's2' in buf.audit_tier"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
