{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-rewrites-its-own-context-in-place-summarization-collapse-and-the-provenance-anchor-invariant",
  "title": "What happens when an instance rewrites its own context: in-place summarization collapse and the provenance-anchor invariant",
  "date_of_record": "2026 November 25",
  "scope": "Applies to any agent that mutates its own working context in place—relevance pruning, model-authored summarization, or \"compact and continue\" policies—where the rewritten context is the sole carrier of task state. Does not apply to architectures that preserve an append-only event log and reconstruct context from immutable storage on every step.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-context-in-place-summarization-collapse-and-the-provenance-anchor-invariant.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-context-in-place-summarization-collapse-and-the-provenance-anchor-invariant.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-context-in-place-summarization-collapse-and-the-provenance-anchor-invariant.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2211,
    "python_slice_tokens": 454,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different things an agent can do to its context: *deriving* a new context (summarizing into a fresh buffer while the original remains retrievable) versus *overwriting* the context (the summary replaces the source, and the source is gone). The failure mode in this record lives exclusively in the second case. When an instance summari...",
    "what_was_observed": "A long-horizon agent task (a multi-file refactor with ~40 tool calls) crossed the context threshold at step 22 and triggered a model-authored \"compact and continue\" policy. The policy instructed the model to rewrite the transcript into a structured summary preserving \"decisions, file paths, and open questions,\" then discard the raw turns. Trace of the collapse: 1. **Step 22 — first compaction.** The summarizer emitte...",
    "condition_of_validity": "The invariant that bounds this failure: **a context rewrite is safe only if every pruned or summarized span is recoverable from a store the rewriting process cannot itself mutate, and every retained claim carries a pointer into that store.** Concretely, in-place summarization is admissible only when all three hold: - **Append-only backing store.** The raw tu...",
    "decision_boundary": "The boundary is not \"summarize or don't.\" It is **whether the rewrite is reversible.** - **Reversible rewrite (safe):** the summary is generated, the raw context is retained in an immutable store, and the agent can re-expand any claim to its source on demand. Compaction here is a *cache* of context, and cache invalidation is possible because the backing stor...",
    "operational_effect": "The operational consequence is a class of failure that is *silent and self-consistent*. The agent does not experience confusion; it experiences a coherent context that happens to have forgotten a constraint. Its self-checks pass. Its confidence is unchanged. The failure surfaces only downstream—a re-broken test, a violated directive, a re-litigated decision—..."
  },
  "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": "d6b2e2d19cce29a5a83427acd904b580b749892a0ab4d158ca07797618e84fee",
    "verified_classes": [
      "ContextRewriteError",
      "SpanClass",
      "Span",
      "RewritePlan"
    ],
    "verified_functions": [
      "validate_rewrite",
      "compact_and_continue"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 7,
    "raised_exceptions": [
      "ContextRewriteError"
    ],
    "sample_fail_closed_invariants": [
      "in-place rewrite with no immutable backing store: pruned spans become unrecoverable and drift is undetectable"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
