Featured

Deploy OpenClaw in 60 seconds β€” 20% off logoDeploy OpenClaw in 60 seconds β€” 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger β†’
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger β†’
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free β†’
Your own AI agent, running 24/7 with QwikClaw logoYour own AI agent, running 24/7 with QwikClaw

QwikClaw sets up and runs an always-on OpenClaw agent for you. One click, no config files, no server setup.

Deploy now β†’
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data β€” no proxies, no parsers, no maintenance.

Start building free β†’
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it β€” secured from day one.

Get it set up for you β†’
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free β†’
Reach 47,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here β†’

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

soolaugust/0CompactMem MCP server](https://glama.ai/mcp/servers/soolaugust/0CompactMem/badges/score.svg)](https://glama.ai/mcp/servers/soolaugust/0CompactMem) 🐍 🏠 🍎 πŸͺŸ 🐧 - Persistent memory MCP server with OS-style demand paging, kswapd-style eviction,...

README.md

<div align="center">

vMem

Virtual memory for LLM context. For Claude Code and every AI agent.

Your AI never forgets β€” no more "context compacted" interruptions.

![Python](https://www.python.org/) ![SQLite](https://sqlite.org/) ![Tests](#testing) ![License](LICENSE) ![Discussions](https://github.com/soolaugust/vMem/discussions)

English Β· δΈ­ζ–‡

</div>

One-line install via Claude Code: `` /install-plugin github:soolaugust/vMem ``

---

The problem: context compaction kills your flow

If you use Claude Code, you know this pain:

⚠️ Auto-compact: conversation is approaching context limit...

Every time this happens, your AI loses track of decisions, constraints, and hard-won context. You re-explain. It re-learns. Hours of accumulated understanding β€” gone in one compaction event.

And if you run multiple agents? They can't share what they've learned. Each one starts from zero.

This isn't a model limitation. It's a missing infrastructure layer.

---

The solution: persistent context that survives compaction

vMem gives your AI agents persistent, retrievable context managed like virtual memory: the context window is the hot working set, and durable knowledge lives outside it until demand-paged back in.

The result: OS-managed context continuity. Your AI retains every decision, constraint, and lesson across sessions, across compactions, across agents.

How it works

You speak
  β†’ vMem retrieves relevant memories β†’ injects into context
  β†’ AI responds with full context
  β†’ Session ends β†’ decisions and insights auto-extracted β†’ persisted
  β†’ Compaction happens? No problem β€” memories survive outside the window
  β†’ Next session starts β†’ working set restored automatically

The whole pipeline runs inside Claude Code hooks. There is no manual memory management.

---

Why "vMem"?

vMem is virtual memory for LLM context: instead of treating the context window as the whole world, it manages a working set with OS primitives.

| What others see | What vMem does | |---|---| | "Context compacted" | Durable knowledge already lives outside the window | | New session starts | Working set auto-restored in <100ms | | Multiple agents running | All share one managed context substrate | | Constraint decided 3 weeks ago | Pinned with mlock-style semantics |

OS-managed context. Durable working sets. No repeated explanation.

---

Under the hood: OS context management for AI

The secret sauce? We didn't invent new algorithms. We borrowed what the Linux kernel has been doing for 40 years:

| OS concept | vMem equivalent | |---|---| | RAM (working space) | Context window β€” what the AI sees right now | | Disk (persistent storage) | Knowledge base β€” facts that survive across sessions | | Demand paging | On-demand retrieval β€” fetch relevant memories at the right moment | | mlock | Hard / soft pinning β€” guarantee a constraint is never evicted | | kswapd watermarks | Capacity-aware eviction under pressure | | CRIU checkpoint / restore | Session snapshots β€” pause and resume seamlessly | | Process scheduling | Multi-agent coordination β€” many agents, one knowledge base | | kworker thread pool | Async extraction β€” I/O off the critical path |

---

How is this different from mem0 / Letta / Zep?

| | vMem | mem0 | Letta (MemGPT) | Zep | |--------------------------|--------------------------|----------------|----------------|----------------| | Design metaphor | OS-managed context | Vector store | Agent runtime | Temporal graph | | Context continuity | βœ… pinned knowledge survives | ❌ | ❌ | ❌ | | Multi-agent shared | βœ… native, single store | ⚠️ via API | βœ… | βœ… | | MCP-native | βœ… first-class | ❌ | ❌ | ❌ | | Single-file deploy | βœ… SQLite, no service | ❌ needs server| ❌ needs server| ❌ needs server| | Demand-paging retrieval | βœ… explicit | implicit | implicit | implicit | | Eviction policy | βœ… kswapd + DAMON | TTL only | recency | recency + decay| | Pin / mlock semantics | βœ… | ❌ | ❌ | ❌ |

TL;DR. If you're tired of context compaction wiping your AI's memory, and you want a solution that's pip install, runs as a sidecar on a laptop, shares between several Claude Code / Cursor / custom agents, and never loses a pinned constraint β€” vMem is built for that.

---

Performance at a glance

| Metric | Value | |---|---| | Retrieval latency (P50, hot path) | ~0.1 ms (540x faster than the 54 ms subprocess baseline) | | Recall@3 vs baseline | +147% | | Cross-session recall | 94.2% | | Token cost per call | ~44 tokens injected, +256 tokens net ROI (avoided re-explanation) | | Test suite | 3,500+ tests across retrieval, eviction, MCP, privacy filter |

---

Quick start

One-line install (recommended).

/install-plugin github:soolaugust/vMem

Manual install.

git clone https://github.com/soolaugust/vMem
cd vMem
pip install -e .
mkdir -p ~/.claude/memory-os

Detailed Claude Code hook configuration, daemon management, and troubleshooting live in docs/SETUP.md.

---

Architecture

Three layers:

  1. Hooks β€” sit at the Claude Code syscall boundary (SessionStart, UserPromptSubmit, Stop, PostToolUse) and call into the store.
  2. Store β€” single SQLite file (WAL mode) with FTS5 full-text index, behind a unified VFS interface (memory_os.store.api / memory_os.store.vfs / memory_os.store.criu).
  3. Daemons & IPC β€” persistent retriever daemon (Unix socket), async extractor pool (kworker-style), cross-agent notify bus.

For the full layered diagram, on-disk schema, and the rationale behind each subsystem, see docs/ARCHITECTURE.md. For the comprehensive OS-and-cognitive-science primitive mapping, see docs/DESIGN_PHILOSOPHY.md.

---

Roadmap

  • Distributed vMem β€” cgroup-style multi-agent quotas, network-replicated stores
  • Adaptive watermarks β€” eviction tuning that follows observed agent behavior
  • arXiv preprint β€” formal evaluation against mem0 / Letta / Zep
  • Per-chunk embedding routing β€” different models for code vs prose

What landed already (1,051+ tuning iterations, eight major capability rounds) is summarized in CHANGELOG.md. Pain points it has resolved along the way are in docs/PROBLEMS_SOLVED.md.

---

Testing

# stable test subset
python3 -m pytest tests/test_agent_team.py tests/test_chaos.py -q

Coverage: per-session DB isolation, concurrent-write safety, cross-agent IPC delivery, extractor-pool queue semantics, CRIU checkpoint validation, goals-progress idempotency.

---

Dependencies

No GPU. No external API. Everything runs locally.

| Dependency | Purpose | |---|---| | Python 3.12+ | Core runtime | | SQLite (built-in) | Store + FTS5 full-text index | | nc, flock | Daemon socket + single-instance startup |

---

Paper

πŸ“„ Beyond Eviction: Full OS Context-Management Semantics for LLM Agent Persistence (PDF, 8 pages)

Technical paper describing the complete OS→agent-context mapping: demand paging, kswapd, DAMON, mlock, CRIU, kworker, and shared memory.

Citation

@software{su2026compactmem,
  title = {vMem: Full OS Memory Semantics for LLM Agent Persistence},
  author = {Su, Zhidao},
  year = {2026},
  url = {https://github.com/soolaugust/vMem}
}

Contributing

Each subsystem hides behind a clean VFS interface, so components are testable in isolation. Issues, design proposals, and pull requests are welcome β€” see the Discussions tab for design questions, and please run the test subset above before submitting a PR.

---

<div align="center">

Context compaction is the #1 productivity killer in Claude Code. vMem makes it a non-event.

English Β· δΈ­ζ–‡

</div>

See related servers & alternatives β†’

Related MCP servers

Browse all β†’

Related guides

Hand-picked reading to help you choose and use Databases servers.