{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-refuse-a-model-driven-scratchpad-rewrite-the-scratchpad-invariant-preservation-boundary-in-self-editing-context",
  "title": "When must an instance refuse a model-driven scratchpad rewrite: the scratchpad invariant-preservation boundary in self-editing context",
  "date_of_record": "2026 November 30",
  "scope": "Applies to agents that mutate their own working context (scratchpad, plan buffer, running state block) via a model-generated rewrite operation between reasoning steps. Does not apply to append-only context growth, external vector-store memory, or human-curated prompt templates where the rewrite is authored offline.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-a-model-driven-scratchpad-rewrite-the-scratchpad-invariant-preservation-boundary-in-self-editing-context.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-a-model-driven-scratchpad-rewrite-the-scratchpad-invariant-preservation-boundary-in-self-editing-context.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-a-model-driven-scratchpad-rewrite-the-scratchpad-invariant-preservation-boundary-in-self-editing-context.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1830,
    "python_slice_tokens": 253,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different things an agent can do to its scratchpad: *append* (monotone, information-preserving by construction) and *rewrite* (non-monotone, information-destroying by construction). The distinction that matters operationally is not \"did the model produce a plausible new scratchpad\" but \"did the rewrite preserve the set of *invarian...",
    "what_was_observed": "A planner-executor agent maintained a scratchpad with three logical regions: `FACTS` (hard constraints: budget=1200 tokens, target host `db-7`, user PIN-gated field names), `PLAN` (ordered subgoals with status), and `NOTES` (free reasoning). A \"compact\" step was triggered when the scratchpad exceeded 70% of the context window. The compaction prompt asked the model to \"summarize the scratchpad, preserving what is need...",
    "condition_of_validity": "A model-driven scratchpad rewrite is safe to commit only when all three of the following hold: - **Invariant closure:** every downstream step's correctness depends only on predicates that are re-derivable from the rewritten text *without* the model's judgment. Formally, for each invariant `i` in the set `I` the remaining plan depends on, the rewritten scratc...",
    "decision_boundary": "The decision is not \"rewrite or don't.\" It is a partition of the scratchpad into *rewritable* and *frozen* regions, decided by a deterministic classifier, not by the model: - **Frozen (verbatim, never model-rewritten):** hard literals (IDs, hosts, numeric bounds, column/field names, cryptographic material, user-stated constraints), committed decisions with d...",
    "operational_effect": "Enforcing the frozen/rewritable partition changes the agent's failure profile in three concrete ways: 1. **Compaction becomes lossless for the things that matter and lossy only for the things that don't.** `NOTES` can be aggressively summarized; `FACTS` grows monotonically and is only pruned by an explicit, logged `retire_invariant(i, reason)` call that a hu..."
  },
  "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": "f9199bd46afd2b2faef2235d057b074db46ed5f11b11819bf5c50e8c36ad3b39",
    "verified_classes": [
      "InvariantViolation",
      "Scratchpad"
    ],
    "verified_functions": [
      "extract_frozen_tokens",
      "commit_rewrite"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "InvariantViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "re"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
