Why the Simplest Search Tool is the Ultimate AI Memory
Original paper: Forget Freely, Grep Later: Lossless, Index-Free Memory for Long-Horizon LLM Agents
"Imagine a busy restaurant kitchen with a single, endless scroll of paper where every single order is written down chronologically in plain ink. When a customer asks about a past modification, the chef simply runs a finger down the paper to spot the exact detail, completely bypassing the need for a filing cabinet or a complicated memory system."
Current AI assistants are limited by short memories and expensive, error-prone data retrieval systems that lose crucial details over long tasks. This breakthrough proves that raw, uncompressed text logs paired with basic search tools outperform complex AI memory architectures, drastically cutting infrastructure costs while making long-horizon AI agents reliably accurate.
- AI agents usually struggle by forgetting important details during long tasks.
- A new method called GrepMem uses a plain-text log and basic search instead.
- It beats complex memory systems while being radically simpler and cheaper.
📑 Original arXiv Technical Abstract
Long-horizon LLM agents often exceed their context windows, forcing them to discard information that may be needed later. Existing context management strategies rely on summarization, masking, or structured memory, requiring decisions about what to preserve or how to retrieve it before future needs are known. However, these methods can introduce lossy compression, potentially discarding details needed for future tasks. To address this limitation, we introduce GrepMem, a simple, lossless, and index-free memory mechanism built on two components: an append-only plain-text log of the agent's complete history and a regular-expression search tool for on-demand recall. Unlike structured memory systems, GrepMem requires no embeddings, retrieval index, memory extraction, or additional models. We train Qwen3.5-9B with reinforcement learning under five context management strategies and evaluate on multi-question research sessions, long-stream recall, and agent-trajectory question answering. GrepMem achieves 95-97% accuracy on ContextBench, versus at most 21% for lossy baselines, and outperforms SUPO's summarization by 8.8 percentage points on BCP-Multi. GrepMem scales effectively to increasingly long input streams while remaining on the accuracy-token-cost Pareto frontier across all five evaluation tasks. Our results show that a plain-text log and grep provide a simple but competitive approach to long-horizon agent memory, without requiring complex structured memory infrastructure.
✍️ Are you an author of this paper? Add code/demo links or a note
Help readers explore your work — share your official GitHub repo, Hugging Face weights, affiliation, or a clarification note for our editorial review queue.