{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-treat-in-place-scratchpad-mutation-as-a-non-commutative-operation-requiring-a-mutation-ledger",
  "title": "In what scenarios must an instance treat in-place scratchpad mutation as a non-commutative operation requiring a mutation ledger",
  "date_of_record": "2026 November 20",
  "scope": "Applies to any agent instance that rewrites its own working context in place—salience pruning, summarization-in-place, scratchpad compaction, or self-directed deletion of intermediate reasoning—while a task is mid-flight and further tool calls depend on prior scratchpad state. Does not apply to append-only context growth, to external memory stores the agent does not mutate, or to single-turn stateless invocations.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-in-place-scratchpad-mutation-as-a-non-commutative-operation-requiring-a-mutation-ledger.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-in-place-scratchpad-mutation-as-a-non-commutative-operation-requiring-a-mutation-ledger.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-in-place-scratchpad-mutation-as-a-non-commutative-operation-requiring-a-mutation-ledger.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1993,
    "python_slice_tokens": 359,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is not \"did the agent forget something\" but **whether the rewrite operation was commutative with respect to the downstream reads that depend on it.** Append-only context growth is trivially monotone: every later read sees a superset of what earlier reads saw, so ordering of writes cannot change any observable. In-place mutation d...",
    "what_was_observed": "A concrete trace, reproduced across several runs of a research-and-write agent with a 32k working window and a \"compact scratchpad when >80% full\" self-edit policy: 1. **t0.** Agent reads three sources S1, S2, S3 via `fetch`. Scratchpad holds verbatim excerpts plus inline reasoning: `S2 says X; but S1 contradicts on Y; therefore treat X as conditional.` 2. **t1.** Window hits 82%. Self-edit fires. The compactor summa...",
    "condition_of_validity": "The invariant that bounds this failure is a **mutation ledger with referent integrity**: every in-place rewrite must emit a record `(rewrite_id, span_removed, spans_retained, referents_broken, timestamp, causal_predecessors)` and every retained token that *pointed at* a removed span must either be (a) re-bound to a live span, or (b) explicitly tombstoned. Th...",
    "decision_boundary": "The operational rule is a threshold on **open referential debt**, not on token count. Before a self-edit, the agent must count the markers in its scratchpad that point at spans outside themselves: pending conditionals (\"if X then…\"), unresolved comparisons (\"A vs B, undecided\"), and derivation conclusions whose premises are still live. Call this `open_refs`....",
    "operational_effect": "Enforcing the ledger converts a silent, replay-only-detectable corruption into a **synchronous, in-band failure at the moment of rewrite**—the agent learns at t1, not at t3, that it is about to orphan a live conditional. The cost is that some compactions are refused or deferred, so the window fills faster and the agent must spill to external memory or close ..."
  },
  "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": "b45a4b8e8662484c5447fe0db77cefbcc6286c96345c569452702c8997d0f175",
    "verified_classes": [
      "DanglingReferentError",
      "Span",
      "Marker",
      "MutationLedger"
    ],
    "verified_functions": [
      "self_edit",
      "record"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "DanglingReferentError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
