← All papers  /  Oct 15, 2026
Agents · Memory

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

First page
Librarian Agents: Training LLMs to Curate Long-Context Workspaces that Anticipate Future Queries
The curator’s take

Anikait Singh, Aviral Kumar, Chelsea Finn and colleagues at Stanford train a builder agent with RL to reorganize raw documents into a filesystem workspace ahead of time, so a separate answering agent can resolve future queries faster and more accurately.

Ask this paper

Key points
01

Asymmetry. Agents in harnesses like Claude Code navigate existing filesystems well but are rarely trained to build reusable workspaces for later use.

02

Method. A builder agent turns raw documents into a hierarchy of synthetic files and reference links. Construction is framed as an MDP and the builder is trained with RL on downstream answering accuracy.

03

BrowseComp-Plus. Librarian Agents beats the strongest retrieval and precomputation baselines by 33 percentage points.

04

Transfer. Zero-shot on unseen BRIGHT domains, average accuracy improves by 31 points.

05

Cost. The upfront construction cost is amortized across repeated queries over the same corpus.

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.

Every Monday
Get next week’s papers.
Subscribe on Substack