Librarian Agents: Training LLMs to Curate Long-Context Workspaces that Anticipate Future Queries

Anikait Singh, Teresa Zhang, Yoonho Lee, Roshen Sanjay Nair, Aviral Kumar, Chelsea Finn

Stanford University · Carnegie Mellon University

Published October 15, 2026 · on the feed October 19, 2026 · ▲ 10 · arXiv 2610.22273

AgentsRetrieval, memory & searchLLM training & RL Full code arXiv ↗Hugging Face ↗

The abstract

Reasoning over long document contexts remains a challenge for large language models (LLMs). Standard retrieval methods are inherently reactive, bottlenecking agents with complex, cross-document reasoning at inference time, while precomputed structures like knowledge graphs often fall short because they rely on rigid heuristics. Instead, can we allow agents to perform anticipatory directed curation: learning to proactively reorganize unstructured corpora prior to inference to efficiently serve diverse future queries. We build on a key asymmetry in modern agentic harnesses (e.g., Claude Code): while LLM agents are adept at navigating existing filesystems to solve an immediate task, they are rarely trained to construct reusable workspaces for future use. To instantiate this capability, we introduce Librarian Agents, a framework in which a builder agent transforms raw documents into a hierarchical filesystem of synthetic files and reference links, which forms a workspace tailored for a downstream answering agent. We formulate workspace construction as a Markov decision process and optimize the builder policy via reinforcement learning to directly maximize downstream answering accuracy. Empirically, Librarian Agents outperforms the strongest retrieval and precomputation baselines by 33 percentage points on BrowseComp-Plus, amortizes upfront construction costs across repeated queries, and generalizes zero-shot to unseen domains on BRIGHT with a 31-point average accuracy improvement.

The Brief

2:37

A short podcast summary of the paper. Written and voiced by AI.

Transcript

Librarian Agents. Training LLMs to Curate Long-Context Workspaces that Anticipate Future Queries. By Anikait Singh and five others, from Stanford University and Carnegie Mellon University. Published on the fifteenth of October. Its code repository is worked out: about sixty source files, with a readme and a licence.

Reasoning over long document contexts is still hard for large language models. Standard retrieval is reactive. It waits for a question, and then leaves the agent to do complex reasoning across documents at inference time, which is exactly where the bottleneck sits. Precomputed structures such as knowledge graphs do their preparation ahead of time, but they often fall short, because they rely on rigid heuristics. So there are two failure modes on either side. One does all its thinking too late, under pressure, for each question separately. The other thinks early but by fixed rule, without learning what the questions will actually need.

The proposal is anticipatory directed curation. Instead of waiting, an agent learns to reorganise an unstructured corpus before inference, so that the result efficiently serves many different future queries. The authors build on an asymmetry in modern agentic harnesses such as Claude Code. Agents are adept at navigating a filesystem that already exists, to solve the task in front of them. They are rarely trained to construct a workspace meant to be reused later. Using a well-organised workspace is a skill these agents already have. Building one for someone else is the skill this work sets out to train.

Librarian Agents splits the job between two roles. A builder agent transforms raw documents into a hierarchical filesystem of synthetic files and reference links. That filesystem is a workspace tailored to a second agent, the one that answers questions downstream. Building the workspace is formulated as a Markov decision process, and the builder's policy is optimised with reinforcement learning to directly maximise the answering agent's accuracy. The builder is judged only by how well someone else can use what it built.

On BrowseComp-Plus, Librarian Agents beats the strongest retrieval and precomputation baselines by thirty-three percentage points. The upfront cost of construction is amortised across repeated queries. And the approach generalises zero-shot to unseen domains on BRIGHT, with an average accuracy improvement of thirty-one points. The three results answer three different worries. The first is whether curation helps at all. The second is whether its upfront cost is repaid, and it is, once queries repeat. The third is whether a builder trained on one kind of corpus can organise another.

The name carries the idea. The work happens before anyone asks: sorting, filing, linking one document to another. And the only measure of that work is whether the reader who comes later finds the answer.

More with an account

Listen to every day’s papers

Daily playlists, deep dives, quests for the papers, and quizzes on their key terms.

Join free
KipQuest: the day’s AI research, as podcasts and quests. All papers Android app Privacy Contact Episodes are written and voiced by AI from each paper. Summaries can contain mistakes: the paper is the source.