Don't lose the thread: letting long-horizon agents manage their own working memory
CORAL gives an LLM agent tools to checkpoint its plan and verified facts and to reset its context mid-task, then trains that checkpointing with multi-episode RL. On GAIA, an 8B agent more than doubles its ReAct accuracy while reading about 87% fewer input tokens.

Anyone who has run a ReAct-style agent on a task that takes forty tool calls has watched the same failure. The early plan is sensible. Twenty search results later, it sits under thousands of tokens of page dumps, dead ends and half-finished reasoning. The information is still in the window, but the model can no longer find it, so it re-searches things it already knows or holds on to a wrong premise it can no longer see.
A new paper from CUHK, Tencent and HKUST, Don't Lose the Thread: Empowering Long-Horizon LLM Agents with Cognitive Resource Self-Allocation (Zhu et al., October 2026), treats this as a working-memory problem and gives the agent the tools to fix it itself. The method is called CORAL. The headline result is the one I care about most: on GAIA, the trained 8B agent is more than twice as accurate as its ReAct baseline while reading about 87% fewer input tokens.
Two tools, one decision
CORAL adds two tools to the usual web search and web browse.
- Memory Management (MM) writes to a persistent store with two sections: task progress (the plan, with each sub-goal marked pending or complete) and verified facts (entities and intermediate results the agent has confirmed).
- Context Optimization (CO) is a hard reset. The history is cleared, and the next episode starts from the system prompt, the original question and the current memory.
The important design choice is who decides when to call these tools. Most context-management schemes I have seen in production use a fixed rule: summarise every N turns, or truncate when the window is 80% full. CORAL lets the agent decide, which turns checkpointing into a learnable skill rather than a heuristic.

One long trajectory becomes a sequence of short episodes. The only state that crosses an episode boundary is what the agent chose to write down.
Training the habit
Prompting alone works on a strong model: with Claude Sonnet 4, prompting-only CORAL reaches 65.0% on GAIA against 60.2% for plain ReAct. On Qwen3-8B it barely helps (19.4% to 20.4%), because the small model often breaks the JSON format once it has four tools instead of two. So the authors train it in two stages.
Supervised fine-tuning on split episodes. Claude Sonnet 4, given the CORAL tools, generated 2,932 web trajectories on questions synthesised with WebShaper. Each trajectory is cut at its CO calls, and each episode becomes its own training conversation, so the model learns from exactly the context it will see at inference: system, question and memory, not a truncated history.
The data ablations need careful reading. The SFT set keeps the 44% of trajectories that reached a wrong answer. Dropping them leaves 2,030 conversations instead of 3,682 and lowers accuracy from 41.6% to 39.3%, but that comparison changes quality and volume at once. The volume-matched control answers a narrower question: at 2,030 conversations, correct-only data beats a uniform random subsample (39.3% vs 36.5%), so correct trajectories are better examples one for one. The extra 2.3 points from the full set come with 1,652 more conversations, so the ablation does not separate the value of failed runs from the value of more data. My reading is that a run that plans and checkpoints well before slipping on the last hop still demonstrates the skill, but that remains an interpretation. Separately, 241 out-of-domain math trajectories were worth 1.7 points.
Multi-episode ARPO. Standard agentic RL assumes one episode per trajectory, but here the reward only exists in the final episode. The fix is simple: copy the trajectory's reward back to every earlier episode, pool all episodes for the same question, and normalise advantages across that pool.

This is coarse credit assignment, since every episode in a successful run gets the same credit. But it is enough to make the decision to checkpoint something the model can be rewarded for.
What the numbers say
On GAIA (103 text-only questions, 8 samples each), Qwen3-8B goes from 19.4% (ReAct) to 41.6% with SFT and 42.8% with RL. CK-Pro-8B averages slightly higher at 43.7%, but its lead comes entirely from Level 1. CORAL leads on Level 2 (45.7% vs 42.3%) and is far ahead on Level 3 (19.8% vs 8.3%). Keeping a memory has overhead that does not pay off on short tasks and pays off clearly on long ones.
The RL stage adds only 1.2 points to the average, but run-to-run standard deviation falls from 3.5% to 1.9%. In production I would value that more than the average.
| Per trajectory (GAIA, Qwen3-8B) | ReAct | CORAL RL |
|---|---|---|
| Input tokens | 1,078K | 136K |
| LLM calls | 45.3 | 15.2 |
| Peak context | 30.6K | 12.7K |
| Accuracy | 19.4% | 42.8% |
Two effects combine. A ReAct loop re-reads its entire history every turn, so its cost grows roughly quadratically with turns, and capping peak context targets that directly. The larger saving is less obvious: an agent that has written down its plan and verified facts stops re-searching them, which cuts the number of calls by about a factor of three.
On BrowseComp (first 150 questions, Claude Sonnet 4), CORAL scores 30.7% against ReAct's 22.7% with no training at all.
The counter-intuitive finding
If CO is the mechanism, you would expect the trained agent to reset often. It does the opposite. The prompting-only agent calls CO 4.3 times per trajectory; after SFT and RL, only 0.21 times, while still calling MM about four times.
The authors' reading, which I agree with, is that training teaches the agent to checkpoint well rather than to reset often. If memory holds the right state, clutter never builds to the point where a reset is needed. Resets also discard the history that would let the agent revisit an earlier mistake. Failing trajectories call CO about twice as often as successful ones in every configuration, which suggests frequent resets accompany struggling runs rather than rescue them.
What I would take into production
- Structure the memory. Task progress plus verified facts is more useful than a free-text summary. The plan tells the agent where it is; the facts tell it what it no longer needs to look up.
- Let the model decide when to compress, and train that decision. A fixed schedule is easier to build, but it compresses at the wrong moments.
- Train on the episode the model will actually see. If your agent resets context at inference, your fine-tuning data has to be split at the same boundaries.
- Test the reset rate as a candidate health signal. The paper shows a correlation between frequent resets and failure, not that reset rate predicts failure early enough to act on. That is a hypothesis worth checking against your own traces before wiring it into alerting.
The limitations to keep in mind are that the smallest models depend on fine-tuning, and the shared-reward RL is blunt credit assignment. The broader point holds: for long-horizon agents, managing attention well does not cost accuracy. In these experiments it is where much of the accuracy comes from, and it makes each run cheaper.