AI Agents Use Filesystems to Improve Context
November 21, 2025 · 2 min read
AI agents often struggle with performance issues not due to model limitations but because they lack the right context at the right time, a problem that can inflate operational costs and reduce effectiveness.
Context engineering, the process of selecting and providing necessary information for AI agents, is critical for reliability, but it frequently fails when agents retrieve too much or too little data, leading to inefficiencies.
To address this, the authors propose using filesystem tools that allow agents to read, write, edit, list, and search files, providing a flexible interface for storing and accessing unlimited context dynamically.
In one example, when an agent performs a web search and receives 10,000 tokens of raw content, storing this in conversation history increases costs, but offloading it to the filesystem enables selective retrieval using grep searches for relevant keywords.
This also helps when agents need large amounts of context that exceed typical window limits, as filesystems allow dynamic storage and pulling of information as required for specific tasks.
For finding niche information, semantic search can be ineffective with technical documents, but filesystem tools like ls, glob, and grep offer precise alternatives, as seen in tools like Claude Code that rely on these for accurate context retrieval.
Additionally, agents can use filesystems to learn over time by storing and updating their own instructions based on user feedback, such as remembering user preferences, though this remains an emerging pattern not fully solved.
The authors acknowledge limitations, noting that while filesystems enhance context management, semantic search can still be useful in combination, and the approach is implemented in their open-source DeepAgents repository for further experimentation.