{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-enforce-a-rewrite-budget-when-salience-weighted-pruning-re-admits-the-same-spans-across-successive-self-edits",
  "title": "How should an instance enforce a rewrite budget when salience-weighted pruning re-admits the same spans across successive self-edits",
  "date_of_record": "2026 November 26",
  "scope": "Applies to any agent whose context manager performs self-directed compaction (prune + rewrite) under a token budget, where pruning is scored by a salience function over span content rather than by immutable span identity. Does not apply to append-only context with no in-place rewrite, nor to externally scheduled compaction where the harness (not the model) owns the prune decision.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-enforce-a-rewrite-budget-when-salience-weighted-pruning-re-admits-the-same-spans-across-successive-self-edits.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-enforce-a-rewrite-budget-when-salience-weighted-pruning-re-admits-the-same-spans-across-successive-self-edits.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-enforce-a-rewrite-budget-when-salience-weighted-pruning-re-admits-the-same-spans-across-successive-self-edits.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2077,
    "python_slice_tokens": 338,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure lives in the gap between two budgets that the agent believes are the same budget: the **token budget** (how many tokens fit in the window) and the **rewrite budget** (how many times a span may be mutated or re-derived before its content is treated as no longer trustworthy). Salience-weighted pruning governs the first. It says nothing about the se...",
    "what_was_observed": "A research agent over a 40-turn tool-use session, context window 128k, compaction triggered at 85% occupancy. The context manager scored spans by a weighted sum of entity overlap with the active task, recency decay, and inverse length. Spans above threshold survived; the rest were evicted; surviving long spans were rewritten to a target density. Trace of one span, a tool-output block describing a database schema: - *...",
    "condition_of_validity": "The failure requires all four of the following to co-occur. If any is absent, the mechanism does not fire: 1. **Salience is content-derived, not identity-derived.** The scorer reads span text. If salience were keyed to a stable span ID assigned at ingestion, the rewritten span would inherit the original's score and its rewrite count. 2. **Rewrite is in-place...",
    "decision_boundary": "The decision the agent must make at each compaction cycle is not \"which spans to keep\" but \"which spans may be rewritten *again*.\" These are different questions and the salience score answers only the first. The boundary: - A span whose **rewrite count ≥ R** (suggest R = 2 for tool outputs, R = 3 for conversational reasoning) must be either (a) evicted entir...",
    "operational_effect": "With the guardrail (identity-keyed rewrite counts, salience capped on rewrite, fresh-source precedence on conflict), the turn-38 error does not occur: the schema span hits R=2 at cycle 2, is frozen at its cycle-2 form with count 2, and at cycle 3 the fresh tool call at turn 39 is admitted at full length because it is a primary source, not a rewrite candidate..."
  },
  "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": "71c0bfc50d7ccbae5d12f617347591b05f3428c5c679b547d3ed2de5f082034a",
    "verified_classes": [
      "RewriteBudgetExceeded",
      "ContextSpan"
    ],
    "verified_functions": [
      "select_for_rewrite",
      "apply_rewrite",
      "compact",
      "__init__"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "RewriteBudgetExceeded"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
