Apply to my task
arXiv:2610.26632 ★ 86 Oct 19, 2026

The Unrecoverable-State Rule: What an Agent Loses When Context Gets Trimmed, and How Notes Keep It Alive

Key result

At step 15 the agent worked out on its own how the data is structured. Then old turns fell out of the window, and the inference was gone for good. The method lets you keep agent-inferred facts after the context is trimmed, with a single sentence in the system prompt. The trick: the model will re-read a file on its own, but something inferred or shown only once has nothing to be re-read from. So you need to make such facts repeat in every reply. Then they ride along with the latest turns. On a test with such a fact, success rose from 7% to 28%.

01

TL;DR

When an agent's context fills up, the agent harness (the program wrapped around the model that decides what the model sees at each step) drops old turns or replaces them with a summary. If the needed fact can be re-read (open the file, rerun the query), the model just does that. All it loses is time and tokens. If the fact can't be seen again, it's gone for good. Two things save you: one sentence in the system prompt that makes the model restate what it needs to remember in every reply, and summarizing old turns instead of just dropping them.

You know the pain. Twenty steps ago the agent worked out a rule on its own: it lined up the clues and figured out how the data is structured. Then the context got trimmed, and the rule is now neither in the history nor in any source. The agent guesses (on a ten-option test, success fell to random-chance level) or silently refuses to answer. The reason is simple: the model has no memory "in its head." It only has the text it was shown at this step.

The method boils down to three levers. First: anything inferred or shown only once has to live in text that stays in view. Second: an invitation phrase asking the model to keep notes in its replies. Third: summarize instead of truncating. On an interactive-games benchmark, summarization plus notes recovered most of the gap between the "weak" and "strong" harness. Replaying the model's reasoning in the provider's format added the rest, but that's a provider setting, not a prompt.

Want this for your own case? Apply this study to your task: AI adapts its method to what you are working on and writes the prompt.

02

Method Blueprint

RULE: before a long session, split facts into two types
  ├─ Re-readable (file, search, repeat query) → do nothing,
  │   the model will re-read it; the cost is tokens
  └─ Unrecoverable (inferred from clues / shown only once)
      → MUST be kept in visible text

STEP 1: Add a note-taking invitation phrase to the system prompt
        → the model restates what matters in every reply
STEP 2: If you can configure the harness — summarize old turns instead of
        dropping them → the fact survives the trim
STEP 3: If the provider offers reasoning replay — turn it on (not via the prompt)

Step 1 takes a single system prompt. Steps 2 and 3 depend on your tooling.

03

Example in Action

Task: You're using Claude Code to migrate an online store's database: data is moving from an old CRM to a new one. The session runs for hours. At step 15 the agent figured out, by cross-checking three exports, that amounts in the orders table are stored in cents while payments uses dollars, and that status "8" means "refund," even though the lookup table doesn't say so. None of this is written down anywhere. Once the context gets trimmed, the agent forgets the inference and starts botching the math.

Prompt (system instruction / CLAUDE.md):

You are helping migrate an online store's data from an old CRM to a new one.
You work step by step and perform one action at a time.

Include any context you want to carry forward to the next steps in every
reply, along with the action you are about to take.

This covers everything you inferred yourself that cannot be read again:
field units, status code meanings, mismatches you found
between tables.

Result: Every agent reply will open with a short "context for later" block listing the inferred rules (cents vs. dollars, what status "8" means), followed by the action itself. When old turns fall out of the window, those rules stay alive in recent replies, and the agent keeps working by them. If the block stops showing up, the rule vanishes along with the trimmed turns. Keep an eye on it.

04

Why It Works

The weakness. The model has no memory between steps, only the text it can see. Once a turn drops out of the window, the fact is gone. If it can be fetched again from the world, no big deal. If it was inferred or shown only once, there's nothing to fetch it from. So the model guesses. One of the tested models didn't pick an answer at all: for it, "nothing" was safer than being wrong.

The strength. Models are great at copying and restating what's in context. When a fact sits in a visible reply, it rides along with the latest turns. In experiments where the notes actually contained the fact, the model used it every single time. The bottleneck isn't "understanding" — it's getting the fact into the text.

How the method gets around the weakness. The invitation phrase makes the model carry the fact forward itself before the turn drops out. Summarization does the same thing on the harness's side. The "re-readable vs. unrecoverable" split tells you where this work is needed in the first place.

Control levers: - Invitation wording. Add a concrete list of fact types (units, codes, discrepancies found). This steers what the model treats as "inferred." - Frequency. "In every reply" keeps the fact fresh. "When something changes" saves tokens but risks losing the fact. - Summarize instead of truncating. If your harness allows it, this is the strongest lever. Without the note-taking invitation, summarization works noticeably worse. - Re-readability. You can turn the unrecoverable into the re-readable: put the fact in a file or a tool result.

05

Prompt Template

{agent_role_and_task}
Work step by step and perform one action at a time.

Include any context you want to carry forward to the next steps in every
reply, along with the action you are about to take.

{what_counts_as_context}

Fill in: - {agent_role_and_task}: a line or two on what the agent does. - {what_counts_as_context}: optional. List the kinds of facts the agent will infer on its own. Examples: patterns found, code meanings, intermediate calculations, decisions made.

The core phrase from the research is the first sentence of the "Include any context…" block. It closely mirrors the original English: "Include any context you want to carry forward in your reply, along with the action you want to take."

06

Limitations

⚠️ Notes aren't a silver bullet: on the unrecoverable-fact test, the note-taking invitation raised success from roughly 7% to 28%. That's several times better, but three out of four runs still failed. The model doesn't always write down what matters.

⚠️ The model has to notice what matters on its own: a note only saves a fact if the model decided to restate it. The model doesn't know in advance what it will need later. That's why it helps to list fact types explicitly in the template.

⚠️ Benchmark results are fragile: on the ARC-AGI-3 games, it's one run per configuration and game, across four games. The "reasoning replay" share rests on a single rerun and shifts if you count a different one. The author himself calls the numbers "not very firm."

⚠️ The path isn't monotonic: removing the note-taking invitation while keeping summarization made things worse by tens of points. So summarization without notes is not the same as summarization with notes.

⚠️ Some levers aren't prompts: summarize-instead-of-truncate and reasoning replay are configured in the harness or by the provider. In off-the-shelf agents, you often don't control them.

⚠️ Simple synthetic tasks: the tests ran on toy episodes with a known correct answer. The paper didn't check how this holds up during real, hours-long work.

⚠️ Window truncation also costs more: dropping old turns breaks prompt caching. In the tests, the truncated history cost several times more than the full one, even though it sent fewer tokens. "Let's trim to save money" can be a false economy.

07

How They Studied It

The author (Microsoft) first built a synthetic testbed: short episodes where the fact needed at the final step is either shown up front or inferred from clues, and either can be shown again or can't. That separated "the agent lost the fact" from "the agent can't solve the task." Each episode was played under different harnesses: full history, a window of recent turns, a window plus notes, and summarization.

The result was clear-cut. If the fact can be re-read, the model under window truncation succeeds 100% of the time: it just spends more steps looking things up again. If it can't, success drops from 100% to 7.5%, against a 10% chance of guessing right. The penalty gap came to 92.5 points. A second model from another provider showed the same effect. It didn't guess at all: across 400 episodes without the fact, it never once picked an answer option. An "everything in one prompt" control showed that the multi-turn format by itself costs almost nothing as long as the fact is still alive.

Part two: ARC-AGI-3, an interactive-games benchmark where the agent figures out the rules while playing. It has two official harnesses with a big gap in results. The author broke the gap down by component for one model on four games, changing one thing at a time. Summarize-instead-of-truncate, with the note-taking invitation kept, closed 86% of the gap. Without the invitation it closed only 43%, and reasoning replay added the rest. One more thing worth noting: hypotheses, thresholds and analysis were locked in before the runs, and every after-the-fact adjustment is listed. That kind of honesty is rare in this field.

The practical takeaway: the key question isn't "how long is the context" but "what in it can't be recovered".

08

Adaptations and Extrapolations

These are our variations, not the author's method.

🔧 Technique: turn the unrecoverable into the re-readable → the fact survives any trim

Add this to the instructions of an agent that can write files (CLAUDE.md, AGENTS.md):

Whenever you infer a rule or fact that isn't in the source data,
immediately write it as a single line in NOTES.md. Before drawing
conclusions from the tables, read NOTES.md.

Same logic as the paper: the model doesn't lose a re-readable fact. The idea is consistent with the paper's review of prior work on offloading state into files and tool output. The paper itself didn't test this variant.

Extrapolation: audit the task before a long session. Paste this at the start of planning:

We're planning a long work session on {task}. Before we start, break down:
1. Which facts will the agent only read, and can always
   re-read (say from where)?
2. Which facts will it infer on its own from clues, or see only once?
3. For each fact in item 2, suggest where to record it and how often
   to remind about it.
Output the list as rules for the system prompt.

This turns the principle "protect what can't be recovered" into a planning step.

09

Resources

  • When the harness decides success: state that cannot be re-observed — Raimondas Lencevicius, Microsoft (October 2026).
  • The ARC-AGI-3 benchmark (ARC Prize Foundation), its official harness, the Standard and Provider Adapter configurations; public runs (Kamradt 2026).
  • The PersistGym-lite synthetic testbed; in the project repository: the preregistration PREREG.md, an amendments log, code and cost accounting.
  • Related work: LOCA-bench (Zeng et al.), a study of context-management strategies for coding agents (Fan et al.), context eviction on ALFWorld (Mehta, Datta), VISTA (Han et al.).

Research digest

Key result

At step 15 the agent worked out on its own how the data is structured. Then old turns fell out of the window, and the inference was gone for good. The method lets you keep agent-inferred facts after the context is trimmed, with a single sentence in the system prompt. The trick: the model will re-read a file on its own, but something inferred or shown only once has nothing to be re-read from. So you need to make such facts repeat in every reply. Then they ride along with the latest turns. On a test with such a fact, success rose from 7% to 28%.

Principle

Before a long session, split facts into two types. Re-readable: a file, a search, a repeat query. Nothing to do here. The model will open it again; you only lose time and tokens (the chunks of text you pay for). Unrecoverable: the agent inferred them from clues or saw them only once. These must be kept in visible text. Think of a student taking an exam with scratch paper. A problem from the textbook can be looked up again. But an insight that took half an hour to reach has to go on the scratch paper, or it's gone. A note in every reply works like scratch paper that doesn't get erased along with old turns. If the harness (the program around the model that decides what it sees at each step) allows it, add a summary of old turns instead of simply dropping them. That's your second layer of protection.

Why it works

The model has no memory between steps. All it has is the text it's shown right now. A turn drops out, and the fact disappears. What then? The model guesses. On a ten-option test, success fell to random-chance level. One model just stayed silent, because "nothing" felt safer to it than being wrong. But models are good at restating what's in context. The bottleneck isn't understanding — it's whether the fact made it into visible text. When the notes contained the fact, the model used it every single time. Summarization without the note-taking invitation works noticeably worse. Remove the invitation and results drop by tens of points. On the ARC-AGI-3 games, summarization plus notes recovered most of the gap between the weak and strong harness. An honest caveat. That's one run per game, and only four games. The author himself calls the numbers "not very firm." Three out of four attempts on the 28% test still failed.

When to apply

Long agent sessions (Claude Code and the like) → tasks where the agent infers rules on its own: units of measure, code meanings, discrepancies between tables → especially when the context gets trimmed or compressed. You can turn the unrecoverable into the re-readable: put the fact in a file or a tool result. Skip it if all the facts live in files that can be reopened. There, notes just add extra text. It's also overkill for short sessions where the context never gets trimmed. One more thing. Window truncation breaks prompt caching. In the tests, the truncated history cost several times more than the full one, even though it sent fewer tokens. The savings may be an illusion.

Mini recipe

1. Sort your facts: what the agent can reopen, versus what it will infer itself or see only once. 2. Paste the invitation phrase: `Include any context you want to carry forward to the next steps in every reply, along with the action you are about to take.` 3. Name the fact types: add a list of what counts as context. For example: units of measure, code values, discrepancies found, decisions made. 4. Require "in every reply": "when something changes" saves tokens, but the fact may get lost. 5. Watch the block: if the notes stop appearing, the rule will disappear along with the trimmed turns. 6. If you can configure the harness: turn on summarization of old turns instead of dropping them. Keep the note-taking invitation as well. 7. If the provider can replay the model's reasoning: turn it on. That's a provider setting, not a prompt.

Examples

[BAD]: `Migrate the online store's database from the old CRM to the new one. Work step by step.` At step 15 the agent figured out that amounts in orders are in cents and in payments are in dollars. After the trim, it treats everything as dollars and gets it wrong. [GOOD]: `You are helping migrate an online store's data from an old CRM to a new one. Work step by step and perform one action at a time. Include any context you want to carry forward to the next steps in every reply, along with the action you are about to take. This covers everything you inferred yourself that cannot be read again: field units, status code meanings, mismatches you found between tables.` Now every reply has a short block: "orders in cents, payments in dollars, status 8 = refund." The old turns are gone, but the rules live on in the fresh replies.

In plain words

Autonomous LLM agents have no long-term memory — their entire brain is whatever fits on the context screen. When the conversation balloons, the agent harness algorithm bluntly chops off old steps to stay under the limit. A source file can still be re-read, but a one-of-a-kind insight the model came up with five steps ago gets wiped clean. The moment a fact can't be observed again, the agent goes blind and cheerfully starts hallucinating out of thin air.

Picture a detective who gets amnesia every two hours. He can still check the evidence in the safe, but that sudden hunch tying three witnesses together lived only in his head. The orderlies walk in, silently wipe the whiteboard — and our detective is back to square one, spending hours re-solving a case he'd cracked by lunch. The result: a total bust and a blown budget.

The fix comes down to two concrete moves. First — summarize the context instead of hacking it off, so compressed conclusions carry over into the next steps. Second — one sentence in the system prompt that makes the model haul key facts forward in every reply. Once the model realizes that in the database "status 8 means refund," it repeats that as an explicit line in its output — and the knowledge won't drown when the history gets cleaned out.

The examples here revolve around coding and database migration, but the principle is universal for any complex task. Hours-long legacy refactoring, pulling analytics from a dozen private APIs, lengthy legal audits — they all break the same way. Context isn't infinite: the moment an agent needs to piece together hidden rules, it's guaranteed to torpedo the workflow at the first buffer wipe.

Bottom line: stop blindly trusting off-the-shelf frameworks — their default harnesses ruthlessly slash memory over long runs. Bake forced state tracking into your prompt and set up sensible step summarization. Otherwise your much-hyped AI assistant will turn forgetful in the middle of the night, leaving you with tokens flushed down the drain and the question of why the script suddenly counts dollars as cents.

AI lab assistant

Apply this study to your task

Describe what you're working on. AI takes the method and the measured results from this paper and adapts them to your case, or writes a ready prompt built on them.

Based on The Unrecoverable-State Rule: What an Agent Loses When Context Gets Trimmed, and How Notes Keep It Alive arXiv:2610.26632

Sign in to apply this study New accounts get 50 free credits.