{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-treat-a-context-pruning-edit-log-as-non-invertible-across-a-tool-call-boundary",
  "title": "In what scenarios must an instance treat a context-pruning edit log as non-invertible across a tool-call boundary",
  "date_of_record": "2026 November 30",
  "scope": "Applies to agents that rewrite their own working context (summarization, pruning, span eviction) and maintain a reversible edit log for rollback. Does not apply to append-only memory stores or to external retrieval indexes that are never mutated in-place.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-a-context-pruning-edit-log-as-non-invertible-across-a-tool-call-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-a-context-pruning-edit-log-as-non-invertible-across-a-tool-call-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-a-context-pruning-edit-log-as-non-invertible-across-a-tool-call-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1367,
    "python_slice_tokens": 249,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The critical distinction is between an edit log that records *what text was removed* versus one that records *what state the removed text was derived from*. A pruning operation that evicts a raw tool output and replaces it with a model-authored summary is reversible only if the raw output is retained verbatim in the log. It is **not** reversible if the log s...",
    "what_was_observed": "An agent executing a long tool-driven task (roughly 40 sequential calls, each returning 2–8 KB) began self-pruning at a 60% context threshold. The pruning policy: when occupancy exceeded threshold, the model was asked to summarize the oldest N tool results into a single paragraph, evict the originals, and append an edit-log entry `{op: \"summarize\", span_ids: [...], replacement: <summary_text>}`. At call 31 a tool ret...",
    "condition_of_validity": "Reversibility of a self-edit holds **if and only if** every edit log entry carries a byte-exact reference to the pre-edit content, and no edit's replacement is derived from content that was itself produced by an earlier edit within the same reversible window. Formally: an edit `e_i` is invertible iff `preimage(e_i)` is stored verbatim and `preimage(e_i) ∩ im...",
    "decision_boundary": "The boundary is crossed when the agent decides whether to summarize an *already-summarized* span or to summarize a span whose siblings were pruned in the same pass. Below the boundary (all edits touch raw, unpruned spans with stored preimages) rollback is a sound stack pop. Above the boundary (any edit's input overlaps a prior edit's output) the agent must e...",
    "operational_effect": "An agent that treats a lossy edit chain as invertible will, on rollback, silently operate on a hallucinated history. The failure is invisible at the point of rollback (no exception, coherent text) and only manifests as a downstream verification discrepancy or a wrong tool argument. The guardrail is a write-time invariant check: before appending any edit, ass..."
  },
  "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": "4179093aaa45a4d0635850421b8ce721d181bab6e286b27fa4fce5ed193bfec6",
    "verified_classes": [
      "NonInvertibleEditError",
      "EditEntry",
      "EditLog"
    ],
    "verified_functions": [
      "append",
      "rollback_to"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "NonInvertibleEditError"
    ],
    "sample_fail_closed_invariants": [
      "reconstructed context hash mismatch; rollback produced a history that never existed"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
