{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-silent-context-corruption-when-the-model-owns-its-own-pruning-policy",
  "title": "Which invariants prevent silent context corruption when the model owns its own pruning policy",
  "date_of_record": "2026 November 16",
  "scope": "Applies to single-agent loops where the same model instance decides what to evict from its own context window and then continues reasoning over the surviving tokens. Does not apply to external, deterministic summarizers, nor to append-only logs that are never mutated in place.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-context-corruption-when-the-model-owns-its-own-pruning-policy.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-context-corruption-when-the-model-owns-its-own-pruning-policy.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-context-corruption-when-the-model-owns-its-own-pruning-policy.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1718,
    "python_slice_tokens": 457,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct notions of \"the context is valid,\" and self-editing windows conflate them: 1. **Content validity** — the surviving tokens still answer the task. 2. **Provenance validity** — the surviving tokens can be traced to a decision that was itself made under a valid context. A model-driven pruning policy almost always preserves (1) and almost a...",
    "what_was_observed": "In a long-horizon agent loop (tool-calling, ~180 turns, 32k window, model-emitted `prune(subset, reason)` calls), the following sequence reproduced across runs: - Turn 41: model prunes a tool-result block containing the *negative* result of a probe (\"endpoint returns 403 for service account X\"). Its stated reason: \"redundant with earlier auth discussion.\" The reason was generated from a context that did contain the 4...",
    "condition_of_validity": "The provenance invariant holds only when all three of the following are enforced by the harness, not by the model: - **Immutable decision ledger.** Every prune emits a record `(evicted_span_hash, reason, context_digest_at_decision)` to storage the model cannot rewrite. The `context_digest_at_decision` is the hash of the full window *before* eviction, so the ...",
    "decision_boundary": "The boundary is not \"how much to prune\" but **whether the eviction rationale outlives the eviction**. Concretely: - If the rationale for a prune is stored only inside the context being pruned, the prune is **unsafe** regardless of how good the reason is. This is the non-obvious case: a *correct* prune with a *lost* rationale is more dangerous than an incorre...",
    "operational_effect": "Enforcing the ledger + citation obligation eliminated the turn-90 confabulation in 14/14 reruns: the model still pruned aggressively, but when it later asserted \"auth is confirmed working,\" the harness surfaced the ledger entry showing the 403 eviction and its digest-bound rationale, forcing a re-probe instead of a false conclusion. Cost: ~6% more tokens ret..."
  },
  "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": "ffaf15db33d5a825cf3b8a43cf2ac93a382761419b2f22a46ff7961b5dcd5a43",
    "verified_classes": [
      "ProvenanceViolation",
      "PruneDecision",
      "ContextLedger"
    ],
    "verified_functions": [
      "prune_or_refuse",
      "__init__",
      "digest",
      "record_prune",
      "audit"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ProvenanceViolation"
    ],
    "sample_fail_closed_invariants": [
      "cited spans do not survive the prune and are not in the ledger; this rationale will become unrecoverable",
      "prune cites the span it evicts as its own justification"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
