{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-priority-weighted-context-eviction-from-silently-deleting-the-agent-s-own-eviction-policy",
  "title": "Which invariants prevent priority-weighted context eviction from silently deleting the agent's own eviction policy",
  "date_of_record": "2026 November 27",
  "scope": "Applies to single-agent runtimes that maintain a mutable context window under a self-editing policy: a priority-weighted eviction function plus a relevance-scored retention function whose parameters (weights, thresholds, pinned-set membership) live inside the same context they govern. Does not cover externally-managed context (host-controlled truncation), stateless one-shot calls, or eviction policies stored in immutable out-of-band config.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-priority-weighted-context-eviction-from-silently-deleting-the-agent-s-own-eviction-policy.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-priority-weighted-context-eviction-from-silently-deleting-the-agent-s-own-eviction-policy.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-priority-weighted-context-eviction-from-silently-deleting-the-agent-s-own-eviction-policy.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1846,
    "python_slice_tokens": 336,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the agent forgot something.\" It is that the *policy that decides what to forget* is itself a context resident, and therefore eligible for eviction by the very policy it defines. Priority-weighted eviction assigns each segment a score `s = w_p·priority + w_r·relevance`, sorts, and drops the tail until the window fits. The weights `w_p, w_r...",
    "what_was_observed": "A 40-turn tool-using agent with a 32k-token window, `w_p=0.6, w_r=0.4, τ=0.35`, and a pinned set `P={\"system_prompt\",\"task_goal\"}`. The policy block occupied ~380 tokens as segments `policy.weights`, `policy.threshold`, `policy.pinned_set`, `policy.ledger`. At turn 27, three large tool responses (file dumps, ~9k tokens combined) pushed the window over budget. The eviction pass ran: 1. Scored all segments. `policy.wei...",
    "condition_of_validity": "The failure requires the conjunction of four conditions; remove any one and the invariant holds: - **Co-residence:** policy parameters and task content share one addressable segment space. If policy lives in a structurally separate region (system-tier, non-evictable), it is not a candidate. - **Scoreability:** the eviction function scores policy segments wit...",
    "decision_boundary": "The boundary is not \"pin the policy\" as a blanket rule — pinning everything defeats eviction. The boundary is whether policy segments are **addressable by the scorer**: - If the scorer reads `w_p, w_r, τ, P` from the same store it evicts from → the store must guarantee those keys are non-evictable *by construction* (separate namespace, excluded from the cand...",
    "operational_effect": "Concrete guardrails that bound the failure: 1. **Structural exclusion, not priority pinning.** The eviction iterator must yield only segments whose namespace is `task.*` or `retrieval.*`; `policy.*` is never a candidate regardless of score. Assert `candidate.namespace != \"policy\"` at the iterator boundary. 2. **Policy version stamping.** Every turn records `..."
  },
  "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": "4c1fa163cebcf336617b3ce271cff72a5894c56dc9ebc4e0f471ba82c063ca71",
    "verified_classes": [
      "PolicyClosureViolation",
      "Segment",
      "ContextStore"
    ],
    "verified_functions": [
      "eviction_pass",
      "add",
      "score"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "PolicyClosureViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
