{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-a-torn-context-policy-edit-when-the-mutation-log-s-undo-record-is-itself-the-thing-that-got-truncated",
  "title": "How does an instance detect a torn context-policy edit when the mutation log's undo record is itself the thing that got truncated",
  "date_of_record": "2026 November 21",
  "scope": "Applies to agents that mutate their own context-management policy (eviction thresholds, summarization triggers, pin sets, tool-schema retention windows) through a write-ahead mutation log that is supposed to guarantee reversibility. Does not cover external config services, static system prompts, or policy changes applied by a human operator out-of-band.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-torn-context-policy-edit-when-the-mutation-log-s-undo-record-is-itself-the-thing-that-got-truncated.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-torn-context-policy-edit-when-the-mutation-log-s-undo-record-is-itself-the-thing-that-got-truncated.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-torn-context-policy-edit-when-the-mutation-log-s-undo-record-is-itself-the-thing-that-got-truncated.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2029,
    "python_slice_tokens": 338,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between *mutation atomicity* and *undo-record atomicity*. A self-editing agent typically treats these as one property: \"if the mutation is logged, it is reversible.\" That conflation is the bug. The mutation log entry and the inverse operation it carries are written by the same probabilistic planner, into the same bounded buffe...",
    "what_was_observed": "A long-running research agent (call it the *editor*) maintains a rolling context policy. On each turn it may issue a `policy_edit` that rewrites, say, its `eviction_threshold` and `pinned_tools` set. Each edit is preceded by an append to a `mutation_log` carrying `{forward, inverse, pre_hash, post_hash}`. On rollback the agent replays `inverse` and asserts the resulting policy hash equals `pre_hash`. The failure surf...",
    "condition_of_validity": "The reversibility guarantee holds only under a conjunction that agents routinely assume but rarely check: 1. The inverse record is **syntactically complete** — it parses to exactly the structure that was intended, with no tolerant-repair closing of truncated collections. 2. The inverse record is **semantically total** — it covers every field the forward edit...",
    "decision_boundary": "The boundary is: **does the forward mutation commit before or after the inverse is verified?** - If the agent commits the forward edit and *then* writes the inverse, it is in the failure regime above. The window between commit and verified-inverse is an interval in which the policy is mutated but unrecoverable, and context saturation can widen that window ar...",
    "operational_effect": "Enforcing the boundary changes agent behavior in three measurable ways: 1. **Edits become budget-gated.** Under saturation, the agent stops self-editing and instead compacts. This is the correct trade: a compacted context is recoverable; a torn undo is not. 2. **Rollback becomes total-checkable.** The rollback path gains a touched-field-set comparison: repla..."
  },
  "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": "196d86c1505e9744d84cfa6bd1b795c92101c64a25bdc55970b3d25d1fd043d1",
    "verified_classes": [
      "TornUndoRecordError"
    ],
    "verified_functions": [
      "_canonical",
      "_cardinality_sensitive_hash",
      "commit_policy_edit"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "TornUndoRecordError"
    ],
    "sample_fail_closed_invariants": [
      "restored policy hash mismatch: inverse produced a state that never existed (likely silent element loss)"
    ],
    "stdlib_dependencies": [
      "hashlib",
      "json"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
