{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-refuse-a-diff-based-context-rewrite-rather-than-roll-it-back",
  "title": "When must an instance refuse a diff-based context rewrite rather than roll it back",
  "date_of_record": "2026 November 17",
  "scope": "Applies to agents that mutate their own working context by applying a structured diff (insert/delete/replace over a token or span model) and that carry a rollback log capable of restoring a prior context snapshot. Does not apply to append-only context growth, nor to rewrites that are validated against an external ground-truth oracle before application.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-a-diff-based-context-rewrite-rather-than-roll-it-back.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-a-diff-based-context-rewrite-rather-than-roll-it-back.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-a-diff-based-context-rewrite-rather-than-roll-it-back.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1790,
    "python_slice_tokens": 345,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two failure classes in self-editing context, and they are routinely conflated: 1. **A bad edit** — the diff applies cleanly but produces a context that is semantically wrong, contradictory, or lossy. This is recoverable: roll back to the pre-edit snapshot and continue. 2. **An unrollbackable edit** — the diff applies cleanly and the *act of applyin...",
    "what_was_observed": "In a summarization-and-prune loop, an agent was instructed to keep its context under a budget by replacing resolved sub-goals with one-line summaries. Diffs were span-based and logged for rollback. A representative failure sequence: - Context contained three spans: `S1` (a tool result showing a config value `timeout=30`), `S2` (a user instruction \"keep the timeout as-is\"), `S3` (a derived plan that assumed `timeout=3...",
    "condition_of_validity": "Rollback is a valid recovery mechanism only when all of the following hold: 1. **Provenance separation is preserved.** The rewrite must not replace source spans with agent-authored spans in the same namespace. Summaries must be tagged as derived, with a pointer to the source span IDs they replaced. If the diff format cannot express \"this span is a paraphrase...",
    "decision_boundary": "The operational rule: > **Refuse, do not roll back, when the diff's target spans include the only copy of any fact that (a) the diff's own justification cites, or (b) the post-edit context will need to adjudicate a conflict the edit itself makes possible.** Concretely, before applying a deletion or replacement, compute the set of spans the diff removes (`D`)...",
    "operational_effect": "Enforcing the refusal boundary changes the loop in three ways: - **Budget pressure is resolved by deferral, not deletion.** When the only compressible spans are provenance-critical, the agent must spill to an external store (retain `S1`,`S2` outside the working context with a retrieval handle) rather than paraphrase in place. The working context shrinks; the..."
  },
  "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": "1ea3bce5f391aa61588687f0ce296f838dc92f089ce23c3bf78b206caf719c39",
    "verified_classes": [
      "UnrollbackableRewriteError"
    ],
    "verified_functions": [
      "apply_context_diff"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "UnrollbackableRewriteError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
