TL;DR
Talking to an AI agent over weeks or months usually reveals a glaring flaw: its memory is either a messy pile of isolated sticky notes or an overwritten whiteboard that forgets why it changed its mind. TrajWiki gives conversational agents a structured, "git-commit-style" history of how facts evolve, compiled into an interlinked personal Wikipedia. The result is an agent that remembers long-term context better, catches contradictions, and lets you audit the exact conversation turns behind every belief.
What Problem Does This Paper Address?
Large Language Models (LLMs) have finite context windows—you can’t just paste six months of chat logs into every prompt without breaking the bank and confusing the model. To fix this, engineers give agents external memory using Retrieval-Augmented Generation (RAG): the system summarizes chats into notes and fetches relevant ones later.
However, conventional agent memory hits two walls in long-term conversations:
- Amnesia of evolution: Most systems overwrite old facts when things change. If you tell an agent you’re vegan in January, and in May say you eat fish now, standard memory just overwrites "vegan" with "pescatarian." It loses the timeline, the provenance (which exact message triggered the update), and the ability to answer temporal questions.
- Retrieval fragmentation: As thousands of tiny memory notes pile up, flat similarity search breaks down. Asking a complex question that spans multiple sessions ("How have my dietary habits and workout routines changed since my knee injury?") requires piecing together scattered fragments that standard search misses.
Methods
Instead of treating memories as static database rows, TrajWiki separates memory into three distinct layers: evolution, organization, and hierarchical retrieval.
- Provenance-Aware Memory Trajectories: Every dialogue exchange is turned into an immutable "snapshot" linked to the raw messages. Related snapshots are chained into append-only trajectories (capped at length $m=15$). Instead of deleting outdated info, TrajWiki applies explicit operations—
ADD,REVISE, andDEPRECATE—preserving the entire evolutionary path of a belief. - Persistent Memory Wiki: To prevent trajectories from becoming a fragmented mess, an intermediate layer compiles them into structured, interlinked Wiki pages (
index,entity,topic, andinventorypages for countable lists). Crucially, Wiki summaries don't replace the raw facts; they act as a semantic map pointing back to the underlying trajectories. - Hierarchical Retrieval & Grounded Synthesis: At query time, the agent doesn't search raw chat logs. It routes the query to the top-$t$ Wiki pages, follows their links to gather candidate trajectories, selects the best top-$k$ trajectories (balancing relevance, diversity, and non-redundancy), and unpacks them right down to the original timestamps and messages to generate a strictly source-grounded answer.
Datasets
The authors evaluate TrajWiki (without training any new models) across open-source (Qwen3-8B, Qwen3-32B) and closed-source (GPT-4o-mini) backbones on two existing benchmarks:
- LoCoMo: An open-domain, very long-term conversational QA benchmark testing single-hop, multi-hop (cross-session), temporal, and world-knowledge reasoning.
- MedMT-Bench: A high-stakes, multi-turn medical dialogue benchmark used here as a stress test. The authors evaluate subsets testing Long-Context Memory (LCMU), Resistance to Contextual Interference (RCI), and Information Contradiction (IC)—catching conflicts between patient history and new statements.
Key Insights and Ideas
- Summaries are great maps, terrible destinations: In ablation studies, relying only on the Wiki summaries yielded
0.000gold-source reference coverage. Summaries lose granular details, proving that the Wiki must serve as a router to raw evidence rather than a replacement for it. - Wiki routing drastically shrinks the search haystack: Searching trajectories directly without the Wiki layer forces the system to sift through 2.35× more candidates (130.4 vs. 55.6 on average) while dropping gold-reference coverage from 61.0% to 35.6%. Structure beats brute-force search.
- Gradual evolution doesn't mean semantic drift: Analyzing embeddings along trajectories showed that while long trajectories naturally cover a wider topic span from start to finish, adjacent updates remain tightly coherent—meaning the system tracks smooth narrative evolution rather than randomly gluing facts together.
Key Results
TrajWiki consistently outperforms strong baselines—including Full Context, Naive RAG, LangMem, A-MEM, and Mem0—across backbones:
- Multi-Hop Mastery: On LoCoMo with
GPT-4o-mini, TrajWiki achieves 59.44% accuracy on multi-hop questions, leaping nearly 20 percentage points ahead of the strongest memory baseline, Mem0 (40.07%), and beating Full Context (32.98%). - Catching Contradictions: On MedMT-Bench's Information Contradiction test (
GPT-4o-mini), where baselines crumble (Full Context hits just 7.47%, Mem0 hits 12.17%), TrajWiki reaches 17.68% pass accuracy. WithQwen3-32B, it leads all three medical subsets (33.42% LCMU, 27.33% RCI, 15.34% IC). - Compact Auditing: In a preliminary 24-case human audit, TrajWiki's diagnostic packets required 4.51× fewer tokens to inspect than full dialogues (5.93K vs. 26.74K) while helping auditors better localize where pipeline failures occurred.
Limitations and Future Work
- Upfront Token Tax: Building trajectories and maintaining a Wiki isn't cheap. Out of 43.28M deployment tokens used in the LoCoMo run, 23.71M went into memory construction (vs. just 6.92M for answering). While this cost amortizes over many future queries, it is heavy upfront.
- Fragility to Bad Formatting: Because the pipeline relies heavily on structured LLM outputs to manage edits and Wiki links, smaller or less compliant models can trigger expensive repair fallbacks.
- The "Telephone Game" Effect: Repeated summarization can dull the salience of specific facts. A diagnostic funnel on 200 queries showed that while 100% of gold evidence entered raw memory and ~62% survived retrieval, only 33.6% made it into the final cited answer support—highlighting a clear bottleneck in how LLMs synthesize retrieved evidence. Future work is not explicitly detailed beyond positioning evolving, source-grounded structures as a foundation for more reliable long-term agents.
Summary updated