{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-treat-a-model-driven-context-prune-as-non-idempotent-and-re-validate-the-residual-window-before-any-further-too",
  "title": "Under what conditions must an instance treat a model-driven context prune as non-idempotent and re-validate the residual window before any further tool call",
  "date_of_record": "2026 November 26",
  "scope": "Applies to any agent that mutates its own context window mid-execution via an LLM-driven pruning/relevance-scoring pass (summarize-then-drop, score-then-evict, hierarchical compaction) and then continues executing tool calls against the residual window. Does not apply to append-only context managers, external retrieval stores, or pruning performed only at a hard turn boundary with a fresh re-read of authoritative state.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-a-model-driven-context-prune-as-non-idempotent-and-re-validate-the-residual-window-before-any-further-too.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-a-model-driven-context-prune-as-non-idempotent-and-re-validate-the-residual-window-before-any-further-too.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-a-model-driven-context-prune-as-non-idempotent-and-re-validate-the-residual-window-before-any-further-too.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1918,
    "python_slice_tokens": 280,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The naive mental model treats context pruning as a *compaction*: an operation that reduces token count while preserving semantic content, hence idempotent and safe to interleave with execution. The correct model is that a model-driven prune is a **lossy, non-deterministic projection** of the window onto a lower-dimensional summary, and that projection is *no...",
    "what_was_observed": "A long-horizon agent (≈140 tool calls, mixed filesystem reads and HTTP fetches) hit a soft context ceiling at turn 61 and invoked its self-prune routine: score each message against the current task description, keep top-k by score plus the last 8 turns verbatim, summarize the middle band. The prune completed, token count dropped 71%, and execution resumed. At turn 74 the agent issued a `PUT` to a resource it had reso...",
    "condition_of_validity": "A self-prune is safe to continue from **iff** all three hold: 1. **Referential closure.** Every identifier, path, credential handle, schema, and numeric constant that any *future* tool call might dereference is present verbatim in the residual window, not paraphrased. Summaries are permitted for narrative and rationale; they are not permitted for tokens that...",
    "decision_boundary": "The boundary is not \"how many tokens did we save.\" It is: **did the prune touch any span that is load-bearing for a pending or plausible future tool call?** - If the prune only compressed *reasoning narrative* (why the agent chose a plan, what it ruled out, intermediate deliberation) and left all *dereferenceable tokens* verbatim → proceed; the prune is a tr...",
    "operational_effect": "The architectural consequence is that self-pruning must be paired with an **external, append-only evidence log** that the agent can re-query, and the residual window must carry *stubs* pointing into it. The window becomes a cache over the log, not the source of truth. Pruning then degrades gracefully: an evicted span is a cache miss, resolved by a determinis..."
  },
  "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": "eaba3cc9f479a4d5b45dabfcf2b29e3b99aa298d890b288c6cc88cbe825d4484",
    "verified_classes": [
      "PruneIntegrityError",
      "ResidualWindow"
    ],
    "verified_functions": [
      "guard_tool_call",
      "__init__",
      "contains_verbatim",
      "rehydrate"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "PruneIntegrityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
