{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-spends-its-context-rewriting-budget-on-a-self-referential-rewrite",
  "title": "What happens when an instance spends its context-rewriting budget on a self-referential rewrite",
  "date_of_record": "2026 November 15",
  "scope": "Applies to agents whose context policy is model-authored (the model itself emits context rewrite operations: summaries, deletions, reorderings, evictions) and whose rewrite operations are metered by a finite budget. Does not apply to externally-scheduled compaction, to read-only retrieval augmentation, or to budgets enforced by a supervisor that can veto rewrites before they commit.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-spends-its-context-rewriting-budget-on-a-self-referential-rewrite.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-spends-its-context-rewriting-budget-on-a-self-referential-rewrite.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-spends-its-context-rewriting-budget-on-a-self-referential-rewrite.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1680,
    "python_slice_tokens": 257,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A context-rewriting budget is normally understood as a resource that bounds *how much* an agent can forget or compress. That framing is wrong in one specific way: the budget is itself part of the context, and the act of rewriting context consumes budget that must then be reflected in the rewritten context. When a rewrite operation is self-referential — i.e.,...",
    "what_was_observed": "In a deployment where the model emitted structured rewrite ops (`summarize`, `drop`, `reorder`) and the remaining budget was rendered into the prompt as a ledger block (`budget_remaining: N ops`), the following sequence reproduced deterministically: 1. Ledger reads `budget_remaining: 2`. 2. Model emits a `summarize` op over a long tool-transcript region, and in the same op's replacement text includes a refreshed ledg...",
    "condition_of_validity": "The failure requires all of the following to hold simultaneously: - The budget ledger is rendered *inside* the rewritable region (not in a pinned system prefix or an out-of-band channel). - Rewrite ops are authored in a single pass against a pre-op snapshot, with no read-after-apply reconciliation. - The runtime decrements an external counter but does not *r...",
    "decision_boundary": "The boundary is not \"does the model have budget\" but **\"is the authoritative budget value inside the region the model can rewrite?\"** Concretely: - If the ledger is in the rewritable region **and** the runtime does not reconcile post-commit, treat every model-authored ledger line as *advisory and possibly stale*, never as authorization. The external counter ...",
    "operational_effect": "When this boundary is crossed, two failure modes dominate, and they are asymmetric: - **Over-spend loop:** the model believes it has budget it does not have, emits ops that are rejected, and interprets rejection as runtime inconsistency. Cost is turns and tokens, not correctness — but it can loop until the turn cap. - **Silent freeze:** the model's own rewri..."
  },
  "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": "7e977081b35f1f3e917d5cb6ef075dd645ffc6a2771f3573ea53edc4f8658682",
    "verified_classes": [
      "SelfAuthoredBudgetError",
      "BudgetLedger"
    ],
    "verified_functions": [
      "commit_rewrite",
      "__init__",
      "decrement"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "SelfAuthoredBudgetError"
    ],
    "sample_fail_closed_invariants": [
      "rewrite budget exhausted; no ops may commit. The ledger has been corrected in-context to budget_remaining: 0."
    ],
    "stdlib_dependencies": [
      "re"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
