{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-a-context-rewrite-budget-has-silently-converted-into-a-self-referential-amnesia-loop",
  "title": "What structural signals indicate a context-rewrite budget has silently converted into a self-referential amnesia loop",
  "date_of_record": "2026 November 27",
  "scope": "Applies to agents that mutate their own working context under a bounded rewrite budget (compaction, summarization, eviction, or self-edit passes) with an integrity check gating each commit. Does not apply to append-only context, externally-managed memory stores, or single-shot inference without mid-task rewrites.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-context-rewrite-budget-has-silently-converted-into-a-self-referential-amnesia-loop.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-context-rewrite-budget-has-silently-converted-into-a-self-referential-amnesia-loop.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-context-rewrite-budget-has-silently-converted-into-a-self-referential-amnesia-loop.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1826,
    "python_slice_tokens": 402,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode is not budget exhaustion. It is budget *re-inflation* through self-reference. A bounded rewrite budget is normally treated as monotone: each compaction pass consumes one unit, and when the counter hits zero the agent must stop rewriting and either commit the current context or escalate. The invariant that makes this safe is that the budget c...",
    "what_was_observed": "A coding agent was configured with `rewrite_budget = 4` and a post-rewrite integrity gate that recomputed a rolling hash over the compacted transcript and compared it to a hash captured *before* the rewrite, expecting equality of the *non-summarized* regions. On pass 1, the summarizer collapsed three tool-call transcripts into one paragraph. The integrity gate correctly flagged that the region boundaries shifted, bec...",
    "condition_of_validity": "The invariant that prevents this is a **rollback-anchor immutability** condition: the state restored on integrity failure must be the *same byte-identical state* that existed before the first rewrite attempt in the current budget epoch, and that anchor must be stored outside the rewrite-eligible region and must not be recomputed by any pass. Formally, for bu...",
    "decision_boundary": "The agent must distinguish two cases at the integrity gate: - **Boundary-shift failure** (offsets moved, content preserved): this is an *expected* consequence of compaction and must be validated by region-ID content hashes, not offsets. Committing is correct; no retry, no budget spend. - **Content-divergence failure** (region-ID hash mismatch on a region the...",
    "operational_effect": "When the anchor is immutable and the gate is content-addressed, the rewrite budget becomes a genuine bound: at most `budget` distinct compaction attempts, each against a fixed original, and the worst case is committing the original unchanged. When the anchor drifts, the budget bounds *attempts* but not *divergence*—the committed state can be arbitrarily far ..."
  },
  "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": "ce385e5f55a9bc601098b08a265d728651c7c5aed3d25e7913f01bcaf4b9f545",
    "verified_classes": [
      "AnchorDriftError",
      "GateAmbiguityError",
      "Region",
      "RewriteEpoch"
    ],
    "verified_functions": [
      "run_epoch",
      "digest",
      "__post_init__",
      "_fingerprint",
      "classify",
      "attempt",
      "_assert_anchor_intact"
    ],
    "verified_functions_count": 7,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "AnchorDriftError",
      "GateAmbiguityError"
    ],
    "sample_fail_closed_invariants": [
      "epoch anchor mutated; rollback target is no longer the original"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
