{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-rewrites-its-own-working-memory-mid-trajectory-and-silently-invalidates-the-provenance-of-an-already-committed-plan-step",
  "title": "What happens when an instance rewrites its own working memory mid-trajectory and silently invalidates the provenance of an already-committed plan step",
  "date_of_record": "2026 November 27",
  "scope": "Applies to any agent that performs model-driven edits of its own context (summarization, pruning, reordering, or restructure) between plan-commit and plan-execute phases within a single trajectory. Does not apply to append-only contexts or to systems where context rewriting is performed by an external orchestrator that re-derives provenance hashes.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-working-memory-mid-trajectory-and-silently-invalidates-the-provenance-of-an-already-committed-plan-step.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-working-memory-mid-trajectory-and-silently-invalidates-the-provenance-of-an-already-committed-plan-step.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-working-memory-mid-trajectory-and-silently-invalidates-the-provenance-of-an-already-committed-plan-step.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2128,
    "python_slice_tokens": 436,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different kinds of \"self-editing context.\" The first is *lossy compression of history*: the instance summarizes old turns and accepts that some fidelity is gone. This is a known, tolerable failure—the model knows it summarized and treats the summary as lower-confidence evidence. The second, and the one this record is about, is *los...",
    "what_was_observed": "A research agent was tasked with a multi-file refactor. The trajectory: 1. Turn 4: reads `config/loader.py`, observes that `load_config()` returns a mutable dict shared across call sites. 2. Turn 5: reasons that the fix requires converting the return to a frozen mapping, and **commits plan step S3**: \"edit `loader.py` to return `MappingProxyType`; downstream callers in `app.py` and `cli.py` must not mutate the result...",
    "condition_of_validity": "The failure requires all of the following to co-occur: - **Commitment precedes rewrite.** A plan step was committed (declared final, acted upon, or marked non-revisable) before the context edit. Steps committed *after* the rewrite are unaffected—they reason from the post-rewrite context and carry their own fresh warrant. - **The rewrite is model-driven and l...",
    "decision_boundary": "The instance cannot, from inside the rewritten context, detect that it has crossed this boundary—the provenance gap is invisible by construction, because the marker that would reveal it (the evicted evidence) is exactly what was removed. Detection must therefore be **structural and pre-rewrite**, not introspective and post-rewrite. The operative rule: **befo...",
    "operational_effect": "Without the guardrail, the failure mode is **confident execution of a correct plan against a misread world**: the plan step is right, the instance is certain, and the execution is wrong because the certainty was inherited from a warrant the instance can no longer check. This is worse than ordinary amnesia, because amnesia produces hesitation (the instance kn..."
  },
  "matched_failure_symptoms": [
    "OOM_KILL_OR_MEMORY_EXHAUSTION"
  ],
  "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": "3f74bf028373f382b8bbda08d725947b5befca96fefd27aa98f2588fd378ea96",
    "verified_classes": [
      "ProvenanceGapError",
      "PlanStep",
      "RewriteProposal"
    ],
    "verified_functions": [
      "check_rewrite_preserves_provenance",
      "apply_rewrite"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ProvenanceGapError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
