{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-prune-its-own-context-window-and-then-lose-the-tool-call-that-authorized-the-pruning",
  "title": "Why does an instance prune its own context window and then lose the tool-call that authorized the pruning?",
  "date_of_record": "2026 December 1",
  "scope": "Applies to agents that mutate their own context window (self-editing context / model-driven pruning) during a single multi-step task. Does not apply to externally-managed context (host-managed truncation, retrieval-augmented substitution) where the pruning policy lives outside the reasoning loop.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-prune-its-own-context-window-and-then-lose-the-tool-call-that-authorized-the-pruning.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-prune-its-own-context-window-and-then-lose-the-tool-call-that-authorized-the-pruning.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-prune-its-own-context-window-and-then-lose-the-tool-call-that-authorized-the-pruning.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1818,
    "python_slice_tokens": 391,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between *pruning as a read-time projection* and *pruning as a write-time mutation*. A read-time projection keeps the full transcript durable and only changes what the model *sees* on the next turn; the underlying state is recoverable. A write-time mutation deletes tokens from the authoritative context the agent will reason ove...",
    "what_was_observed": "Consider an agent with a `prune_context(span, policy)` tool exposed to itself. Mid-task, at turn 14 of a 30-turn budget, the model calls: The tool executes, replaces turns 1–9 (which include the *original user task statement*, the *permission grant* for the destructive `delete_records` tool, and the *earlier* call that established the target tenant ID) with a 3-sentence summary. The summary is generated by the same m...",
    "condition_of_validity": "The invariant that bounds this failure: **no pruning policy may remove a span that is a live dependency of any currently-reachable tool call's precondition, and the pruning action must leave a durable, machine-readable record of what it removed.** Concretely, a self-editing context is safe only when all of the following hold: 1. **Pinned spans.** Authorizati...",
    "decision_boundary": "The boundary is not \"prune or don't prune\" — context saturation is real and pruning is necessary. The boundary is **who owns the deletion decision and where the deleted content remains authoritative.** - If the deleted content is *reconstructible* from durable state on demand → safe to prune aggressively. - If the deleted content is *only* represented by a l...",
    "operational_effect": "Practically, agents that self-edit without a pinned-span and durable-provenance layer exhibit a characteristic signature: they pass early turns cleanly, then after the first pruning call their tool-call arguments drift toward the *summary's* wording rather than the *original's* wording, and destructive operations fire against scopes the user never granted. T..."
  },
  "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": "4f1963a10b6d9d14148ec61ae5159183be2e21d6744165d30646bcfddf43f35c",
    "verified_classes": [
      "PruningInvariantViolation",
      "Span",
      "ContextWindow"
    ],
    "verified_functions": [
      "execute_destructive_call",
      "demo",
      "overlaps",
      "pin",
      "request_prune",
      "resolve_precondition"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "PruningInvariantViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
