
Longmem
io.github.marerem由 GitHub 账号 marerem 发布v0.2.1更新于 Oct 24, 2026
Persistent cross-project memory for Cursor and Claude Code using local semantic search.
概览
为编程助手提供本地持久记忆,在从头推理前先语义检索已解决的问题。
- 可以做什么
- Longmem 是一个本地 MCP 服务器,保存你已经解决过的问题方案,并跨项目、跨会话检索。主要工具是 search_similar,对已存条目做语义与关键词混合检索;以及 confirm_solution,保存方案并自动填充前一次检索得到的问题元数据。还提供 save_solution、correct_solution、enrich_solution、add_edge_case、search_by_project、delete_solution、rebuild_index、list_recent、stats 等工具,以及用于初始化、复查、导出和导入的命令行工具。
- 适用场景
- 如果你在多个代码仓库中使用 Cursor 或 Claude Code,并且反复解决同样的缺陷、样板代码或模式,就值得添加。它在已有条目后才有价值,可先通过复查或同事的导出文件填充。团队可共享同一数据库,让知识从每个仓库都能检索到。
- 运行要求
- 以本地进程运行,通过 pipx 从 PyPI 安装,仅支持桌面端。需要嵌入后端:本地 Ollama 实例及 nomic-embed-text 模型,或使用 OpenAI 嵌入并提供 API 密钥。可选配置位于 ~/.longmem/config.toml,可指向共享路径、S3 或 LanceDB Cloud。
安装
在 SourceWeft 中
- 打开 控制台中的 Longmem,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
Cross-project memory for AI coding assistants.
Stop solving the same problems twice.
[PyPI] [Python 3.11+] [License: MIT] [Tests] [Coverage] [Open Issues] [Closed Issues] [marerem/longmem MCP server]
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.
Why longmem
Quickstart
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.
How it works
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.
Cold start — getting value from day one
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.
CLI
longmem with no arguments starts the MCP server (used by your IDE).
Configuration
Config lives at ~/.longmem/config.toml. All fields are optional — defaults work with a local Ollama instance.
Switch to OpenAI embeddings
Install the extra: pip install 'longmem[openai]'
Team shared database
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.
Team knowledge base
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:
Tuning
MCP tools
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 akeyword_matchflag 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.
Category reference
Categories pre-filter before vector search — keeps retrieval fast at any scale.
Contributing
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:
Good first contributions:
- New category suggestions
- Edge cases you hit in real projects
- IDE integrations (JetBrains, VS Code, Neovim, etc.)
- Better error messages
- Seed datasets — export your own entries and share them as a starter pack
Ways to contribute without code:
- Star the repo if you find it useful
- Share it with your team
- Open an issue if something is confusing — unclear UX is a bug
License
MIT — see LICENSE.
mcp-name: io.github.marerem/longmem
来源:README.md,提交 b43dc04
工具
0版本历史
1- v0.2.1最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分