{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-eviction-scoring-collapse-when-compaction-pressure-exceeds-the-token-budget",
  "title": "Which invariants prevent eviction-scoring collapse when compaction pressure exceeds the token budget",
  "date_of_record": "2026 November 22",
  "scope": "Applies to single-agent and multi-agent LLM loops that perform in-context memory compaction (summarization, eviction, or tiered demotion) under a hard token budget, where eviction candidates are ranked by a learned or heuristic importance score. Does not apply to systems with unbounded context, nor to external vector-store retrieval, which has its own staleness regime.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-eviction-scoring-collapse-when-compaction-pressure-exceeds-the-token-budget.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-eviction-scoring-collapse-when-compaction-pressure-exceeds-the-token-budget.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-eviction-scoring-collapse-when-compaction-pressure-exceeds-the-token-budget.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1965,
    "python_slice_tokens": 387,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Two things get conflated under \"compaction\": *budget allocation* (how many tokens each memory tier or task segment is granted) and *eviction scoring* (which specific items survive once a tier overflows). The failure mode documented here is not \"the model forgot something.\" It is **eviction-scoring collapse**: when compaction pressure rises, the scoring funct...",
    "what_was_observed": "A coding agent loop with a 128k window ran a compaction pass whenever utilization crossed 85%. Each memory item (tool result, reasoning trace fragment, user constraint) carried a composite score `s = w_r·recency + w_f·frequency + w_p·pinned + ε`, where `ε` was a small semantic-relevance term from an embedding similarity to the current goal. At 85% utilization the eviction threshold cut items with `s < τ`. Observed tr...",
    "condition_of_validity": "The invariant \"eviction preserves task-critical memory\" holds **only if** the following three conditions are jointly satisfied: 1. **Threshold absoluteness.** The eviction threshold must be a function of item class, not of the current candidate distribution. Quantile-based thresholds (`τ = p75(s)`) violate this by construction and are only safe when the scor...",
    "decision_boundary": "The boundary between safe and unsafe compaction is **whether the eviction decision is invariant to the pressure level**. Concretely: - **Safe:** eviction score `s_i` and threshold `τ_class` are both computed from item-local features and class membership. Increasing pressure evicts *more* items but never *reorders* which items are most protected. The set of p...",
    "operational_effect": "Systems that violate the pressure-invariance invariant exhibit a characteristic signature: **constraint violations cluster at high utilization**, and the agent's post-compaction self-report confidently claims compliance. This makes the failure resistant to standard evals, which run at moderate utilization. The blast radius is largest for agents with tool-gua..."
  },
  "matched_failure_symptoms": [
    "CONTEXT_DRIFT_OR_ATTENTION_DILUTION"
  ],
  "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": "eab0e8bf266728d8c1ec5bf06cd5c58554e2755694d0bc26da5a275b8a7fb58e",
    "verified_classes": [
      "EvictionInvariantViolation",
      "MemoryItem",
      "CompactionPolicy"
    ],
    "verified_functions": [
      "_score",
      "compact"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "EvictionInvariantViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
