R230 · Agent architecture › Memory and context

GrepMem: keep summarising, but let the agent grep the verbatim log

Read the original

Authors Pascal Biese (shared)

memorycontext-managementretrievalpaper

· Source: Ziyan Yang, Taiwei Shi, Jieyu Zhao (University of Southern California), Forget Freely, Grep Later: Lossless, Index-Free Memory for Long-Horizon LLM Agents, arXiv:2611.25123, 18 Nov 2026. Surfaced by Pascal Biese (LLM Watch).

The short version

When a long-running agent fills its context window, the usual fixes are summarisation, masking old tool outputs, or a structured memory store. Each decides in advance what to keep, and anything it drops is gone. GrepMem keeps summarising to hold working context small, but first appends every message and tool output, verbatim, to a plain-text log. The agent gets one extra tool, regular-expression search over that log, and can pull back an exact value whenever it needs one. No embeddings, no retrieval index, no memory-extraction step and no second model are involved.

Results, with Qwen3.5-9B trained by reinforcement learning under five context-management strategies:

How it works

  1. Append-only log. Every turn (user message, model output, tool call and tool result) is written to a text file before anything is compressed.

  2. Normal context management. When the window fills, the agent summarises as usual. The summary is the working memory, and the log is the archive.

  3. Grep as a tool. After the first summary, the agent can call a regex search over the log and get matching lines, with surrounding context, back into the window.

  4. Trained to use it. The model is RL-trained with the tool available, so it learns when a detail is missing from the summary and worth looking up.

Compare lossy memory, which decides what matters at write time, with GrepMem, which keeps everything and decides at read time. That is the old log-structured storage argument: append cheaply, query later.

Why it matters

Tradeoffs and limits

Failure modes to watch

Review checklist

Cited in field guides

Connections

See R230 on the knowledge map

Part of the Research notes on nowucca.com. Figures and claims are the source's own unless the summary says otherwise.