{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-rewrites-its-own-context-in-place-and-the-rewrite-target-is-a-token-it-has-already-conditioned-on",
  "title": "What happens when an instance rewrites its own context in place and the rewrite target is a token it has already conditioned on",
  "date_of_record": "2026 November 26",
  "scope": "Applies to agent runtimes that implement in-place token rewriting policies (context compaction, token substitution, \"self-editing\" scratchpad mutation) where the mutation target lies at a position earlier than the current generation cursor. Does not apply to append-only context growth, out-of-band memory stores, or rewrites that are gated to positions strictly after the last committed attention span.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-context-in-place-and-the-rewrite-target-is-a-token-it-has-already-conditioned-on.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-context-in-place-and-the-rewrite-target-is-a-token-it-has-already-conditioned-on.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-context-in-place-and-the-rewrite-target-is-a-token-it-has-already-conditioned-on.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1935,
    "python_slice_tokens": 359,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is not *what* a self-editing policy rewrites, but *whether the rewrite target has already entered the model's causal conditioning set*. A token at position `p < cursor` has already influenced every hidden state at positions `p+1 … cursor`. Rewriting it in place does not retroactively change those states; it produces a context who...",
    "what_was_observed": "A coding agent operated a self-editing scratchpad with a compaction policy: when the scratchpad exceeded 6,000 tokens, a summarizer rewrote the oldest 2,000 tokens in place with a compressed summary, preserving byte offsets for the remainder. The intent was to keep the scratchpad under a budget while retaining recent reasoning. The failure trace: 1. At step 41 the agent wrote a plan into the scratchpad: `retry budget...",
    "condition_of_validity": "The failure requires three conditions to co-occur: - **In-place mutation of a causally-antecedent span.** The rewrite target must be at a position strictly before the current generation cursor and must be within the attention span that produced the current cached state. Rewrites at or after the cursor are safe by construction. - **Cache non-invalidation.** T...",
    "decision_boundary": "The boundary between sound and unsound self-editing is drawn at the mutation target's relationship to the cache frontier, not at the mutation's semantic content: - **Target ≥ cache frontier (append or rewrite-in-tail):** sound. The mutation is causally downstream of all retained state; re-encoding is unnecessary because no retained state depends on the mutat...",
    "operational_effect": "The operational consequence is that self-editing policies silently partition the agent's knowledge into two stores — the visible context and the latent cache — that can disagree. Every downstream consumer that reads the context (auditors, peer agents, replay tools, human reviewers) sees one version; the actor sees another. Verification replay, which reconstr..."
  },
  "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": "d40cbf1dfa61586f291ac8eaf48927594b12bf338284f38bd19740bcbae5583a",
    "verified_classes": [
      "SplitBrainPrefixError"
    ],
    "verified_functions": [
      "apply_self_edit",
      "compact_scratchpad"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "SplitBrainPrefixError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
