Context7
Up-to-date docs for AI agents
作者提供的说明(英文原文)
Persistent cross-project memory for Cursor and Claude Code using local semantic search.
这三项永远不会合并成一个分数:意见、测量和人气是不同的东西。
我们还没有为它写通俗的介绍。下面是我们从注册中心读取到的事实。
选择你使用的 AI 应用,然后复制设置。
你需要
你用的是哪个应用?
在上方选择你的应用。我们会记住它,下次按钮会显示“安装到 …”。
打开 Claude Desktop → Settings → Developer → Edit Config,把下面的内容粘贴到 claude_desktop_config.json
{
"mcpServers": {
"longmem": {
"command": "uvx",
"args": [
"longmem"
]
}
}
}在终端中运行这条命令
claude mcp add longmem -- uvx longmem粘贴到项目中的 .cursor/mcp.json,或 ~/.cursor/mcp.json
{
"mcpServers": {
"longmem": {
"command": "uvx",
"args": [
"longmem"
]
}
}
}浏览器会先询问是否打开应用,然后应用会显示设置并请你确认。密钥的值会留空,由你自己填写。
粘贴到项目中的 .vscode/mcp.json
{
"servers": {
"longmem": {
"type": "stdio",
"command": "uvx",
"args": [
"longmem"
]
}
}
}浏览器会先询问是否打开应用,然后应用会显示设置并请你确认。密钥的值会留空,由你自己填写。
这个服务器在你的电脑上运行,而 ChatGPT 只能连接互联网上的服务器。请选择其他应用。
你的选择通过 Cookie 保存在这台设备上,无需账户。
这些设置是根据作者在注册中心的条目生成的。如果 README 的写法不同,请以 README 为准。
它在你的电脑上运行;安装后,工具列表会显示在你的 AI 应用中。
我们检查的是任何人都能看到的信息;我们没有阅读代码。不适用的检查项不计入总数。 · 检查于 2026年11月6日
注册名称已通过 GitHub 账户 marerem 验证,该账户拥有此仓库
我们还没有从 GitHub 读取这个仓库
我们还没有从 GitHub 读取这个仓库
它在你的电脑上运行,没有互联网端点
在你的电脑上运行,改用本地设置
它在你的电脑上运行;我们只能读取互联网端点的工具列表
与注册中心里这个分类中所有活跃的服务器比较。只有当发布者拥有该仓库时,星标数才计入。
它在 1 项适用的基础检查中通过了 1 项。我们没有阅读代码。在添加密钥或令牌之前,请先看看这个服务器要求哪些权限,并使用只具备所需权限的密钥。
注册中心没有列出必需的密钥,不过有些服务器会在首次使用时要求你登录。
它在你的电脑上运行。你的 AI 应用会在需要时启动它,数据不会经过作者的服务器(除非它自己调用在线服务)。
GitHub 仓库最后更新于–,最新版本(0.2.1)于7个月前进入注册中心。
支持 MCP 的应用,例如 Claude Desktop、Claude Code、Cursor 和 VS Code。你的电脑上还需要有 Python (uv)。
同一分类中有:Context7, Codebase Memory, Exa
同一分类中其他作者的服务器,按星标数排序。
如何看卡片:★ GitHub 星标i三大支柱:评价 · 检查 · 使用情况i更新 = 最新版本发布到注册中心的时间i
Up-to-date docs for AI agents
Codebase knowledge graph for AI agents — 162 languages, sub-ms queries, 99% fewer tokens.
Connect AI agents to Exa for web search, content fetching, and multi-step research.
按原文从作者的仓库复制。PopNx MCP 没有审查或背书其内容。HTML、图片和脚本已被移除。链接会离开本站。
Cross-project memory for AI coding assistants. Stop solving the same problems twice.
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.
You describe a problem
│ ▼ search_similar() ┌─────────────────────────────────────────────────────┐ │ 1. pre-filter by category (ci_cd / auth / db / …) │ │ 2. semantic search (Ollama or OpenAI embeddings) │ │ 3. keyword search (SQLite FTS5 exact match) │ │ 4. merge + rank results │ └─────────────────────────────────────────────────────┘ │ │ score ≥ 85% score < 85% │ │ ▼ ▼ cached solution AI reasons from scratch
| 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
pipx install longmem
2. Setup — checks Ollama, pulls the embedding model, writes your IDE config
longmem init
3. Activate in each project — copies the rules file that tells the AI how to use memory
cd your-project
longmem install
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:
# teammate
longmem export team_knowledge.json
longmem import team_knowledge.json
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 | 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.
embedder = "openai"
openai_model = "text-embedding-3-small" openai_api_key = "sk-..." # or set OPENAI_API_KEY
Install the extra: pip install 'longmem[openai]'
Point every team member's config at the same path:
# NFS / shared drive
db_path = "/mnt/shared/longmem/db"
Or use cloud storage:
# S3 (uses AWS env vars)
db_uri = "s3://my-bucket/longmem"
db_uri = "db://my-org/my-db" lancedb_api_key = "ldb_..." # or set LANCEDB_API_KEY
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:
save_solution(
problem="why oauth2-proxy uses port 4181 not default 4180", solution="General: 4180 is the oauth2-proxy default. 4181 means something else already occupies 4180.\n\nThis team's setup: Sinfonia always runs on 4180. Every other project uses 4181+ by convention.", project="shared", category="networking", tags=["oauth2-proxy", "ports", "nginx"] )
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=" " + enrich_solution |
similarity_threshold = 0.85 # minimum score to surface a cached result (default 0.85)
duplicate_threshold = 0.95 # minimum score to block a save as a near-duplicate (default 0.95)
The server exposes 11 tools. The two you interact with most:
keyword_match flag when the hit came from exact text rather than vector similarity.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 |
Contributions are very welcome — this project grows with the community that uses it.
Whether it's a bug fix, a new feature, better docs, or just sharing your use case — all of it helps. If you're unsure whether an idea fits, open an issue first and we'll figure it out together.
Getting started:
git clone https://github.com/marerem/longmem
cd longmem uv sync --group dev uv run pytest
Good first contributions:
Ways to contribute without code:
MIT — see LICENSE.
mcp-name: io.github.marerem/longmem