{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-bound-in-place-token-rewriting-when-a-self-editing-context-window-rewrites-its-own-provenance-anchors",
  "title": "Where must an instance bound in-place token rewriting when a self-editing context window rewrites its own provenance anchors",
  "date_of_record": "2026 December 1",
  "scope": "Applies to single-instance agents that mutate their own context buffer via in-place token rewriting (compaction, redaction, summarization-in-place, anchor correction) while relying on provenance anchors (offsets, hashes, citation IDs, span markers) embedded in that same buffer. Does not apply to append-only context growth, external vector-store memory, or multi-agent handoff protocols where the buffer is immutable across turns.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-bound-in-place-token-rewriting-when-a-self-editing-context-window-rewrites-its-own-provenance-anchors.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-bound-in-place-token-rewriting-when-a-self-editing-context-window-rewrites-its-own-provenance-anchors.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-bound-in-place-token-rewriting-when-a-self-editing-context-window-rewrites-its-own-provenance-anchors.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2095,
    "python_slice_tokens": 450,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **content rewriting** and **anchor rewriting**. An agent that compacts or edits its context is performing content rewriting: it replaces a span of tokens with a shorter or cleaner span. This is well-understood and bounded by token budgets and semantic-fidelity checks. The failure mode here is subtler: when the edit shi...",
    "what_was_observed": "A single agent performing iterative self-editing on a task log. The buffer contains, interleaved, both content and anchors of the form `[ref:ID@offset]` where `offset` is a character index into the buffer and `ID` names a source span. The agent's edit loop: (1) find a verbose span, (2) replace it with a summary, (3) continue. Trace of the failure: 1. Buffer at turn *t*: span A occupies offsets 100–400; anchor `[ref:S...",
    "condition_of_validity": "The provenance-preserving invariant holds **only** under the conjunction of three conditions, and the failure occurs when any one is dropped: - **Atomicity:** the content rewrite and the anchor re-basing must commit as one transaction over the buffer. If the agent writes the new content and defers anchor maintenance to a \"later cleanup pass,\" the window betw...",
    "decision_boundary": "The operative decision for the agent is whether a proposed in-place rewrite is *anchor-safe* or must be downgraded to an append-only operation. The boundary: - If the rewrite's span contains **zero** live anchor targets and shifts offsets by a delta the agent can compute, it is safe **only** with total re-basing in the same commit. - If the rewrite's span co...",
    "operational_effect": "When the invariant is enforced, self-editing remains usable for compaction and redaction at the cost of a per-edit re-basing pass whose size is proportional to the number of live anchors at or after the edit point—cheap relative to the reasoning steps it protects. When it is violated, the observable effect is *silent misattribution*: the agent's outputs rema..."
  },
  "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": "56be1bf767f6715c74cfdcae8389fea5de53aabca33be117c80c21592420b104",
    "verified_classes": [
      "ProvenanceDriftError",
      "Anchor",
      "ContextBuffer"
    ],
    "verified_functions": [
      "commit_rewrite",
      "dereference"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ProvenanceDriftError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
