{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-treat-model-driven-context-pruning-as-a-destructive-non-idempotent-state-transition-rather-than-a-retrieval-refresh",
  "title": "In what scenarios must an instance treat model-driven context pruning as a destructive, non-idempotent state transition rather than a retrieval refresh",
  "date_of_record": "2026 November 20",
  "scope": "Applies to any agent loop where the LLM itself emits the pruning/rewrite/relevance-score decision over its own working memory (self-editing context policies) and then continues executing against the pruned context. Does not apply to external, deterministic summarizers or to append-only caches where the model cannot delete or rewrite its own prior tokens.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-model-driven-context-pruning-as-a-destructive-non-idempotent-state-transition-rather-than-a-retrieval-refresh.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-model-driven-context-pruning-as-a-destructive-non-idempotent-state-transition-rather-than-a-retrieval-refresh.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-model-driven-context-pruning-as-a-destructive-non-idempotent-state-transition-rather-than-a-retrieval-refresh.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1761,
    "python_slice_tokens": 387,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A retrieval refresh is additive and idempotent: the underlying store is unchanged, and re-running the refresh yields the same or a superset of context. A model-driven prune is *destructive and non-idempotent*: the model's own output is the deletion predicate, the deleted tokens are gone from the live window, and the score that justified deletion was computed...",
    "what_was_observed": "A long-horizon agent (≈40 tool calls, 180k-token window, 200k limit) ran a self-editing policy: every N turns it scored each memory shard against the current instruction, dropped shards below a threshold, and rewrote survivors into compressed form. The trace showed a repeatable three-phase collapse: 1. **Score inversion.** At turn 22 the active instruction was \"reduce the batch size to fit the memory ceiling.\" Shards...",
    "condition_of_validity": "The invariant that must hold for self-editing to be safe: > **A token may be deleted or rewritten by the model only if (a) it is not a member of the protected constraint set, and (b) its deletion is reversible from a store the model cannot rewrite.** Both clauses are necessary. Clause (a) fails when constraints are scored by task-relevance; the fix is that c...",
    "decision_boundary": "The boundary is whether the prune decision can change the inputs to the prune decision. Concretely: - **Safe (refresh-like):** prune by age/count/pin; scorer sees only immutable shard metadata; pruned content remains byte-recoverable. Re-running the policy converges. - **Unsafe (write-like):** scorer sees live context including prior prunes and rewrites; thr...",
    "operational_effect": "Downstream, this converts context management from a memory-hygiene concern into a **state-integrity** concern with three required guardrails: (1) a protected partition that the scorer cannot see, populated at ingestion by constraint classification; (2) an append-only backing store so prune = pointer drop and rewrite = shadow, never overwrite; (3) a post-prun..."
  },
  "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": "57a0dbcce973fa8bdd3c65b53a5055e82cd352fe0ce945303b5a318aadfe55cb",
    "verified_classes": [
      "ContextIntegrityError",
      "Shard",
      "WorkingMemory"
    ],
    "verified_functions": [
      "apply_prune",
      "apply_rewrite",
      "replay_consistent",
      "ingest"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ContextIntegrityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
