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.
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.
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.
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.
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."
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.
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".
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.
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.).