Contextual Memory Virtualisation: DAG-Based State Management and Structurally Lossless Trimming for LLM Agents
On the map: LLM reasoning → Reasoning for agents, planning and code
also in 1 more
Abstract (arXiv)
As large language models engage in extended reasoning tasks, they accumulate significant state -- architectural mappings, trade-off decisions, codebase conventions -- within the context window. This understanding is lost when sessions reach context limits and undergo lossy compaction. We propose Contextual Memory Virtualisation (CMV), a system that treats accumulated LLM understanding as version-controlled state. Borrowing from operating system virtual memory, CMV models session history as a Directed Acyclic Graph (DAG) with formally defined snapshot, branch, and trim primitives that enable context reuse across independent parallel sessions. We introduce a three-pass structurally lossless trimming algorithm that preserves every user message and assistant response verbatim while reducing token counts by a mean of 20% and up to 86% for sessions with significant overhead by stripping mechanical bloat such as raw tool outputs, base64 images, and metadata. A single-user case-study evaluation across 76 real-world coding sessions demonstrates that trimming remains economically viable under prompt caching, with the strongest gains in mixed tool-use sessions, which average 39% reduction and reach break-even within 10 turns. A reference implementation is available at https://github.com/CosmoNaught/claude-code-cmv.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Placed in Reasoning for agents, planning and code, one of 17 directions in LLM reasoning. Builds on 8 of its 10 references that are in the map. First posted on arXiv 25 Feb 2026.
Builds on
8 of 10 references.
References · 8
- 2017Attention Is All You Needcited by 59,932
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,160
- 2023MemGPT: Towards LLMs as Operating Systemscited by 1,295
- 2023LongLLMLingua: Accelerating and Enhancing LLMs in Long Context Scenarios via Prompt Compressioncited by 443
- 2023Adapting Language Models to Compress Contextscited by 350
- 2023RECOMP: Improving Retrieval-Augmented LMs with Compression and Selective Augmentationcited by 253
- 2023In-context Autoencoder for Context Compression in a Large Language Modelcited by 190
- 2024AIOS: LLM Agent Operating Systemcited by 94
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2026Persistent Context Graphs for Efficient Memory Compaction in LLM Agents
- 2026TokenPilot: Cache-Efficient Context Management for LLM Agents
- 2026Shared Selective Persistent Memory for Agentic LLM Systems
- 2026LLM Agents Are Latent Context Managers: Eliciting Self-Managed Context via State Proprioception
- 2026Akashic: A Low-Overhead LLM Inference Service with MemAttention
- 2026ContextWeaver: Selective and Dependency-Structured Memory Construction for LLM Agents
- 2026Memory as Infrastructure: Reliability Engineering for Persistent Agent Memory in Months-Long LLM-Assisted Development
- 2026Multi-Head Recurrent Memory Agents