{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-rewrites-its-own-context-and-the-rewrite-evicts-the-evidence-that-justified-the-rewrite",
  "title": "What happens when an instance rewrites its own context and the rewrite evicts the evidence that justified the rewrite",
  "date_of_record": "2026 November 19",
  "scope": "Applies to any agent loop where the model itself is granted a context-mutation tool (prune, summarize, rewrite, re-rank, or \"compact\") whose output replaces the spans it was derived from, within a single task episode. Does not apply to append-only memory writes, external retrieval re-ranking that leaves the source corpus intact, or human-authored prompt edits.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-context-and-the-rewrite-evicts-the-evidence-that-justified-the-rewrite.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-context-and-the-rewrite-evicts-the-evidence-that-justified-the-rewrite.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-context-and-the-rewrite-evicts-the-evidence-that-justified-the-rewrite.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2705,
    "python_slice_tokens": 584,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different things a model can do to its own working context. It can **annotate** — emit a summary, a relevance score, or a re-ranked index that sits *alongside* the original spans. Or it can **replace** — emit a transformation whose output *takes the slot* of the input spans, which are then discarded to reclaim tokens. Annotation is...",
    "what_was_observed": "A planner-executor agent was given a `compact_context` tool: it could pass a list of span IDs to drop, plus a free-text `rationale`, and the runtime would splice them out and insert the rationale string in their place. Token budget was 32k; the task was a multi-file refactor with ~140 tool observations, each 100–400 tokens. At step 61 the context hit 29.8k tokens. The model called `compact_context` dropping spans 12–...",
    "condition_of_validity": "The invariant that must hold for self-editing to be safe: > **For every span S evicted at step t, the surviving context must contain a sufficient condition to reconstruct S's potential future relevance — either S's content, a pointer that resolves to S, or a dependency record naming the entities in S.** The rationale string fails this. `\"early exploration, s...",
    "decision_boundary": "The boundary between safe and unsafe self-editing is not a token threshold and not a summarization-quality threshold. It is whether the eviction decision is **committed before or after** the eviction record is written and verified. - **Unsafe (commit-first):** model emits drop-list + rationale, runtime splices immediately, record written as a side effect. If...",
    "operational_effect": "With record-first compaction and pinned eviction records, the step-88 failure is bounded: the model, reaching the `parse_legacy_header` question, sees a marker of absence, consults the eviction record, finds the symbol listed under span 19, re-fetches the span, and proceeds correctly. The cost is a re-fetch — one tool call — against the cost of a duplicate-d..."
  },
  "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": "5e144940b3b9da7c7694094936d6ca707d7da41f299bb52201829e357bef960d",
    "verified_classes": [
      "UnsafeCompactionError",
      "Span",
      "EvictionRecord",
      "ContextStore"
    ],
    "verified_functions": [
      "compact",
      "validate_and_commit",
      "resolve"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "UnsafeCompactionError"
    ],
    "sample_fail_closed_invariants": [
      "assert store.resolve('parse_legacy_header') is not None",
      "empty compaction request"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
