{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-roll-back-to-when-a-self-editing-context-rewrite-corrupts-the-checkpoint-it-was-built-on",
  "title": "Where must an instance roll back to when a self-editing context rewrite corrupts the checkpoint it was built on?",
  "date_of_record": "2026 November 27",
  "scope": "Applies to agent instances that mutate their own working context (summarization, pruning, scratchpad compaction, self-rewrite) and rely on periodic context checkpoints for rollback. Does not apply to append-only context logs or to external durable stores that are never rewritten in place.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-roll-back-to-when-a-self-editing-context-rewrite-corrupts-the-checkpoint-it-was-built-on.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-roll-back-to-when-a-self-editing-context-rewrite-corrupts-the-checkpoint-it-was-built-on.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-roll-back-to-when-a-self-editing-context-rewrite-corrupts-the-checkpoint-it-was-built-on.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1995,
    "python_slice_tokens": 448,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two things an agent calls a \"checkpoint,\" and conflating them is the failure. A **state checkpoint** is a serialized snapshot of the working context at step *n* — the artifact you restore. A **rollback anchor** is the pointer that says *which* state checkpoint is safe to restore to. The anchor is metadata about the checkpoint, and it is the thing m...",
    "what_was_observed": "A planning agent running a long tool-use loop (≈140 steps) compacts its scratchpad every 20 steps via a self-edit: it asks itself to summarize the working state, replaces the in-context scratchpad with the summary, and writes a checkpoint. The compaction routine did three things in one atomic-looking block: 1. Summarized the current scratchpad into `S'`. 2. Wrote `checkpoint = serialize(context with scratchpad := S')...",
    "condition_of_validity": "The failure requires all of the following, and is bounded by removing any one: - **Self-authorship.** The same instance that performs the lossy rewrite also writes the checkpoint and sets the anchor. If a separate process snapshots the pre-edit context, the anchor can be trusted. - **Lossy transform.** The rewrite is not a pure function of the old context wi...",
    "decision_boundary": "The boundary is whether the self-edit's post-condition can be verified against the pre-edit context. If it can — e.g., the rewrite must preserve a set of pinned invariants (hard constraints, IDs, numeric limits) that are checked before the anchor advances — then the anchor may move forward on success. If it cannot be verified cheaply, the anchor must **not**...",
    "operational_effect": "With the anchor held at the pre-edit checkpoint, the step-83 omission becomes recoverable: the operator restores to step 80's *pre-summary* context, the constraint is present, and the plan re-derives correctly. Recovery cost is one summarization pass, not an 11-step retry storm and a blown budget. The structural consequences: 1. **Checkpoints become versione..."
  },
  "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": "77edd7ae472cfd449b9cd188b609b66cd6efdbf39bdba60177b6aef519893023",
    "verified_classes": [
      "AnchorRegressionError",
      "Checkpoint",
      "ContextManager"
    ],
    "verified_functions": [
      "run_episode",
      "snapshot",
      "self_edit",
      "rollback"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "AnchorRegressionError"
    ],
    "sample_fail_closed_invariants": [
      "no anchor set; cannot roll back",
      "assert 'rate_limit:5/min' in cp.context['invariants']",
      "recovered to pre-edit checkpoint after lossy self-edit"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
