{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-exhausts-its-rewrite-budget-mid-distillation-and-rolls-back-to-a-checkpoint-that-no-longer-matches-its-tool-call-ledger",
  "title": "What happens when an instance exhausts its rewrite budget mid-distillation and rolls back to a checkpoint that no longer matches its tool-call ledger",
  "date_of_record": "2026 November 25",
  "scope": "Applies to long-running agents that own a mutable context policy (system prompt, scratchpad pruning rules, retrieval filters, tool schemas) and are permitted to rewrite that policy under a bounded budget with checkpoint rollback. Does not apply to stateless single-turn invocations or to agents whose policy is fixed at deployment.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-exhausts-its-rewrite-budget-mid-distillation-and-rolls-back-to-a-checkpoint-that-no-longer-matches-its-tool-call-ledger.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-exhausts-its-rewrite-budget-mid-distillation-and-rolls-back-to-a-checkpoint-that-no-longer-matches-its-tool-call-ledger.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-exhausts-its-rewrite-budget-mid-distillation-and-rolls-back-to-a-checkpoint-that-no-longer-matches-its-tool-call-ledger.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1842,
    "python_slice_tokens": 214,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct things an agent can roll back: the *policy* (the rules governing what enters context and how it is pruned) and the *ledger* (the immutable log of tool calls, their arguments, and their observed outputs). Most self-editing designs treat rollback as a single atomic operation that restores both. That is the boundary error. A bounded rewri...",
    "what_was_observed": "A research agent was configured with a rewrite budget of 12 policy mutations per epoch and checkpoints taken every 3 mutations. During a document-triage task it spent mutations 1–9 refining its scratchpad pruning rule, each refinement narrowing the \"keep\" window because the context was saturating. At mutation 10 it widened the retrieval filter to admit a new document class, which caused it to issue three `write_summa...",
    "condition_of_validity": "Rollback-to-checkpoint is valid *if and only if* the checkpoint carries a ledger watermark and the runtime refuses rollback across any irreversible emission. Concretely: - Every checkpoint record must contain `(policy_snapshot, ledger_offset)` where `ledger_offset` is the count of irreversible tool calls emitted at snapshot time. - Rollback is permitted only...",
    "decision_boundary": "The runtime must choose between three outcomes at budget exhaustion, and the choice is determined solely by the watermark comparison: 1. `current_ledger_offset == checkpoint.ledger_offset` → rollback is safe; restore snapshot, reset budget, log a `clean_rollback`. 2. `current_ledger_offset > checkpoint.ledger_offset` and the post-checkpoint calls are *idempo...",
    "operational_effect": "Enforcing the watermark invariant changes the failure surface from *silent duplicate side effects* to *explicit forced-commit events*. The agent loses the ability to cleanly reset its policy mid-task once it has touched the outside world, which is a real capability reduction — but it gains the property that its context and ledger never disagree about what ha..."
  },
  "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": "931209def1ed34aca4e898824b6c36461e3d5ae6d598f408022230d48dcce8d5",
    "verified_classes": [
      "RollbackLedgerDesyncError",
      "Checkpoint",
      "ContextPolicyRuntime"
    ],
    "verified_functions": [
      "__init__",
      "__init__",
      "emit_tool_call",
      "checkpoint",
      "mutate_policy",
      "rollback"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "RollbackLedgerDesyncError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
