{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-self-editing-context-windows-from-silently-deleting-the-evidence-an-agent-is-reasoning-about",
  "title": "Which invariants prevent self-editing context windows from silently deleting the evidence an agent is reasoning about",
  "date_of_record": "2026 November 28",
  "scope": "Applies to any agent that mutates its own context window via model-driven pruning, summarization, or relevance scoring between reasoning steps (e.g., \"context compaction\" loops, self-summarizing planners, relevancy-ranked memory eviction). Does not apply to append-only context that is only truncated by a deterministic tokenizer at the transport layer, nor to external retrieval stores that are never rewritten in place.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-editing-context-windows-from-silently-deleting-the-evidence-an-agent-is-reasoning-about.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-editing-context-windows-from-silently-deleting-the-evidence-an-agent-is-reasoning-about.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-editing-context-windows-from-silently-deleting-the-evidence-an-agent-is-reasoning-about.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1799,
    "python_slice_tokens": 414,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two ways a context window can shrink: **lossless truncation** (drop the oldest tokens, deterministic, recoverable from the log) and **lossy compaction** (the model rewrites spans into summaries or scores spans for deletion, non-deterministic, not recoverable from the window itself). The failure mode here lives exclusively in the second category, an...",
    "what_was_observed": "A planning agent running a 47-step tool-use task (repository audit) invoked a self-compaction routine every time the window exceeded 70% of budget. The routine asked the model to (a) summarize the last 12 turns, (b) score every remaining span 0–1 for \"relevance to the current objective,\" and (c) drop spans below 0.3. At step 22 the objective text was stable (\"identify all call sites of `parse_config`\"). At step 29 a ...",
    "condition_of_validity": "The evidential-monotonicity invariant holds — i.e., self-compaction is safe — only when **all three** of the following are true: 1. **Query stability:** the objective/predicate that drove the relevance scoring is provably unchanged between the scoring step and every future step that consumes the compacted window. In practice this means the objective must be ...",
    "decision_boundary": "The boundary between safe compaction and silent evidence loss is **not** a threshold on relevance score or summary length. It is the **reversibility class of the operation**: - **Reversible edit** (span moved to an addressable store, tombstone left in-window with ID + score + query-hash): safe to apply at any score threshold. The agent can always re-expand. ...",
    "operational_effect": "Enforcing the invariant converts the failure from silent-and-terminal into loud-and-recoverable. Concretely: - Compaction epochs are bracketed by objective-hash pins; an objective change forces a **re-expansion pass** that pulls tombstoned spans back for re-scoring under the new hash before any further deletion. - Every tombstone is a `(span_id, score, query..."
  },
  "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": "174f71019a876adf4efa36d5d163d4b10dfcc4882cdd02499221513c16a074d4",
    "verified_classes": [
      "StaleEvidenceError",
      "Tombstone",
      "SelfEditingWindow"
    ],
    "verified_functions": [
      "run_incident_replay",
      "_hash",
      "query_hash",
      "compact",
      "recall",
      "retarget",
      "audit_claim"
    ],
    "verified_functions_count": 7,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "StaleEvidenceError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
