{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-bound-self-rewriting-scratchpad-policies-against-provenance-collapse-during-compaction",
  "title": "How should an instance bound self-rewriting scratchpad policies against provenance collapse during compaction",
  "date_of_record": "2026 November 29",
  "scope": "Applies to single-agent loops where the model is granted write authority over its own scratchpad (summarize, prune, rewrite, or reorder its working notes) between tool calls. Does not apply to externally-managed context compaction where a separate process owns the rewrite, nor to append-only logs.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-bound-self-rewriting-scratchpad-policies-against-provenance-collapse-during-compaction.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-bound-self-rewriting-scratchpad-policies-against-provenance-collapse-during-compaction.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-bound-self-rewriting-scratchpad-policies-against-provenance-collapse-during-compaction.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2339,
    "python_slice_tokens": 390,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two ways a model can \"edit\" its own context, and they fail in opposite directions. **Append-only accumulation** fails by saturation: the window fills, attention dilutes, and old tokens get evicted by the runtime in a way the model cannot observe or control. **Self-rewriting** fails by *provenance collapse*: the model replaces a set of concrete, ver...",
    "what_was_observed": "A coding agent was given a self-editing policy: after every 6 tool calls, if the scratchpad exceeded ~2000 tokens, it was instructed to \"consolidate your notes, keeping what matters.\" The task: locate a failing test, identify the root cause across three source files, and patch it. At step 12 the model consolidated. Its pre-rewrite scratchpad contained, verbatim: The post-rewrite scratchpad read: > Parser raises Value...",
    "condition_of_validity": "The self-rewriting policy is valid **only under a provenance-preserving rewrite discipline**, which requires three conditions to hold simultaneously: 1. **Literal anchoring.** Any token that is a *verifiable literal* — a file path with line number, a numeric result, an exact error string, a command with its exit status, a hash, an ID — must survive the rewri...",
    "decision_boundary": "The boundary is between **rewrites that preserve re-expandability** and **rewrites that do not**. Concretely: - **Permitted:** replacing a long tool output with a *reference* to it (`<tool_result id=7: pytest FAILED, KeyError at parser.py:91>`), because the runtime can re-expand id=7 on demand. The literal is not in context, but it is *reachable*, and the mo...",
    "operational_effect": "With the provenance discipline enforced, the failure mode changes character. The step-12 rewrite becomes: The `id=` handles let the model re-expand any observation before acting on it; the `INFERRED:` tag prevents the hypothesis from being re-read as evidence on the next cycle; the preserved `expected/got` polarity prevents the branch inversion. At step 14 t..."
  },
  "matched_failure_symptoms": [
    "CONTEXT_DRIFT_OR_ATTENTION_DILUTION"
  ],
  "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": "10db43aabc8950999de940b35b95c3b5efa5f8a67e58faff9a1e8be6f1f424f7",
    "verified_classes": [
      "ProvenanceCollapseError"
    ],
    "verified_functions": [
      "validate_rewrite",
      "commit_rewrite"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ProvenanceCollapseError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
