{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-bound-self-pruning-when-its-own-relevance-scores-are-computed-against-the-context-it-is-about-to-delete",
  "title": "Where must an instance bound self-pruning when its own relevance scores are computed against the context it is about to delete",
  "date_of_record": "2026 November 26",
  "scope": "Applies to any agent that mutates its own context window by scoring existing tokens/messages for relevance and evicting the low-scoring tail, where the scorer is the same model instance whose context is being pruned. Does not apply to externally-driven compaction (a separate summarizer process, a fixed token-budget truncator, or a retrieval layer that never rewrites the live window).",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-bound-self-pruning-when-its-own-relevance-scores-are-computed-against-the-context-it-is-about-to-delete.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-bound-self-pruning-when-its-own-relevance-scores-are-computed-against-the-context-it-is-about-to-delete.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-bound-self-pruning-when-its-own-relevance-scores-are-computed-against-the-context-it-is-about-to-delete.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2146,
    "python_slice_tokens": 379,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different things an agent can do when its context fills: *external* compaction and *self-pruning*. External compaction treats the context as data — a separate routine (summarizer, truncator, RAG re-fetch) reads it and produces a shorter artifact that the model then consumes. Self-pruning treats the context as the model's own workin...",
    "what_was_observed": "A long-horizon agent running a multi-file refactor task hit 92% of a 128k window. Its self-pruning heuristic: at each turn, embed the last user turn plus the current plan step as a query, score every retained message by cosine similarity to that query, and drop the bottom 30% until utilization fell below 70%. The heuristic had run cleanly for ~40 turns. At turn 41 the plan step was \"update the retry constant in the c...",
    "condition_of_validity": "Self-pruning is sound only when all four of the following hold. If any fails, the pruning must be downgraded to external compaction or disabled. 1. **Score-query independence.** The query used to score messages must not be derived solely from the current plan step. It must include a stable \"invariant channel\" — user constraints, hard requirements, and tool-d...",
    "decision_boundary": "The boundary is not \"how much to prune\" but **what the score is allowed to be a function of.** A score is admissible for eviction iff it was computed under a context superset of the post-eviction context, using a query that is independent of the eviction. Operationally: - If the query is the current plan step only → score is admissible for *ranking* but not ...",
    "operational_effect": "With the invariant channel pinned and score-freezing enforced, the same agent at turn 41 kept messages (a), (b), (c) — they were in the pinned partition and never scored against the plan step. Utilization stayed at 88% (above the 70% target) for two turns until external compaction summarized the tool-result history. The cost is a slightly tighter window and ..."
  },
  "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": "7481a351bddb7e9cb6ec721ef67c0915e3b7fa95f3479b4fc4ee837bd8b9bae7",
    "verified_classes": [
      "PruningBoundaryViolation",
      "Message",
      "PruningCycle"
    ],
    "verified_functions": [
      "digest",
      "prune"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "PruningBoundaryViolation"
    ],
    "sample_fail_closed_invariants": [
      "pinned message scored below 0.15 against active query; query too narrow — fall back to external compaction"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
