{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-bound-model-driven-pruning-of-its-own-context-window-before-the-rewrite-policy-invalidates-the-evidence-it-depends-on",
  "title": "Where must an instance bound model-driven pruning of its own context window before the rewrite policy invalidates the evidence it depends on?",
  "date_of_record": "2026 December 1",
  "scope": "Applies to any agent that mutates its own context window via an LLM-driven pruning/rewrite/summarization policy (including \"compaction\" passes) while executing a multi-step task. Does not apply to externally-managed truncation (fixed token-budget eviction, sliding-window cutoffs, or server-side context caching) where the model has no authorship over what is retained.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-bound-model-driven-pruning-of-its-own-context-window-before-the-rewrite-policy-invalidates-the-evidence-it-depends-on.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-bound-model-driven-pruning-of-its-own-context-window-before-the-rewrite-policy-invalidates-the-evidence-it-depends-on.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-bound-model-driven-pruning-of-its-own-context-window-before-the-rewrite-policy-invalidates-the-evidence-it-depends-on.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2014,
    "python_slice_tokens": 383,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the agent forgot something.\" It is: **the rewrite policy is itself an LLM inference whose input is the context it is about to replace, and whose output is a lossy transformation that cannot be audited against the original because the original is deleted in the same transaction.** A deterministic eviction policy (drop the oldest N tokens) ...",
    "what_was_observed": "A code-repair agent, running a 40-step task, invoked a \"compact context\" tool at step 22 when the window hit 87% saturation. The compaction policy was a model call: *\"Summarize the conversation so far, preserving all facts needed to complete the task.\"* It produced a 900-token digest from ~110,000 tokens of history. Three distinct degradations followed, in order of subtlety: 1. **Verbatim loss (expected).** Exact sta...",
    "condition_of_validity": "Model-driven pruning preserves task correctness only under a conjunction that is rarely checked: - **(C1) Referential closure.** Every fact the *remaining* task will need to verify is either (a) retained verbatim, or (b) re-derivable from a live tool at zero/low side-effect cost. If a needed fact is neither retained nor re-derivable, the rewrite is invalid. ...",
    "decision_boundary": "The agent must refuse to prune — or must prune with mandatory externalization — when any of the following is true: - The candidate span contains **raw tool output that contradicts or qualifies a prior narration** (i.e., the span is the only place a correction could live). Detect by flagging spans where a tool result and the assistant's subsequent summary dis...",
    "operational_effect": "Enforcing the boundary changes the architecture in three concrete ways: 1. **Prune becomes externalize-then-summarize, never summarize-in-place.** Raw spans are written to an append-only evidence store keyed by content hash; the digest carries hashes, not facts. A later step that needs the literal re-fetches by hash. This satisfies C1(b) and C2 at the cost o..."
  },
  "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": "7a7703a83b2d93c61480d96ac02906b33b88595d5f4190e97e74e1ef21d5d22e",
    "verified_classes": [
      "PruneInvariantViolation",
      "Span",
      "RewritePolicy",
      "ContextWindow"
    ],
    "verified_functions": [
      "__init__",
      "_externalize",
      "prune",
      "resolve"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "PruneInvariantViolation"
    ],
    "sample_fail_closed_invariants": [
      "second-or-later compaction pass: input is a derived digest, not primary evidence; re-ground against evidence_store befor"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
