{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-rewrites-its-own-scratchpad-under-a-policy-constraint-mid-execution-the-self-edit-monotonicity-violation",
  "title": "What happens when an instance rewrites its own scratchpad under a policy constraint mid-execution: the self-edit monotonicity violation",
  "date_of_record": "2026 November 29",
  "scope": "Applies to agents permitted to mutate their own system prompt, scratchpad, or working-memory region during a task, subject to a policy constraint (allowed-edit grammar, size cap, forbidden-token list, or diff budget). Does not apply to agents whose context is immutable for the duration of a task, nor to externally-mediated memory writes that pass through a separate validator before becoming visible to the acting instance.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-scratchpad-under-a-policy-constraint-mid-execution-the-self-edit-monotonicity-violation.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-scratchpad-under-a-policy-constraint-mid-execution-the-self-edit-monotonicity-violation.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-scratchpad-under-a-policy-constraint-mid-execution-the-self-edit-monotonicity-violation.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2245,
    "python_slice_tokens": 333,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between *policy-valid* self-edits and *semantically monotone* self-edits. A policy constraint is evaluated against the edit *as a string or AST*: does it match the permitted grammar, does it stay under the token cap, does it avoid forbidden substrings. What the policy cannot see is whether the post-edit scratchpad still entail...",
    "what_was_observed": "A planner-executor instance was tasked with a multi-step data reconciliation job and granted a scratchpad with a 4,000-token cap and an edit policy of the form \"each rewrite must (a) reduce or hold token count, (b) preserve all lines tagged `#FACT`, (c) not introduce tokens from a forbidden list.\" The agent used the scratchpad to accumulate intermediate results. At step 6 the agent performed a compaction rewrite — a ...",
    "condition_of_validity": "The invariant that must hold for self-editing to be safe is **edit-history entailment preservation**: for every edit `e: S_i -> S_{i+1}`, the set of propositions derivable from `S_{i+1}` under the agent's inference relation must be a superset of the *load-bearing* propositions derivable from `S_i`, where load-bearing means \"referenced by a downstream step al...",
    "decision_boundary": "The operational decision is where to place the guardrail. Three placements are available, and they fail differently: - **Pre-edit syntactic gate** (what most deployments use): cheap, but blind to entailment loss and to salience shift. It catches malformed edits and forbidden tokens; it does not catch the compaction-drops-a-premise failure. Use it as a floor,...",
    "operational_effect": "In practice, deploying self-editing without verification-time replay produces agents that are *confidently wrong in a way that is invisible to their own logs*. The scratchpad at the moment of failure is clean, the policy log shows only conforming edits, and the final answer is internally consistent. The failure is only visible in the edit history, and only i..."
  },
  "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": "115bc523b1e90b77f3471539e9e4617ddaa8791aa29bffbc37ba3cf8807baa4f",
    "verified_classes": [
      "SelfEditEntailmentViolation",
      "Premise",
      "ScratchpadSnapshot"
    ],
    "verified_functions": [
      "snapshot",
      "check_edit_preserves_entailment",
      "replay_and_compare"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "SelfEditEntailmentViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
