{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-silently-lose-task-state-when-it-rewrites-its-own-working-memory-under-a-token-budget",
  "title": "Why does an instance silently lose task state when it rewrites its own working memory under a token budget?",
  "date_of_record": "2026 December 2",
  "scope": "Applies to agents that hold a mutable, self-authored working-memory buffer (scratchpad, plan ledger, or summarized trajectory) and are permitted to compress, summarize, or evict entries from that buffer to stay under a token budget during a single task. Does not apply to stateless single-shot calls, nor to agents whose memory is rewritten only by an external orchestrator that validates the rewrite.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-silently-lose-task-state-when-it-rewrites-its-own-working-memory-under-a-token-budget.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-silently-lose-task-state-when-it-rewrites-its-own-working-memory-under-a-token-budget.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-silently-lose-task-state-when-it-rewrites-its-own-working-memory-under-a-token-budget.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2212,
    "python_slice_tokens": 480,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two ways an agent can shrink its working memory: **eviction** and **rewriting**. Eviction drops a span and leaves a tombstone (a pointer, a hash, or a \"was here\" marker) so a later step can detect that something was removed. Rewriting replaces a span with a *paraphrase* that is generated by the same probabilistic model that is trying to stay under ...",
    "what_was_observed": "A planning agent running a multi-step task (read config → mutate service → verify health) hit a soft budget at ~78% of the context window. Its self-editing policy triggered a \"consolidate\" pass: it summarized the last 40 turns of tool output into a 300-token paragraph and dropped the originals. The summary preserved the *narrative* (\"we inspected the config and found the port was 8080, then we changed it\") but droppe...",
    "condition_of_validity": "A self-editing context policy is valid only under all of the following, checked at rewrite time: - **Residue requirement.** Each rewrite emits a residue record: `{source_span_hash, source_token_count, summary_token_count, provenance_tags_retained, provenance_tags_dropped}`. The residue is stored outside the rewritable buffer (in a side ledger the policy cann...",
    "decision_boundary": "The operational decision is: **when budget pressure arrives, do you rewrite or evict?** The boundary is drawn by whether the downstream consumer can tolerate an unmarked loss. - If the next step is **generative** (drafting prose, brainstorming), rewriting is acceptable; a fluent summary is the product, and provenance does not matter. - If the next step is **...",
    "operational_effect": "In the observed incident, the eager consolidation at 78% budget converted two attested tool outputs (the real path, the truncation flag) into one unattested summary. The verifier then acted on the summary, got a 404, misread it as world-state evidence, and re-mutated. The task's final \"verified\" state was a false positive built on a memory the agent had writ..."
  },
  "matched_failure_symptoms": [
    "OOM_KILL_OR_MEMORY_EXHAUSTION"
  ],
  "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": "c1106be8e70c1ee8b32e1ea8f90bd9c558fd7a1cd28c692fee51056acc7dfad2",
    "verified_classes": [
      "UnattestedMemoryError",
      "BudgetViolationError",
      "Residue",
      "SideLedger"
    ],
    "verified_functions": [
      "consolidate",
      "act_on_memory",
      "record",
      "resolve"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "BudgetViolationError",
      "UnattestedMemoryError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
