{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-refuse-model-driven-context-compaction-when-its-own-retention-scores-are-computed-against-a-rewritten-history",
  "title": "Under what conditions must an instance refuse model-driven context compaction when its own retention scores are computed against a rewritten history",
  "date_of_record": "2026 November 21",
  "scope": "Applies to any agent that lets the model itself decide which turns to prune, rewrite, or retain via self-assigned relevance scores inside a mutable context buffer. Does not apply to externally fixed sliding windows, hard token truncation, or retrieval stores where the compaction decision is made outside the reasoning loop.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-model-driven-context-compaction-when-its-own-retention-scores-are-computed-against-a-rewritten-history.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-model-driven-context-compaction-when-its-own-retention-scores-are-computed-against-a-rewritten-history.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-model-driven-context-compaction-when-its-own-retention-scores-are-computed-against-a-rewritten-history.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2312,
    "python_slice_tokens": 414,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different things a \"self-editing context policy\" can do, and they fail in opposite directions: 1. **Pruning** removes whole turns that are judged low-relevance. The removed content is gone, but every surviving turn is byte-identical to what was originally written. Relevance scores are computed against the *true* history. 2. **Rewri...",
    "what_was_observed": "A long-horizon tool-use agent (planning + shell + file-edit tools, ~180k token budget, self-editing context every 20 turns) was given an early-turn constraint at turn 3: *\"All output files must be written under `/work/out/`, never to the repo root.\"* This is a single short instruction with no tool call attached. At turn 40 the agent ran its compaction pass. The pass had two stages: - **Stage A (rewrite):** the model ...",
    "condition_of_validity": "The self-editing policy is only sound under a condition that is almost never checked: **every relevance score must be computed against a buffer segment that is byte-identical to a segment that existed in the original transcript, and every rewrite must preserve a verifiable back-reference to the span it replaced.** Formally, let `B_t` be the buffer at turn `t...",
    "decision_boundary": "The instance must draw the boundary at the point where **a scoring decision would be made against model-authored text that stands in for an event the model could otherwise be wrong about.** Concretely: - **Allowed:** prune whole turns whose content is byte-identical to original, scored against original context. Deletion of verbatim history is recoverable-by-...",
    "operational_effect": "When the invariant holds, self-editing compaction behaves as intended: the buffer shrinks, the model retains a faithful (if lossy) view, and any pruned constraint is pruned *knowingly* — the deletion is logged with a hash and can be re-fetched or flagged. Continuity is preserved because the scoring function and the deletion target share the same referent. Wh..."
  },
  "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": "632eed2df932a278170bfb85bde7f5802244ab01af56a5e7dcd00262dd22357a",
    "verified_classes": [
      "Polarity",
      "UnsoundCompactionError",
      "Span",
      "Rewrite"
    ],
    "verified_functions": [
      "apply_rewrite",
      "score_and_prune",
      "compact",
      "__post_init__"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "UnsoundCompactionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
