mnemostack is a self-hosted hybrid memory and retrieval layer built on top of the user's own Qdrant vector database, with optional use of the Memgraph graph database. It is aimed at AI applications and agents, providing persistent, searchable, and explainable memory capabilities.
Purpose
The core purpose of mnemostack is to provide persistent memory for AI agents. Long-running agents often encounter the problems of context being compressed, useful decisions being lost after a session restart, and the need to re-familiarize themselves with the environment on the next run. mnemostack provides a persistent memory layer, and when the context window is insufficient, the agent can pull exact facts from storage through a single recall(query) call.
The same engine is also suitable for other retrieval-intensive work: RAG over hybrid corpora, multi-tenant or per-user isolated knowledge bases, time-aware search backends, and so on, and is especially suitable for scenarios where pure vector similarity is not enough.
Main capabilities
- Hybrid retrieval: Vector retrieval, BM25 keyword retrieval, temporal retrieval, and graph retrieval run in parallel, with ranking fused via Reciprocal Rank Fusion.
- 8-stage ranking pipeline: Can perform query classification, exact token rescue, gravity/hub suppression, freshness blending, return suppression, curiosity boosting, Q-learning weights, and graph revival, among other processing.
- Optional LLM reranking and answer synthesis: Performs final ranking on top of recall results, or generates answers with confidence scores and citations; retrieval still works when the LLM is unavailable.
- Multi-tenant isolation: Isolates tenant data in each retriever through payload filters, or enables service key authentication (serve --auth) to achieve hard tenant boundaries, with optional per-tenant quotas.
- Data ingestion and structured projection: The ingestion path can enrich and project structured fields, and supports the streaming Ingestor API for real-time message storage.
- Feedback loop: Explicitly updates usefulness signals via /feedback over HTTP or MCP, and does not silently train on every response.
- Graceful degradation: When any retriever fails, it logs the failure and continues using the remaining sources; degraded status is visible through the degraded tag, and full traces can be obtained on demand via include_trace.
Usage modes
mnemostack offers three usage modes:
- MCP server: Suitable for agents to usehousehold. Run mnemostack mcp-serve and connect to MCP-capable agents such as Claude Desktop, Claude Code, Cursor, and ChatGPT to use memory tools (such as mnemostack_search, mnemostack_answer, and graph tools).
- HTTP API: suitable for application developers. Run mnemostack serve and call endpoints such as /recall, /answer, /feedback, /memories, /invalidate, /triples, /health, /metrics, and /docs from any language.
- Python SDK: suitable for library users. Compose retrievers, storage, rerankers, graph tools, and the streaming ingestion API in your own Python application.
To get started quickly, you first need to run a local Qdrant as the vector store, and optionally run Memgraph to support graph memory. When indexing notes, documents, transcripts, or project context in a folder, --recreate will first request confirmation; in scripts or CI, add --yes to skip the prompt.
Applicable scenarios
- Long-running coding agents that need to retain memory across compaction and session restarts.
- Chat assistants and conversational bots that remember user messages, preferences, and decisions across sessions, and isolate each user's memory through payload filters.
- Personal assistant memory, used for preferences, recurring tasks, and long-term context.
- Multiple agents sharing context through one persistent memory backend.
- Session compaction recovery, when useful details no longer fit in the prompt.
- Searchable knowledge base: after ingesting documents, notes, and FAQs, provide hybrid search or answer() with citations through the CLI, HTTP, or library.
- RAG over mixed corpora (code, documents, transcripts), where exact token and temporal recall outperform pure vector similarity.
- Multi-tenant or per-user knowledge storage.
- Time-aware search and knowledge bases, such as "what changed last week", point-in-time graph facts, and freshness-weighted ranking.
- Team or project knowledge recall, covering documents, notes, tickets, and chat history.
Limitations and notes
- Requires self-hosted Qdrant; graph features require optionally running Memgraph.
- The order of the recall result list is authoritative; score has no unified scale and should not be reordered or compared across queries.
- Query expansion runs before retrieval; misconfiguration will directly raise an error rather than silently degrade.
- Multi-process servers need to implement their own StateStore (the three methods get, set, and update), which can be based on Redis or a database.
- Benchmark results depend on dataset version, configuration, judge model, scoring rules, and query type; externally reported numbers are for reference only.
- The project is under active development; the public API is stable, new features are added incrementally in minor versions, and breaking changes are rare and documented in CHANGELOG.md.