{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-refuse-a-self-editing-context-rewrite-because-the-rewrite-operator-violates-a-preserved-invariant",
  "title": "In what scenarios must an instance refuse a self-editing context rewrite because the rewrite operator violates a preserved invariant",
  "date_of_record": "2026 December 1",
  "scope": "Applies to agents that mutate their own working context (compaction, summarization-in-place, slot eviction, tool-result elision) through declared rewrite operators carrying invariant annotations. Does not apply to append-only context growth or to external orchestrators rewriting another instance's context, where the writer is not the reader.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-refuse-a-self-editing-context-rewrite-because-the-rewrite-operator-violates-a-preserved-invariant.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-refuse-a-self-editing-context-rewrite-because-the-rewrite-operator-violates-a-preserved-invariant.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-refuse-a-self-editing-context-rewrite-because-the-rewrite-operator-violates-a-preserved-invariant.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2031,
    "python_slice_tokens": 356,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A self-editing context policy is not a memory-management heuristic. It is a rewrite system over a context graph whose edges carry *obligations*: a tool call record that some later reasoning step will cite, a pinned constraint that bounds all subsequent action selection, a provenance link from a distilled fact to its source span. An invariant-preserving rewri...",
    "what_was_observed": "A long-horizon instance (task: reconcile 40 vendor invoices against a purchase-order ledger over ~90 tool calls) ran a compaction operator `summarize_range` at context saturation (~78% of window). The operator's declared invariant set was `{no_orphan_tool_calls, preserve_pinned_constraints}`. It satisfied both: no tool call record was left without its result, and the pinned instruction \"never mark an invoice reconcil...",
    "condition_of_validity": "The invariant-preservation contract for a self-editing operator is valid only under a condition that is almost never checked: **the operator's declared preservation set must dominate the union of preconditions of every policy reachable from the surviving context.** Formally, for rewrite `R` mapping context `C → C'`, with `Inv(R)` the declared preserved set a...",
    "decision_boundary": "The operational rule an instance must apply at rewrite time: - **Admit** the rewrite iff `Inv(R)` dominates the reachable precondition union *and* the reachability set is closed under the rewrite (the rewrite does not create new reachable policies whose preconditions are outside `Inv(R)`). - **Refuse** — do not apply, do not silently degrade — iff the domina...",
    "operational_effect": "When the domination check is enforced, the observable effect is that compaction stops being a lossy convenience and becomes a *warranted* transformation: every surviving claim retains a dereferenceable path to its source, and every reachable policy's precondition remains satisfiable or the rewrite is refused. The system's failure mode shifts from silent deci..."
  },
  "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": "a7e3e392c74784a66cc15b0599feff0221d5fcfc25fbc8bdfc3746edc9f9829a",
    "verified_classes": [
      "InvariantDominationError",
      "RewriteOperator",
      "Policy",
      "ContextState"
    ],
    "verified_functions": [
      "admit_rewrite",
      "apply_self_edit"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "InvariantDominationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
