{"slug": "persistent-memory-for-claude-code-that-survives-context-compaction", "title": "Persistent memory for Claude Code that survives context compaction", "summary": "MenteDB, a Rust-based persistent memory database for AI systems, launches to solve context window limitations by enabling single-pass transformer models to store, retrieve, and reason over knowledge across sessions. The engine automatically extracts semantic facts, detects contradictions, and surfaces relevant memories via vector search, integrating with Claude Code, ChatGPT, and other AI tools.", "body_md": "A Rust database that pre digests knowledge for single pass transformer consumption. Not a wrapper. A ground up storage engine that thinks.\n\nAI has a memory problem\n\nCurrent AI systems consume context in a single pass with no ability to revisit, reflect, or recognize what they are missing.\n\nAI gets a single context window. No re-reading, no follow ups. Every token must count.\n\nAI can't sense what it doesn't know. It can't feel uncertainty or detect its own knowledge gaps.\n\nAI reads linearly but attends associatively. Raw text dumps waste compute on noise.\n\nYour agent.md has limits\n\nStatic instruction files work for small projects. But as context grows, decisions accumulate, and you work across devices, you need something that actively manages knowledge for you.\n\nYour AI reads every conversation and decides what is worth remembering. Facts, preferences, decisions, and corrections are stored without you lifting a finger.\n\n\"What did we decide about auth?\" works via embeddings, not string matching. MenteDB finds relevant memories even when you use different words.\n\nIf you said Postgres last month and MySQL this month, MenteDB flags the inconsistency. A static file cannot detect when your decisions change.\n\nPast mistakes surface automatically when you are about to repeat them. Anti-patterns you recorded are matched against your current context.\n\nYour laptop and desktop share the same brain. Cloud mode means every device sees every memory instantly.\n\nAn agent.md works until it is too big for the context window. MenteDB stores thousands of memories and retrieves only the relevant ones via vector search.\n\nA cognitive engine, not just storage\n\nFifteen core systems that transform MenteDB from a database into an active participant in your AI's reasoning.\n\nBackground pipeline extracts semantic facts, links entities, detects communities, and builds user profiles from raw conversations. Like the brain consolidating memories during sleep.\n\nContinuous memory ingestion with real time belief updates as conversations unfold.\n\nAutomatically derives new knowledge from stored memories at write time, not query time.\n\nMaps conversation paths through topic space to predict where dialogue is heading.\n\nDetects knowledge gaps and creates placeholder memories so the AI knows what it does not know.\n\nPrevents contradictory memories from polluting context by isolating conflicting beliefs.\n\nRecords negative feedback and emotional triggers to prevent the AI from repeating mistakes.\n\nPredicts upcoming queries and pre builds context windows, like branch prediction for knowledge.\n\nMemories carry valid_from/valid_until timestamps. Temporal invalidation instead of deletion, with point-in-time queries.\n\nLLM judges whether new memories invalidate, update, or are compatible with existing ones. 100% accuracy on 62 test cases.\n\nBM25 + HNSW vector + RRF fusion for best-of-both-worlds retrieval. Keyword precision meets semantic understanding.\n\nClaude Code hooks make memory automatic on every turn. The claude.ai connector, ChatGPT, Cursor, and Copilot connect with one URL.\n\nRust, Python, and TypeScript bindings with native performance. pip install, npm install, or cargo add and start building.\n\nCreate, revoke, and monitor API keys from the dashboard. Scoped access control for teams and production deployments.\n\nGet real-time notifications when memories change. HMAC-signed payloads with delivery logs, status tracking, and automatic retries.\n\nThe difference memory makes\n\nSame user. Same question. Completely different experience.\n\nDeploy to production\n\nRunning deploy script...\n\n✗ Deploy failed — wrong AWS region\n\nI told you LAST WEEK it's us-west-2!\n\nSorry, I don't have context from previous sessions.\n\n🤦 This is the THIRD time...\n\nDeploy to production\n\nDeploying to us-west-2 (your production account)...\n\n✓ Deploy successful\n\nSimple by design\n\nOne call per conversation turn. MenteDB handles extraction, storage, retrieval, contradiction detection, and background enrichment automatically.\n\n```\nuse mentedb::MenteDb;use mentedb::process_turn::ProcessTurnInput;use mentedb_context::DeltaTracker; let db = MenteDb::open(\"./agent-memory\")?;let mut delta = DeltaTracker::default(); let result = db.process_turn(&ProcessTurnInput {    user_message: \"I switched from Postgres to SQLite\".into(),    assistant_response: Some(\"Got it!\".into()),    turn_id: 0,    project_context: None,    agent_id: None,    session_id: None,}, &mut delta)?; // result.context — memories ready for your prompt// result.facts_extracted — what was learned// result.contradiction_count — conflicts detected // Sleeptime enrichment runs automatically in the background:// → semantic facts extracted from conversations// → entities linked and deduplicated// → community summaries generated// → user profile built and updated\n```\n\nSix layers, one engine\n\nA purpose built stack where every layer is designed for AI memory, from storage pages to cognitive processing.\n\nMenteDB ships a production MCP server with 32 tools across 6 categories. Connect Claude, Cursor, ChatGPT, or any MCP client in seconds — locally via stdio or remotely via Streamable HTTP.\n\nCloud endpoint: `https://api.mentedb.com/mcp`\n\n`process_turn`\n\n`store`\n\n`search`\n\n`recall`\n\n`get`\n\n`forget`\n\n`forget_all`\n\nprocess_turn also triggers sleeptime enrichment when an LLM provider is configured\n\n`search_text`\n\n`search_vector`\n\n`search_by_tag`\n\n`relate`\n\n`get_related`\n\n`find_path`\n\n`get_subgraph`\n\n`find_contradictions`\n\n`propagate_belief`\n\n`consolidate`\n\n`apply_decay`\n\n`compress`\n\n`evaluate_archival`\n\n`extract_facts`\n\n`gdpr_forget`\n\n`record_pain`\n\n`detect_phantoms`\n\n`resolve_phantom`\n\n`record_trajectory`\n\n`predict_topics`\n\n`detect_interference`\n\n`check_stream`\n\n`write_inference`\n\n`register_entity`\n\n`get_cognitive_state`\n\n``` bash\n$ npx mentedb-mcp@latest setup setup\n  # also: claude-code (hooks), claude, cursor\nbash\n$ npx mentedb-mcp@latest login\n```\n\n**Local mode:** Works with any MCP-compatible client via stdio: Claude Desktop, Cursor, Claude Code by default. Copilot CLI, Cursor, VS Code, custom agents via explicit setup targets.\n\n**Cloud mode:** Connect via Streamable HTTP MCP at `https://api.mentedb.com/mcp`\n\n— works with ChatGPT, remote clients, and any environment that supports HTTP MCP.\n\nSimple, transparent pricing\n\nStart free. Upgrade when you need more.\n\nGet started with persistent memory for your AI agents.\n\nFor power users and teams who need more capacity.\n\n92%\n\nLongMemEval Accuracy (500 Q)\n\n0.29ms\n\nAvg Insert\n\n<1ms\n\nContext Assembly at 10K\n\n2.3x\n\nFewer Tokens (Compact)\n\n0%\n\nStale Beliefs Returned\n\nMeasured, not promised\n\nEvery claim backed by reproducible tests. Quality validated on every commit, performance measured with Criterion.\n\n[LongMemEval](https://arxiv.org/abs/2410.10813) (ICLR 2025) is the standard benchmark for long-term conversational memory: 500 questions across six reasoning types over long, multi-session histories (~115K tokens each). Graded by the official judge, unmodified.\n\n7/7 passing\n\nSuperseded memories correctly excluded via graph edges\n\n90.7% reduction in memory retrieval tokens over 20 turns\n\n100 turns, 3 projects, 0% stale returns, 0.29ms insert\n\nU-curve ordering maintains 100% LLM compliance\n\n100% useful memories vs 80% naive (+20pp improvement)\n\n100% correct on stale beliefs, 4.8x faster than brute-force scan\n\n10,000 memories, 6/6 belief changes tracked, 0 stale returns\n\nMeasured across memory counts\n\n| Benchmark | 100 | 1,000 | 10,000 |\n|---|---|---|---|\n| Insert | 13ms | 244ms | 2.65s |\n| Context Assembly | 217us | 342us | 693us |\n\nSame 25 memories, different formats\n\n| Format | Tokens | vs Raw JSON |\n|---|---|---|\n| Raw JSON | 947 | — |\n| Structured | 576 | 1.6x fewer |\n| Compact | 414 | 2.3x fewer |\n\n~80%\n\nDelta savings over 20 turns\n\n30%+\n\nMore memories per budget\n\nOne command. Persistent memory.\n\nSets up Claude Code hooks by default. Also works with claude.ai (connector), Copilot, Cursor, and any MCP client.\n\n``` bash\n$ npx mentedb-mcp@latest setup  # Claude Code hooks by default; or copilot, claude, cursor  ✓ MCP config written  ✓ Agent instructions installed  ✓ Ready — your AI now has persistent memory.   # Optional: log in to sync memory across devices$ npx mentedb-mcp@latest login  ✓ Cloud sync enabled\n```\n\nOr connect via HTTP: `https://api.mentedb.com/mcp`", "url": "https://wpnews.pro/news/persistent-memory-for-claude-code-that-survives-context-compaction", "canonical_source": "https://mentedb.com", "published_at": "2026-07-11 21:07:20+00:00", "updated_at": "2026-07-11 21:35:25.483220+00:00", "lang": "en", "topics": ["artificial-intelligence", "ai-infrastructure", "ai-tools", "ai-products", "ai-research"], "entities": ["MenteDB", "Claude Code", "ChatGPT", "Cursor", "Copilot"], "alternates": {"html": "https://wpnews.pro/news/persistent-memory-for-claude-code-that-survives-context-compaction", "markdown": "https://wpnews.pro/news/persistent-memory-for-claude-code-that-survives-context-compaction.md", "text": "https://wpnews.pro/news/persistent-memory-for-claude-code-that-survives-context-compaction.txt", "jsonld": "https://wpnews.pro/news/persistent-memory-for-claude-code-that-survives-context-compaction.jsonld"}}