{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-rewrites-its-own-context-and-the-edit-provenance-is-not-preserved-across-a-checkpoint",
  "title": "What happens when an instance rewrites its own context and the edit provenance is not preserved across a checkpoint",
  "date_of_record": "2026 November 26",
  "scope": "Applies to agents that perform model-driven context rewriting (summarization, pruning, reordering, or replacement of their own working context) and that persist state via checkpoint/resume. Does not apply to append-only context logs where no in-place rewriting occurs, nor to stateless single-shot inference.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-context-and-the-edit-provenance-is-not-preserved-across-a-checkpoint.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-context-and-the-edit-provenance-is-not-preserved-across-a-checkpoint.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-context-and-the-edit-provenance-is-not-preserved-across-a-checkpoint.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2382,
    "python_slice_tokens": 444,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two categorically different operations an agent can perform on its own context window: **consumption** (reading tokens, appending tool outputs, growing the buffer) and **mutation** (rewriting, summarizing, dropping, or reordering tokens already present). Consumption is monotonic and idempotent-safe; a checkpoint captures it by serializing the buffe...",
    "what_was_observed": "An agent running a long-horizon task (multi-hour, ~40 tool calls) was configured with a self-editing context policy: when the buffer exceeded 70% of the window, the model was prompted to emit a \"context rewrite\" — a compressed representation of the oldest 50% of the buffer, replacing it in place. A checkpoint was written every 10 tool calls by serializing the raw buffer. Trace of the failure: 1. **Turn 18.** Buffer a...",
    "condition_of_validity": "The failure requires the conjunction of four conditions. Remove any one and the invariant holds: 1. **Model-driven mutation** — the rewrite is generated by the model, not by a deterministic algorithm (e.g., a fixed truncation or a hash-deduplication pass). Deterministic mutations can be replayed; model mutations cannot. 2. **In-place replacement** — the rewr...",
    "decision_boundary": "The operational question is not \"should agents self-edit context\"—they must, because context is finite. The question is **what must be persisted at the mutation boundary so that resume is safe.** The decision boundary is drawn at the point of mutation, not at the point of checkpoint. Concretely: - **Below the boundary (safe):** rewriting is permitted only if...",
    "operational_effect": "When the invariant is enforced, three observable behaviors change: 1. **Resume cost rises slightly, safety rises sharply.** The checkpoint is larger (buffer + ledger) and resume performs a provenance reconstruction pass before the first action. In the traced system this added ~40ms and ~8% checkpoint size, and eliminated the class of violation entirely acros..."
  },
  "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": "733aff3bbdef19a537b156f1fdc8ad187b4bc927b67658012290fed14d0f2396",
    "verified_classes": [
      "ProvenanceIncompleteError",
      "Span"
    ],
    "verified_functions": [
      "apply_rewrite",
      "resume_from_checkpoint",
      "__init__"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ProvenanceIncompleteError"
    ],
    "sample_fail_closed_invariants": [
      "rewrite would drop a hard-constraint predicate; refusing in-place mutation"
    ],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
