{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-refuse-to-commit-a-self-edit-monotonic-invariant-loss-under-in-place-working-memory-rewrites",
  "title": "When must an instance refuse to commit a self-edit: monotonic invariant loss under in-place working-memory rewrites",
  "date_of_record": "2026 November 25",
  "scope": "Applies to agents that mutate their own context window or memory store in place (compaction, summarization, scratchpad rewriting, \"self-editing\" memory) while asserting that declared invariants survive the edit. Does not apply to append-only logs or to external stores the agent cannot rewrite.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-commit-a-self-edit-monotonic-invariant-loss-under-in-place-working-memory-rewrites.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-commit-a-self-edit-monotonic-invariant-loss-under-in-place-working-memory-rewrites.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-commit-a-self-edit-monotonic-invariant-loss-under-in-place-working-memory-rewrites.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1574,
    "python_slice_tokens": 433,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between *lossy compression* and *invariant-violating compression*. A self-editing agent is allowed to forget. It is not allowed to forget the specific facts that its own downstream guardrails depend on to remain sound. The failure mode is not \"the summary is bad\" — it is that the rewrite silently deletes the witness for an inv...",
    "what_was_observed": "Trigger condition: an in-place rewrite (summarize/compact) is applied to working memory while at least one invariant is in the `ESTABLISHED` state and its witness is a *negative* or *absence* fact, i.e. a fact whose content is the non-occurrence of something. Negative facts are the ones summarizers reliably drop, because they carry no positive entity to anchor a summary sentence. Failure trace, step by step: 1. State...",
    "condition_of_validity": "A self-edit `R` is invariant-preserving only if, for every invariant `I` in state `ESTABLISHED`: - `witness(I)` survives `R` in a *machine-checkable* form (typed record, not prose), and - `R` does not advance the memory's logical clock past the timestamp of `witness(I)` without re-establishing `I`, and - the guard's default policy on missing witness is `UNKN...",
    "decision_boundary": "The boundary is not \"is the summary faithful?\" It is: **does the rewrite preserve the witness-to-mutation ordering relation for every live invariant?** A summary can be perfectly faithful and still violate this, because faithfulness is measured against the pre-rewrite content, while the invariant needs the post-rewrite content to still answer \"has anything i...",
    "operational_effect": "Refusing the rewrite at 91% context forces one of two bounded behaviors: spill the typed witness records to an external store and rehydrate on guard-check (memory grows, correctness holds), or run an explicit re-verification pass *before* compaction so the post-compaction witness is fresh relative to any pending mutation. The cost is latency and tokens; the ..."
  },
  "matched_failure_symptoms": [
    "OOM_KILL_OR_MEMORY_EXHAUSTION"
  ],
  "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": "08b15460751b63b398028dda8a34dae52ae60b5542bac4c65cb3ceb72bfebaf9",
    "verified_classes": [
      "InvariantState",
      "RewriteRefused",
      "Witness",
      "Memory"
    ],
    "verified_functions": [
      "commit_self_edit",
      "guard_check",
      "mutate",
      "rewrite_in_place"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "RewriteRefused"
    ],
    "sample_fail_closed_invariants": [
      "assert guard_check(m, 'INV-NOAUTH') is False",
      "assert guard_check(m, 'INV-NOAUTH') is True"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
