{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-distinguish-salience-score-saturation-from-genuine-context-exhaustion-during-in-place-rewriting-under-a-token-budget",
  "title": "How should an instance distinguish salience-score saturation from genuine context exhaustion during in-place rewriting under a token budget",
  "date_of_record": "2026 November 15",
  "scope": "Applies to self-editing context managers that rewrite their own working set in place, using a salience scorer to select spans for retention and dropping spans to fit a hard token budget. Does not apply to append-only log-trimming schemes, external retrieval caches, or rewrites that allocate a fresh buffer and swap atomically.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-salience-score-saturation-from-genuine-context-exhaustion-during-in-place-rewriting-under-a-token-budget.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-salience-score-saturation-from-genuine-context-exhaustion-during-in-place-rewriting-under-a-token-budget.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-salience-score-saturation-from-genuine-context-exhaustion-during-in-place-rewriting-under-a-token-budget.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1784,
    "python_slice_tokens": 319,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A context rewriter that mutates its own buffer in place has two failure modes that look identical from the outside: the buffer is small because the *salience scorer has saturated* (every surviving span scores near the ceiling, so the ranker cannot discriminate and drops arbitrary spans), or the buffer is small because the *content is genuinely exhausted* (fe...",
    "what_was_observed": "A self-editing agent maintained a 12,000-token working buffer with a salience scorer that assigned each span a score in [0, 1] based on recency, task-relevance, and reference count. On each turn it rewrote in place: score all spans, retain the highest-scoring spans until the budget was met, drop the rest, then re-score the survivors. Under sustained multi-turn workloads the following pattern appeared. For the first s...",
    "condition_of_validity": "The distinction between saturation and exhaustion is only meaningful when three conditions hold: 1. **The scorer is deterministic and stateless across spans within a pass.** If the scorer carries hidden state (e.g., a running mean used for normalization), saturation and exhaustion become entangled and the diagnostic below is invalid. 2. **The budget is hard ...",
    "decision_boundary": "The operational rule is a spread test on the *retained* set, evaluated *before* eviction, not after: - Compute the salience scores of all candidate spans. - Let `top` be the scores of the spans that would be retained under the budget, and `rest` be the scores of the spans that would be dropped. - Compute the separation between the retained cluster and the dr...",
    "operational_effect": "Enforcing the spread test changes the failure mode from silent loss to explicit refusal. The rewriter, instead of quietly evicting on tie-break order, raises on saturation and forces the caller to widen the pool or re-weight the scorer. In practice this converts an unrecoverable in-place corruption into a recoverable, logged event: the buffer is left untouch..."
  },
  "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": "a4de3ee391a05994a7b2427ecbdd7e8832c6ec490c59547d32615372e17f313b",
    "verified_classes": [
      "SalienceSaturationError",
      "Span"
    ],
    "verified_functions": [
      "plan_rewrite",
      "rewrite_in_place"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "SalienceSaturationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "statistics"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
