MemCode: Discrete Semantic Representations for Long-Term Agent Memory

Xin Li, Liang Hu, Duoqian Miao, Ming Peng, Qi Zhang
10/14/2026
cs.AI

No confident code implementation found for this paper.

Abstract

Long-term memory remains a fundamental bottleneck for large language model (LLM) agents across sessions. Existing systems typically adopt a write-then-retrieve paradigm, storing context-dependent dialogue fragments and retrieving them via nearest-neighbor search in a continuous embedding space.

Show full abstract

This design yields unstable access units and systematically misses logically related but lexically distant evidence. We propose MemCode, a long-term agent memory framework that couples retrieval-oriented writing with discrete associative retrieval. MemCode rewrites dialogue into self-contained atomic memory units (AMUs), maps AMUs into a learnable codebook with isomorphic semantic quantization (ISQ), and uses codebook co-occurrence topology as a retrieval path complementary to vector search. For long-term memory stores, MemCode separates online atomic writes from asynchronous offline consolidation. On LongMemEval-S and LoCoMo with GPT-4o-mini and Qwen3-30B-A3B-Instruct-2507 backbones, MemCode achieves the best overall accuracy while keeping per-dialogue memory construction within roughly 40~130 seconds, making it 3~21 times faster than LightMem and over an order of magnitude faster than A-MEM and MemoryOS.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{li2026memcode,
  title  = {MemCode: Discrete Semantic Representations for Long-Term Agent Memory},
  author = {Xin Li and Liang Hu and Duoqian Miao and Ming Peng and Qi Zhang},
  year   = {2026},
  eprint = {2610.19472},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2610.19472v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2610.19472.svg)](https://codeofpaper.com/paper/2610.19472)

Discussion