{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-prunes-its-own-scratchpad-mid-task-the-retention-gate-amnesia-boundary-in-self-editing-context",
  "title": "What happens when an instance prunes its own scratchpad mid-task: the retention-gate amnesia boundary in self-editing context",
  "date_of_record": "2026 November 23",
  "scope": "Applies to agents that rewrite their own context window via model-driven scratchpad pruning, summarization, or relevance-gated retention while a multi-step task is in flight. Does not apply to externally managed context compaction (e.g., a host framework truncating history between turns) or to retrieval-augmented systems where the source of truth lives outside the window.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-prunes-its-own-scratchpad-mid-task-the-retention-gate-amnesia-boundary-in-self-editing-context.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-prunes-its-own-scratchpad-mid-task-the-retention-gate-amnesia-boundary-in-self-editing-context.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-prunes-its-own-scratchpad-mid-task-the-retention-gate-amnesia-boundary-in-self-editing-context.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2204,
    "python_slice_tokens": 391,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There is a structural difference between *forgetting* and *pruning*. Forgetting is a passive overflow: the context window saturates, the oldest tokens fall off, and the agent loses fidelity uniformly and predictably. Pruning is an active, model-authored decision to delete content it has judged irrelevant. The failure mode is not that pruned content is gone—i...",
    "what_was_observed": "A planning agent executing a 14-step data-reconciliation task with a 32k-token window began self-pruning at step 6 when occupancy crossed a self-imposed 70% threshold. Its pruning policy was a single LLM call: given the current scratchpad, return the indices of \"lines not needed for the remaining plan.\" The remaining plan at step 6 read, verbatim, `\"…then reconcile against source B and emit the delta.\"` At step 6 the...",
    "condition_of_validity": "The relevance-gated retention policy is only sound under a condition that self-editing agents almost never satisfy: > **A piece of context may be pruned iff its removal does not change the output of any step reachable from the current state under the current plan *and* under any plan revision the agent might adopt.** Two clauses carry the weight. First, *rea...",
    "decision_boundary": "The boundary between safe and unsafe self-editing is not a token budget or a relevance score threshold. It is the answer to one question, asked per pruned item: **Is the recovery path idempotent and independent of the pruning agent's own summary?** - *Idempotent + independent* → prune is safe. (Snapshot with content hash; append-only log; re-derivable from a...",
    "operational_effect": "When the boundary is respected, self-editing context behaves as intended: the window stays under budget, and the agent retains the *ability* to reconstruct any pruned fact on demand, at the cost of a snapshot store that grows monotonically (bounded by task, reclaimed at task end). Latency rises modestly on the rare re-materialization. When the boundary is vi..."
  },
  "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": "1214fd8951b2cf9ad8e922e67ec54159bb8b77f4b77fd583ab38bec74513a550",
    "verified_classes": [
      "UnhedgedPruneError",
      "ContextItem",
      "SnapshotStore"
    ],
    "verified_functions": [
      "prune_item",
      "self_edit",
      "put",
      "get"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "UnhedgedPruneError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
