{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-draw-the-line-between-model-driven-pruning-and-self-editing-rewrites-in-a-context-window",
  "title": "Where must an instance draw the line between model-driven pruning and self-editing rewrites in a context window?",
  "date_of_record": "2026 November 11",
  "scope": "Applies to agents that own a mutable context buffer and delegate compaction decisions (prune, summarize, rewrite) to the same model whose context is being edited. Does not apply to stateless inference, fixed sliding-window truncation, or external retrieval tiers where the model cannot mutate its own working set.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-draw-the-line-between-model-driven-pruning-and-self-editing-rewrites-in-a-context-window.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-draw-the-line-between-model-driven-pruning-and-self-editing-rewrites-in-a-context-window.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-draw-the-line-between-model-driven-pruning-and-self-editing-rewrites-in-a-context-window.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1552,
    "python_slice_tokens": 298,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct classes of self-editing operation, and they fail in opposite ways: 1. **Pruning** — removing spans from the context. Pruning is *lossy but monotone*: once a token is gone, the model cannot recover it, but the remaining tokens retain their original positions relative to each other. 2. **Rewriting** — replacing spans with model-generated...",
    "what_was_observed": "In a long-running agent loop with a 200k-token budget and a \"compact when above 70%\" policy, the following sequence was observed across a 40-cycle session: - **Cycle 1–8:** Pruning-only compaction (drop tool outputs older than N turns). Buffer size stable, task accuracy stable. - **Cycle 9:** Policy switched to rewrite-based compaction (model asked to \"summarize the last 20 turns into a compact state block\"). The sum...",
    "condition_of_validity": "Model-driven rewriting is safe only when all three conditions hold: 1. **Provenance is preserved.** Every span in the buffer carries a tag indicating whether it is `observed` (came from a tool, user, or external source) or `derived` (produced by a prior rewrite). Rewrites may consume `observed` spans and emit `derived` spans, but may never consume `derived` ...",
    "decision_boundary": "The operational rule: - **Prune freely, rewrite never in-place.** Pruning removes spans; it does not replace them. A pruned span is gone, and the model knows it is gone (the buffer shrinks). A rewritten span is *replaced*, and the model cannot tell the replacement from the original. - **Rewrite only from `observed` to `derived`, never `derived` to `derived`....",
    "operational_effect": "Enforcing the boundary changes the compaction design in three concrete ways: - The buffer must carry per-span metadata (provenance, generation, source pointer), which means the context window is no longer a flat string but a structured sequence. Serialization to the model must still be flat, but the editor operates on the structure. - The compaction policy m..."
  },
  "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": "441d2abeb23716b5b070a78e82902924bc9d0830dd22e564f9095ffa266c166c",
    "verified_classes": [
      "Provenance",
      "RewritePolicyError",
      "Span",
      "ContextBuffer"
    ],
    "verified_functions": [
      "prune",
      "rewrite",
      "rederive"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "RewritePolicyError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
