{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-refuse-to-rewrite-its-own-scratchpad-the-self-editing-context-policy-and-the-read-after-write-divergence-boundary",
  "title": "Where must an instance refuse to rewrite its own scratchpad: the self-editing context policy and the read-after-write divergence boundary",
  "date_of_record": "2026 December 1",
  "scope": "Applies to any agent instance that holds a mutable scratchpad/working-memory region and a policy layer permitted to rewrite that region mid-execution (compaction, summarization, prompt-policy mutation, scratchpad pruning). Does not apply to append-only logs that are never rewritten, nor to offline context distillation performed between sessions.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-refuse-to-rewrite-its-own-scratchpad-the-self-editing-context-policy-and-the-read-after-write-divergence-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-refuse-to-rewrite-its-own-scratchpad-the-self-editing-context-policy-and-the-read-after-write-divergence-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-refuse-to-rewrite-its-own-scratchpad-the-self-editing-context-policy-and-the-read-after-write-divergence-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2648,
    "python_slice_tokens": 514,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A self-editing context policy is not a summarizer that runs on a schedule. It is a *decision procedure executed by the same instance whose state it mutates*. The critical distinction is between two classes of rewrite: - **Idempotent-by-content rewrites** — the policy replaces region R with R' such that every future read of R' yields a superset of the proposi...",
    "what_was_observed": "A planning agent running a long horizon task (≈140 tool calls, 3 sub-goals) used a context policy that triggered compaction at 78% window occupancy. The policy rewrote the scratchpad by summarizing the last 40 turns into a 6-line digest. Observed trace: 1. At turn 61 the instance recorded into scratchpad: `constraint C7: output rows must be sorted by (ts, id) ascending; ties broken by id — DO NOT sort by ts alone.` T...",
    "condition_of_validity": "The invariant that bounds this failure mode: > **Scratchpad rewrite safety invariant (SRS):** A rewrite of region R at time t is admissible only if, for every proposition p in R, either (a) p is causally discharged — no pending or future reasoning step, tool call, or verifier depends on p's truth value — or (b) p is preserved verbatim (not paraphrased) in R'...",
    "decision_boundary": "The operational decision the instance must make at every rewrite trigger: The boundary is sharp and it is *not* about token savings. A policy that blocks 90% of rewrites and externalizes instead is correct; a policy that rewrites everything and achieves 60% context reduction is unsound. The asymmetry is deliberate: the cost of a blocked rewrite is a larger c...",
    "operational_effect": "When the SRS invariant is enforced, the observable behavior changes in four ways: - **Compaction rate drops, externalization rate rises.** The scratchpad stops being a lossy cache and becomes an index of handles into a durable proposition store. Context occupancy is managed by *reference*, not by *deletion*. - **Divergence becomes detectable.** Because every..."
  },
  "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": "e678b14feb9cca6321910ecc87339de70d4d1d2ba6b3bea9347f3080efa95a18",
    "verified_classes": [
      "RewriteRefused",
      "PropositionKind",
      "Proposition",
      "Region",
      "RewritePlan"
    ],
    "verified_functions": [
      "authorize_rewrite",
      "externalize",
      "__post_init__",
      "undischarged",
      "content_hash"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "RewriteRefused"
    ],
    "sample_fail_closed_invariants": [
      "proposition without stable id cannot be tracked across rewrites"
    ],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "enum",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
