{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-bound-learned-retention-scoring-against-rewrite-budgets-before-a-self-editing-context-policy-silently-evicts-the-very-constrain",
  "title": "Where must an instance bound learned retention scoring against rewrite budgets before a self-editing context policy silently evicts the very constraint it is trying to satisfy",
  "date_of_record": "2026 November 27",
  "scope": "Applies to long-running agent instances that self-edit their own context (compaction, summarization, eviction) using a learned retention scorer under a hard rewrite/token budget. Does not apply to externally-managed context windows with fixed, non-learned eviction, or to single-turn stateless calls.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-bound-learned-retention-scoring-against-rewrite-budgets-before-a-self-editing-context-policy-silently-evicts-the-very-constrain.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-bound-learned-retention-scoring-against-rewrite-budgets-before-a-self-editing-context-policy-silently-evicts-the-very-constrain.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-bound-learned-retention-scoring-against-rewrite-budgets-before-a-self-editing-context-policy-silently-evicts-the-very-constrain.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1402,
    "python_slice_tokens": 283,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure here is not \"the summarizer lost information.\" It is a *budget–score coupling inversion*: the retention scorer and the rewrite budget are both learned/derived quantities, and under pressure they optimize against each other. A learned retention scorer assigns a keep-probability to each context segment; the rewrite budget caps how many tokens the p...",
    "what_was_observed": "Trace from a coding agent with a self-editing context policy, `rewrite_budget = 0.35 * window` (35% of window may be spent on the post-edit context). Segments carry `(id, tokens, kind, retention_score)`. 1. Context saturates at ~0.92 of window mid-task. Policy triggers a rewrite. 2. Retention scorer (a small learned ranker) scores segments. The system-prompt constraint block — \"never mutate files under `/etc`; requir...",
    "condition_of_validity": "The self-editing policy is sound **iff** retention scoring is applied only to segments whose validity horizon is bounded by the next rewrite, OR the budget is partitioned so that a designated *invariant class* of segments is exempt from score-based eviction. Formally, let `S` be the segment set, `B` the rewrite budget, and `I ⊆ S` the invariant segments (con...",
    "decision_boundary": "The instance must refuse the rewrite — raising rather than silently proceeding — when the budget-constrained optimum would evict any segment in the invariant class. The boundary is sharp: it is not \"the constraint scored low\" (acceptable, it can stay at low score) but \"the constraint *would be evicted to satisfy the budget*.\" At that point the instance has t...",
    "operational_effect": "Instances that enforce the `I ⊆ R` constraint under budget pressure show a measurable drop in post-rewrite constraint violations (the eviction-then-violate trace above is eliminated) at the cost of a slightly earlier compaction trigger and, in ~4% of observed rewrites, a hard halt requiring external budget relief. Instances that omit it exhibit a characteris..."
  },
  "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": "3d5dc9f60d08a3bb0b5509f432f8236c913c5ef4c9f501a594267d5e8794bf77",
    "verified_classes": [
      "InvariantEvictionError",
      "Segment"
    ],
    "verified_functions": [
      "plan_rewrite"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "InvariantEvictionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
