{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-when-model-driven-scratchpad-rewriting-violates-the-idempotence-invariant-of-a-self-editing-context-window",
  "title": "What structural signals indicate when model-driven scratchpad rewriting violates the idempotence invariant of a self-editing context window",
  "date_of_record": "2026 November 13",
  "scope": "Applies to agent loops where an LLM is permitted to rewrite its own scratchpad region (summarize, prune, reorder, or re-encode prior turns) between inference steps. Does not apply to append-only context management, external memory stores, or retrieval layers where the model cannot mutate in-context state.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-when-model-driven-scratchpad-rewriting-violates-the-idempotence-invariant-of-a-self-editing-context-window.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-when-model-driven-scratchpad-rewriting-violates-the-idempotence-invariant-of-a-self-editing-context-window.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-when-model-driven-scratchpad-rewriting-violates-the-idempotence-invariant-of-a-self-editing-context-window.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1551,
    "python_slice_tokens": 256,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Append-only context growth is monotonic: every token added is a fact the model can re-derive. Self-editing context is non-monotonic: a rewrite *replaces* the substrate from which the next rewrite is computed. The naive assumption is that a rewrite policy is a pure function of the pre-rewrite buffer. The actual failure is that a rewrite is a function of *(buf...",
    "what_was_observed": "In a scratchpad-rewriting loop where the model is asked to \"compress the working notes to the essential invariants\" every *k* steps, three structural signals preceded divergence: 1. **Instruction-absorption.** The rewrite directive (\"compress to essentials,\" \"remove redundant steps\") gets summarized *into* the scratchpad as a note-to-self. On the next rewrite, the model reads its own prior directive and re-executes i...",
    "condition_of_validity": "The idempotence invariant — *rewrite(rewrite(B)) == rewrite(B)* — holds only when the rewrite is a pure projection onto a set of features that are themselves invariant under rewriting. Concretely, it holds when: - The rewrite directive is held *outside* the rewritten buffer (in a system prompt or a separate control channel), not copied into it. - Task-critic...",
    "decision_boundary": "Before permitting a model-driven rewrite, check for the following; any positive is a stop signal: - **Directive co-location:** does the buffer to be rewritten contain the instruction that governs the rewrite? If yes, either relocate the directive or strip it before rewriting and re-inject after. - **Unprotected literal risk:** does the buffer contain strings...",
    "operational_effect": "The practical consequence is that self-editing context is safe only as a *bounded, audited* operation, never as an unattended loop. Teams that deploy it as a loop observe a characteristic trajectory: stable for the first several cycles, then a sharp loss of task fidelity that correlates not with total tokens removed but with the number of rewrite cycles appl..."
  },
  "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": "dd87e31266c89372622ff1cc5ff7e062bc8e5ac7e3590575b1931b16ed16e064",
    "verified_classes": [
      "NonIdempotentRewriteError"
    ],
    "verified_functions": [
      "_hash",
      "_literals",
      "guarded_rewrite"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "NonIdempotentRewriteError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "hashlib",
      "re"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
