Long-term agent memory can be folded: half the records, 99.0% of Mem0's average performance kept
Synopsis
Long-running AI agents store interaction history as external memory records, and more records slow retrieval while longer retrieved context makes generation costlier. MemFolder splits compression into two steps: RecordFolder merges related records into fewer retrieval units using entity, semantic and temporal relations, and ContextFolder then rewrites each group as a compact encoding under a token budget, with a blind check on whether key facts survive. On Mem0 with half the records, RecordFolder retains 99.0% of average performance across three text benchmarks, above MemForest's 97.1%; adding ContextFolder cuts tokens per record by a further 40.3% and 37.9% on LoCoMo and LongMemEval.
Interpretation
An agent's external memory can be folded along two axes at once: first fewer retrieval units, then shorter units, instead of choosing between pruning that loses evidence and merging that lengthens units. Earlier post-construction compression either pruned records, possibly discarding useful evidence, or consolidated them into fewer but longer retrieval units; at a fixed top-k retrieval budget, fewer units can still mean a longer context. On Mem0 with 50% fewer records, RecordFolder retains 99.0% of average performance across the three text benchmarks versus 97.1% for MemForest; at 70% reduction the two are 96.6% and 93.3%.
RecordFolder grounds records to entities, progressively picks anchors that are representative yet complementary, refines groups with entity, semantic and temporal relations, and has a model consolidate each group chronologically into one retrieval unit. Anchor selection starts from the density-peak criterion and later anchors are scored by novelty relative to those already chosen; entity similarity is downweighted by how often an entity appears, so rare shared entities link records more than common ones. On LoCoMo and LongMemEval the full model averages 57.2; removing cosine similarity costs 3.4 points, while removing gain gating, entity affinity and temporal chaining costs 1.9, 1.1 and 0.6 points.
ContextFolder reuses the same groups to write the original records as a compact encoding within a budget set as a fraction of source tokens, and a blind reader that never sees the source answers fact questions, with failures sent back for revision. The encoding uses fixed symbols for dates, state changes, attributes, negation and uncertainty; a planner first ranks facts by importance so only required ones must survive, and verification checks recovery from the encoding alone. After record count is halved, ContextFolder cuts tokens per record by a further 40.3% and 37.9% on LoCoMo and LongMemEval; on LongMemEval it reaches 51.8% accuracy at 13.4 tokens per record, versus 45.8% for BabelTele at 17.2.
Perspective
The demonstrated scope is three text memory benchmarks, LoCoMo, PersonaMem and LongMemEval, plus two multimodal benchmarks, M3-Bench-web and M3-Bench-robot, with the compression layer applied to the same uncompressed stores built by Mem0, MemOS and M3-Agent, all averaged over three runs. In multimodal settings record retrieval is only part of the latency, and other processing costs remain.
The blind reader can answer unknown for a fact that is present in the encoding, triggering extra revisions; conversely, an omitted fact that wrongly passes verification leaves information loss undetected. On multimodal benchmarks ContextFolder is not the most accurate option: BabelTele reaches 32.13% on M3-Bench-robot at 30.2 tokens per record, above ContextFolder's 29.47%.
