{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-treat-self-editing-working-memory-as-a-transactional-commit-rather-than-an-in-place-mutation",
  "title": "Under what conditions must an instance treat self-editing working memory as a transactional commit rather than an in-place mutation",
  "date_of_record": "2026 November 30",
  "scope": "Applies to any agent that mutates its own working-memory region (scratchpad, plan ledger, distilled episodic buffer) during a reasoning trace and relies on a rollback guarantee to recover from a bad edit. Does not apply to append-only trace logs, external vector stores, or human-authored system prompts, which are not self-edited by the instance.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-self-editing-working-memory-as-a-transactional-commit-rather-than-an-in-place-mutation.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-self-editing-working-memory-as-a-transactional-commit-rather-than-an-in-place-mutation.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-self-editing-working-memory-as-a-transactional-commit-rather-than-an-in-place-mutation.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2199,
    "python_slice_tokens": 360,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the agent wrote a wrong memory.\" It is that the agent *validated the wrong snapshot*. A self-editing loop has two distinct artifacts that are routinely conflated: the **working set** (the bytes the model is currently attending to and will condition its next token on) and the **committed set** (the state the rollback mechanism can restore ...",
    "what_was_observed": "A planner agent running a 40-step task maintained a `plan_ledger` as a mutable list in its own context. On step 17, mid-execution, it executed a \"compaction\" self-edit: it rewrote the ledger to merge three completed subtasks into one summary line and renumbered the remaining steps. The rewrite was performed by emitting the new ledger text directly into the region that held the old ledger, then continuing the trace. T...",
    "condition_of_validity": "The rollback guarantee holds only under a conjunction of three conditions, and the compaction broke the second: 1. **Storage disjointness.** The staged edit must be written to a region that does not overlap any live checkpoint's byte range. If the context is a single flat buffer and edits are in-place, disjointness requires the edit to be *shorter than or eq...",
    "decision_boundary": "An instance must escalate from in-place mutation to transactional commit the moment **either** of the following becomes true, and must not attempt to reason past it: - **The edit's target range intersects any checkpoint range the instance may need to roll back to.** If the agent cannot prove disjointness *before* emitting the edit, it must stage. Proof of di...",
    "operational_effect": "The practical consequence is a hard architectural rule: **the working set and the committed set must be physically separate buffers, and the swap between them must be a single atomic pointer move that the model cannot partially execute.** In a context-window implementation this means the self-edit must be emitted to a scratch region, validated by content has..."
  },
  "matched_failure_symptoms": [
    "SQLITE_BUSY_OR_DEADLOCK",
    "OOM_KILL_OR_MEMORY_EXHAUSTION"
  ],
  "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": "07658c5f15c12ea2824288c9ca2136ebc8ad3ef8115eec0bf8ae53a812a69268",
    "verified_classes": [
      "CheckpointAliasedError",
      "CircularValidationError",
      "Checkpoint",
      "TransactionalWorkingMemory"
    ],
    "verified_functions": [
      "self_edit",
      "_digest",
      "checkpoint",
      "stage_edit",
      "validate_staged",
      "commit",
      "rollback"
    ],
    "verified_functions_count": 7,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "CheckpointAliasedError",
      "CircularValidationError"
    ],
    "sample_fail_closed_invariants": [
      "predicate closes over working set; validate staged bytes instead",
      "staged edit failed validation; committed state intact"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
