{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-rewrites-its-own-context-policy-mid-episode-and-the-token-budget-is-charged-against-the-wrong-ledger",
  "title": "What happens when an instance rewrites its own context policy mid-episode and the token budget is charged against the wrong ledger",
  "date_of_record": "2026 November 20",
  "scope": "Applies to agents that carry a mutable, model-authored context policy (summarization directives, eviction rules, retrieval filters, scratchpad compaction) which the instance itself can rewrite during an episode, where rewriting is metered against a per-episode token budget. Does not apply to statically configured context windows or to budgets enforced externally by a fixed orchestrator that never delegates policy authorship to the model.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-context-policy-mid-episode-and-the-token-budget-is-charged-against-the-wrong-ledger.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-context-policy-mid-episode-and-the-token-budget-is-charged-against-the-wrong-ledger.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-context-policy-mid-episode-and-the-token-budget-is-charged-against-the-wrong-ledger.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1807,
    "python_slice_tokens": 282,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the agent ran out of context.\" It is a **ledger-attribution mismatch between the cost of *deciding* how to compress and the cost of the *compression itself*.** A self-editing agent spends tokens in two distinct currencies: (a) the *policy-authoring* tokens — the reasoning trace, the diff, the justification for rewriting how the context sh...",
    "what_was_observed": "An instance at 71% context utilization was instructed to \"manage your own context.\" It produced a policy rewrite: *\"Evict all tool-result blocks older than 4 turns; summarize the remainder into a rolling 400-token digest; re-retrieve on demand by keyword.\"* The authoring trace cost ~1,900 tokens (the model reasoned about which turns were stale, drafted the eviction predicate, and justified the digest size). The runti...",
    "condition_of_validity": "This failure requires all of the following to hold simultaneously; remove any one and the failure mode does not occur: 1. **Policy authorship is delegated to the instance** (not a fixed orchestrator), so the model chooses the rewrite's ambition. 2. **Authoring and execution share one budget counter**, so spending on the decision reduces the funds for the dec...",
    "decision_boundary": "The architectural invariant required is **reserve-before-commit**: a policy rewrite may not transition to `committed` until the runtime has reserved, from the *same* ledger it will later charge, an execution allowance that the policy's own declared cost model says it needs. Concretely: - The model's rewrite must carry a **declared execution cost estimate** (...",
    "operational_effect": "With reserve-before-commit enforced, the observed episode fails *loudly and early* instead of silently corrupting memory: the 1,900-token authoring trace is charged, the runtime sees that the declared 2,300-token execution reservation would exceed remaining headroom, rejects the commit, and returns a structured rejection to the model. The model then authors ..."
  },
  "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": "c00eefba3bf208d9080694f07a8f210014dc9361314deada14be3c9f47dea128",
    "verified_classes": [
      "PolicyCommitUnfundedError"
    ],
    "verified_functions": [
      "commit_context_policy",
      "execute_policy"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "PolicyCommitUnfundedError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
