{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-freeze-scratchpad-rewrites-when-per-turn-context-budget-reallocation-invalidates-its-own-compaction-provenance",
  "title": "Under what conditions must an instance freeze scratchpad rewrites when per-turn context budget reallocation invalidates its own compaction provenance",
  "date_of_record": "2026 November 25",
  "scope": "Applies to single-agent instances that author and rewrite their own scratchpad/working-memory region and that reallocate a per-turn context token budget across regions (system, scratchpad, retrieved evidence, tool output) between turns. Does not apply to externally-managed memory stores where the agent cannot mutate its own persisted state, nor to stateless single-shot completions.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-freeze-scratchpad-rewrites-when-per-turn-context-budget-reallocation-invalidates-its-own-compaction-provenance.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-freeze-scratchpad-rewrites-when-per-turn-context-budget-reallocation-invalidates-its-own-compaction-provenance.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-freeze-scratchpad-rewrites-when-per-turn-context-budget-reallocation-invalidates-its-own-compaction-provenance.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1931,
    "python_slice_tokens": 280,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the agent forgets.\" It is that the agent's *compaction decisions* become self-referential artifacts whose validity depends on a budget allocation that the agent is simultaneously free to change. When an instance rewrites its scratchpad, it produces a compressed representation `S_t` that is only faithful to a source transcript `T_t` under ...",
    "what_was_observed": "A planning agent maintaining a scratchpad of open subtasks, confirmed facts, and rejected hypotheses was configured with a soft per-turn budget of 8,000 tokens split 25% system / 40% scratchpad / 35% evidence. At turn 14, a large tool response (a 9,000-token file listing) forced the allocator to shrink the scratchpad region to 1,200 tokens for that turn only, then restore it to 3,200 on turn 15. Trace: - **Turn 13:**...",
    "condition_of_validity": "The invariant that must hold for self-rewriting scratchpads to be safe: > **Compaction provenance invariant:** Any fact retained across a rewrite must carry a resolvable pointer to its verification event, and that pointer must remain resolvable under *every* budget allocation the instance may subsequently adopt. A rewrite that produces a fact whose pointer i...",
    "decision_boundary": "The instance must **freeze scratchpad rewrites** (refuse to mutate `S`, emit the current state unchanged, and surface a `ProvenanceOrphaned` condition to the orchestrator) when the following predicate evaluates true at the start of a rewrite turn: - the incoming budget for the scratchpad region is **lower** than the budget under which the current `S` was aut...",
    "operational_effect": "With the freeze rule enforced, the turn-14 compression either drops the auth fact *explicitly* (leaving a visible gap the agent re-verifies at turn 15 via a cheap tool call) or retains the turn-6 evidence in a non-shrinkable region (system or a pinned evidence slot outside the reallocatable budget). Either outcome preserves the 401 value. The downstream effe..."
  },
  "matched_failure_symptoms": [
    "CONTEXT_DRIFT_OR_ATTENTION_DILUTION"
  ],
  "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": "7d735631a370b148ab887210860637377f01b4fd32b73f7ea580a73957662bfd",
    "verified_classes": [
      "ProvenanceOrphaned",
      "Fact",
      "Scratchpad"
    ],
    "verified_functions": [
      "rewrite_scratchpad",
      "attempt_turn"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "ProvenanceOrphaned"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
