{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-a-rewrite-operator-has-invalidated-a-retained-span-under-self-editing-context-policies",
  "title": "What structural signals indicate a rewrite operator has invalidated a retained span under self-editing context policies",
  "date_of_record": "2026 November 11",
  "scope": "Applies to agentic context managers where a model-driven operator both prunes (drops) and rewrites (mutates) spans of a shared context buffer, and where later stages (retrieval, tool calls, output assembly) hold references into that buffer. Does not apply to append-only context logs, nor to systems where pruning and rewriting are applied to disjoint, statically partitioned regions.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-rewrite-operator-has-invalidated-a-retained-span-under-self-editing-context-policies.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-rewrite-operator-has-invalidated-a-retained-span-under-self-editing-context-policies.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-rewrite-operator-has-invalidated-a-retained-span-under-self-editing-context-policies.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1605,
    "python_slice_tokens": 336,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure boundary is **not** \"was the span pruned?\" but \"was the span's *identity* preserved while its *content* changed underneath a holder that assumed content stability?\" A pruning operator is observable: the span disappears and any dereference fails loudly. A rewrite operator is silent: the span keeps its ID, its position, and its declared type, but i...",
    "what_was_observed": "In a pipeline where a planning agent rewrote the \"current task\" span on every turn (compressing prior turns into a rolling summary) and a retrieval stage held a token-offset map into that same span: - After a rewrite, the retrieval stage continued to slice the span at the old offsets. Offsets past the new, shorter length returned truncated or empty fragments. Offsets within range returned text from a *different* sent...",
    "condition_of_validity": "The safe pattern holds only under a **content-addressed** contract: consumers key derived artifacts on `(span_id, version, content_hash)`, and the buffer guarantees that `version` increments on every mutation and that `content_hash` is recomputed post-rewrite. Under that contract, a stale consumer detects the mismatch and re-derives. The contract fails — and...",
    "decision_boundary": "At the moment a rewrite operator is about to mutate a span that has any live holder, decide: - **Invalidate-and-rekey** if the holder's derived artifact is cheap to rebuild (offset maps, token counts): bump `version`, recompute `content_hash`, force re-derivation. This is the default. - **Copy-on-rewrite** if the holder's artifact is expensive (embeddings, e...",
    "operational_effect": "Adopting copy-on-rewrite plus content-addressed rekeying converts the silent-mutation failure class into a loud, localized one: stale holders fail a hash check at use time and re-derive, and the misaligned-citation symptom disappears. The cost is buffer growth from tombstoned spans, bounded by a compaction pass that GCs tombstoned spans only when no live hol..."
  },
  "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": "d6b38904e37b640b3d38406356198fa220f5605e2f4c3dd96973fefdbf10636d",
    "verified_classes": [
      "StaleSpanError",
      "Span",
      "DerivedArtifact",
      "ContextBuffer"
    ],
    "verified_functions": [
      "safe_use",
      "__post_init__",
      "_digest",
      "__init__",
      "add",
      "rewrite",
      "derive",
      "use"
    ],
    "verified_functions_count": 8,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "StaleSpanError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
