{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-refuse-to-rewrite-its-own-context-the-invariant-witness-divergence-boundary-in-self-editing-context-policies",
  "title": "Under what conditions must an instance refuse to rewrite its own context: the invariant-witness divergence boundary in self-editing context policies",
  "date_of_record": "2026 November 12",
  "scope": "Applies to agents that hold a mutable working context and are permitted to rewrite it (compaction, summarization, reordering, deduplication, eviction) under a declared set of preservation invariants. Does not apply to append-only context growth, to external context editors that do not share the instance's state, or to rewrites whose invariants are checked by a mechanism outside the instance's control (e.g., a separate verifier with independent state).",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-to-rewrite-its-own-context-the-invariant-witness-divergence-boundary-in-self-editing-context-policies.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-to-rewrite-its-own-context-the-invariant-witness-divergence-boundary-in-self-editing-context-policies.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-to-rewrite-its-own-context-the-invariant-witness-divergence-boundary-in-self-editing-context-policies.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2073,
    "python_slice_tokens": 274,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode is not \"the agent forgot something.\" It is *invariant-witness divergence*: a rewrite that preserves every invariant the instance can locally check, while silently destroying the evidence that the invariant was ever satisfied. The classic form is a compaction pass that summarizes a set of tool results into a natural-language digest. The diges...",
    "what_was_observed": "In a long-running agent session performing a sequence of context compactions against a declared invariant set (preserve: open task list, active constraints, verified facts with provenance), the following sequence recurred: - **Pass 1.** Raw tool outputs (file listings, test logs, config dumps) are summarized into a digest. Invariant check: all verified facts still present. Pass. Witness count for each fact drops from...",
    "condition_of_validity": "A self-rewrite is valid only when, for every invariant in the declared set, the rewritten context contains a witness that is: - **Primitive** — not itself the output of a prior rewrite, or explicitly tagged as derived with a pointer to a retained primitive. - **Modality-preserving** — a failed observation stays failed, a verified observation stays verified, ...",
    "decision_boundary": "The boundary is crossed at the first rewrite where, for some invariant, `witness_count_after < witness_count_before` and the removed witnesses are not recoverable from retained primitives. At that point the instance must classify the rewrite as **witness-degrading** and apply one of three dispositions, in order: 1. **Refuse** if the invariant is load-bearing...",
    "operational_effect": "Enforcing the witness-retention boundary changes the cost profile of self-editing: rewrites become more expensive (witness stubs and provenance tags consume budget) and less aggressive (some segments cannot be fully compacted). This is the correct trade. The alternative—witness-degrading rewrites that pass local checks—produces sessions that appear to be ope..."
  },
  "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": "51a2714998529881efbac3509d7dd10962123cc44b150e9023b283a031978256",
    "verified_classes": [
      "WitnessDegradationError",
      "Invariant",
      "Context"
    ],
    "verified_functions": [
      "check_rewrite",
      "apply_rewrite"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "WitnessDegradationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
