Persistent cross-project memory for Cursor and Claude Code using local semantic search.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Your AI solves the same bug in a different project six months later. Writes the same boilerplate. Explains the same pattern. You already knew the answer.
longmem gives your AI a persistent memory that works across every project and every session. Before reasoning from scratch, it searches what you've already solved. After something works, it saves it. The longer you use it, the less you repeat yourself.
| longmem | others | |
|---|---|---|
| Cost | Free β local Ollama embeddings | Requires API calls per session |
| Privacy | Nothing leaves your machine | Sends observations to external APIs |
| Process | Starts on demand, no daemon | Background worker + open port required |
| IDE support | Cursor + Claude Code | Primarily one IDE |
| Search | Hybrid: semantic + keyword (FTS5) | Vector-only or keyword-only |
| Teams | Export / import / shared DB path / S3 | Single-user |
| License | MIT | AGPL / proprietary |
1. Install
2. Setup β checks Ollama, pulls the embedding model, writes your IDE config
3. Activate in each project β copies the rules file that tells the AI how to use memory
4. Restart your IDE. Memory tools are now active on every chat.
Need Ollama? Install from ollama.com, then
ollama pull nomic-embed-text. Or use OpenAI β see Configuration.
longmem is an MCP server. Your IDE starts it on demand. Two rules drive the workflow:
Rule 1 β search first. Before the AI reasons about any bug or question, it calls search_similar. If a match is found (cosine similarity β₯ 85%), the cached solution is returned with any edge-case notes. Below the threshold, the AI solves normally.
Rule 2 β save on success. When you confirm something works, the AI calls confirm_solution. One parameter β just the solution text. Problem metadata is auto-filled from the earlier search.
The rules file (longmem.mdc for Cursor, CLAUDE.md for Claude Code) wires this up automatically. No manual prompting.
AI forgot to save? Run longmem review β an interactive CLI to save any solution in 30 seconds.
longmem is most useful once it has entries. The fastest way to seed it:
Option 1 β review as you go. After every solved problem this week, run longmem review and describe what you fixed. Ten entries is enough to feel the difference.
Option 2 β team import. If a teammate already has entries, they export and you import:
Option 3 β shared DB. Set db_path (or db_uri for S3/cloud) to the same location for the whole team. Every save is instantly available to everyone.
| Command | What it does |
|---|---|
longmem init | One-time setup: Ollama check, model pull, writes IDE config |
longmem install | Copy rules into the current project |
longmem status | Config, Ollama reachability, entry count, DB size |
longmem export [file] | Dump all entries to JSON β backup or share |
longmem import <file> | Load a JSON export β onboard teammates or migrate machines |
longmem review | Manually save a solution when the AI forgot |
longmem with no arguments starts the MCP server (used by your IDE).
Config lives at ~/.longmem/config.toml. All fields are optional β defaults work with a local Ollama instance.
Install the extra: pip install 'longmem[openai]'
Point every team member's config at the same path:
Or use cloud storage:
No shared mount? Use longmem export / longmem import to distribute a snapshot.
Save facts that are true across your whole stack under project="shared" so they surface from any repo:
search_similar searches all projects β a shared entry surfaces automatically from any repo without needing search_by_project.
Three-layer solution format β write solutions so they work for anyone who finds them:
| Layer | Scope | How to save |
|---|---|---|
| 1. General pattern | Universal β any team | always include in solution text |
| 2. Team-wide fact | Your whole stack | project="shared" |
| 3. Project detail | One repo only | project="<repo>" + enrich_solution |
The server exposes 11 tools. The two you interact with most:
search_similar β semantic + keyword hybrid search. Returns ranked matches with similarity scores, edge cases, and a keyword_match flag when the hit came from exact text rather than vector similarity.confirm_solution β saves a solution with one parameter. Problem metadata auto-filled from the preceding search.Full list: save_solution, correct_solution, enrich_solution, add_edge_case, search_by_project, delete_solution, rebuild_index, list_recent, stats.
Call rebuild_index once you reach 256+ entries to compact the database and build the ANN index for faster search.
Categories pre-filter before vector search β keeps retrieval fast at any scale.
| Category | Use for |
|---|---|
ci_cd | GitHub Actions, Jenkins, GitLab CI, build failures |
containers | Docker, Kubernetes, Helm, OOM kills |
infrastructure | Terraform, Pulumi, CDK, IaC drift |
cloud | AWS/GCP/Azure SDK, IAM, quota errors |
networking | DNS, TLS, load balancers, timeouts, proxies |
observability | Logging, metrics, tracing, Prometheus, Grafana |
auth_security | OAuth, JWT, RBAC, secrets, CVEs |
data_pipeline | Airflow, Prefect, Dagster, ETL, data quality |
ml_training | GPU/CUDA, distributed training, OOM |
model_serving | vLLM, Triton, inference latency, batching |
experiment_tracking | MLflow, W&B, DVC, reproducibility |
llm_rag | Chunking, embedding, retrieval, reranking |
llm_api | Rate limits, token cost, prompt engineering |
vector_db | Pinecone, Weaviate, Qdrant, LanceDB |
agents | LangChain, LlamaIndex, tool-calling, agent memory |
database | SQL/NoSQL, migrations, slow queries |
api | REST, GraphQL, gRPC, versioning |
async_concurrency | Race conditions, event loops, deadlocks |
dependencies | Version conflicts, packaging, lock files |
performance | Profiling, memory leaks, caching |
testing | Flaky tests, mocks, integration vs unit |
architecture | Design patterns, service boundaries, refactoring |
other | When nothing above fits |
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/longmem)<a href="https://allmcps.com/mcp/longmem"><img src="https://allmcps.com/api/badge/longmem?style=directory" alt="Longmem on AllMCPs" /></a>