MemFolder: Structure-Guided Memory Folding for Efficient Agent Memory Management
Organizations: Sichuan University · Fudan University · Sun Yat-sen University · Zhejiang University ·
Abstract
Long-term agents accumulate large external memory stores as interactions unfold, increasing the costs of storage, retrieval, and response generation. Efficiency is constrained by two coupled factors: a growing record count increases retrieval overhead, while longer retrieved contexts increase prefill computation and decoding-time attention costs. Existing methods prune or consolidate records, but pruning can discard useful evidence, whereas consolidation may produce fewer yet longer retrieval units. We introduce MemFolder, a structure-guided memory folding framework that sequentially reduces record count and context length. The framework comprises two core components that share memory groups, using cross-record structure to guide both evidence consolidation and compact representation. RecordFolder grounds entity mentions, progressively selects representative yet complementary anchors, and combines semantic and entity affinity with temporal chaining to consolidate compatible records into fewer retrieval units. ContextFolder encodes the original records within these groups into compact text and uses verification feedback to revise encodings when key facts cannot be recovered. Experiments on the three text-based memory benchmarks LoCoMo, PersonaMem, and LongMemEval and the two multimodal benchmarks M3-Bench-web and M3-Bench-robot demonstrate the strong performance of our methods. Notably, on Mem0, RecordFolder retains 99.0% of the original average performance across the three text-based benchmarks with 50% fewer records, exceeding the strongest baseline by 1.9 percentage points in performance retention. Combined with ContextFolder, existing record compression methods further shorten their output records while retaining most of their performance.
Figures & tables
| Method | LoCoMo | LongMemEval | Persona -Mem | Avg. | % | ||||||||||
| SH | MH | TR | OD | All | SU | SA | SP | MS | KU | TR | All | ||||
| Mem0 | 66.0 | 56.0 | 53.9 | 42.7 | 60.2 | 90.0 | 21.4 | 23.3 | 54.9 | 79.5 | 44.4 | 55.2 | 67.9 | 61.1 | 100.0 |
| Record-count reduction: | |||||||||||||||
| + Random Pruning | 55.3 | 49.7 | 43.3 | 39.6 | 50.8 | 82.9 | 17.9 | 26.7 | 51.9 | 73.1 | 39.1 | 50.8 | 64.5 | 55.4 | 90.7 |
| + KMeans | 61.1 | 54.3 | 52.7 | 40.6 | 56.8 | 84.3 | 17.9 | 20.0 | 51.9 | 75.6 | 41.4 | 52.0 | 65.7 | 58.2 | 95.3 |
| + DART | 64.1 | 53.9 | 48.0 | 40.6 | 57.4 | 82.9 | 19.0 | 20.0 | 48.9 | 74.4 | 34.6 | 48.8 | 66.6 | 57.6 | 94.3 |
| Method | LoCoMo | LongMemEval | Persona -Mem | Avg. | % | ||||||||||
| SH | MH | TR | OD | All | SU | SA | SP | MS | KU | TR | All | ||||
| MemOS | 84.5 | 70.2 | 78.8 | 56.2 | 79.0 | 91.4 | 100.0 | 66.7 | 55.6 | 78.2 | 71.4 | 74.0 | 60.3 | 71.1 | 100.0 |
| Record compression ratio | |||||||||||||||
| + Random Pruning | 70.5 | 65.2 | 57.3 | 46.9 | 65.3 | 67.1 | 64.3 | 63.3 | 28.6 | 52.6 | 43.6 | 47.8 | 55.9 | 56.3 | 79.2 |
| + KMeans | 75.7 | 59.2 | 57.6 | 57.3 | 67.8 | 72.9 | 69.6 | 66.7 | 20.3 | 51.3 | 45.9 | 47.6 | 54.7 | 56.7 | 79.7 |
| + DART | 76.5 | 68.1 | 58.9 | 58.3 | 70.1 | 62.9 | 82.1 | 50.0 | 20.3 | 35.9 | 33.1 | 40.8 | 53.7 | 54.9 | 77.2 |
| Method | M3-Bench-robot | M3-Bench-web | Avg. | % | ||||||||||
| ME | MH | CM | PU | GK | All | ME | MH | CM | PU | GK | All | |||
| M3-Agent | 30.9 | 29.4 | 29.6 | 41.1 | 22.6 | 30.3 | 44.9 | 25.6 | 44.8 | 58.6 | 53.7 | 47.9 | 39.1 | 100.0 |
| Record compression ratio | ||||||||||||||
| + Random Pruning | 28.4 | 25.9 | 27.3 | 38.7 | 19.6 | 28.1 | 35.6 | 23.0 | 34.9 | 52.3 | 44.2 | 41.2 | 34.7 | 88.7 |
| + KMeans | 29.1 | 30.6 | 28.4 | 41.4 | 20.8 | 29.2 | 41.1 | 21.7 | 42.5 | 55.0 | 47.4 | 43.9 | 36.6 | 93.6 |
| + DART | 28.9 | 25.9 | 29.4 | 39.1 | 22.0 | 29.1 | 39.9 | 23.6 | 39.4 | 52.9 | 47.2 | 43.1 | 36.1 | 92.3 |
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
| # | Record | Tokens |
| 1 | User appreciates having people around who accept and support them | 11 |
| 2 | User appreciates their support network for love, guidance, and acceptance | 13 |
| 3 | User appreciates support and is grateful for sharing their journey and helping others | 14 |
| 4 | User appreciates the support of those close to them | 10 |
| # | Record |
| 1 | Volunteering is an important part of Caroline’s life |
| 2 | Caroline is carrying on volunteering at the youth center |
| 3 | Volunteering at the youth center is an important part of Caroline’s life |
| 4 | Caroline wants to keep making a difference |
| 5 | Caroline is carrying on volunteering at the youth center |
| 6 | Caroline wants to keep making a difference |
| # | Record | Date |
| 1 | Cares about mental health | 27 Jun 2023 |
| 2 | User is keen on counseling or working in mental health | 27 Jun 2023 |
| 3 | Values counseling and support groups | 27 Jun 2023 |
| 4 | Thinking about taking care of mental health | 25 May 2023 |
| 5 | Values taking care of mental health | 25 May 2023 |
| 6 | Interested in counseling and mental health | 3 Jul 2023 |
| # | Fact (level) | Question expected answer |
| 1 | Cares about mental health (high) | What does the user care about? Mental health |
| 2 | Keen on counseling or working in mental health (high) | Interest regarding career? Counseling or mental health work |
| 3 | Values counseling and support groups (med) | What does the user value? Counseling and support groups |
| 4 | Looking into counseling and mental health jobs (high) | Currently exploring? Counseling and mental health jobs |
| 5 | Started looking into these options to help others (med) | Why? To help others |
| 6 | Values sharing stories and giving others hope (med) | Values in support? Sharing stories, giving hope |
Agent Memory Management
Agent memory management studies how AI agents store, update, retrieve, compress, and forget information across long-running tasks.
See all 459 papers