克劳德拥挤
Claude Code的持久语义记忆系统,作为MCP服务器构建。将Claude Code内置的平面文件存储器替换为结构化、可搜索、版本化的文档存储。
特性
- 语义搜索 通过句子转换器(nomic-embed-ext-v1.5)+sqlite-vc
- 版本化记忆 具有完整历史记录(更新创建新版本,保留旧版本)
- 软删除 具有速率限制(每个会话5个)和撤消功能
- 动态“另见” 通过嵌入最近邻查找(无需手动链接)
- 重复检测 具有可调的相似性阈值
- 时间线浏览 基于光标的分页
- 出口、进口 用于备份和便携性
- 迁移工具 导入现有的CLAUDE.md和自动内存文件
- 热重载开发模式 通过监视git提交的stdio代理
- Web可视化工具 --具有搜索、细节浏览和CRUD功能的内存强制图
安装
uv sync设置
claude mcp add --scope user claude-crowed -- uv run --directory /path/to/claude-crowed claude-crowed然后将内存指令添加到您的 ~/.claude/CLAUDE.md 所以克劳德知道要用它。
核心原则是拥挤是 记忆层 克劳德代码。每 知识、研究、实施细节、设计决策、开放式问题, 或者想法应该在人群中流动,这样未来的会议就可以完全跳过这项工作。 在你思考之前,先搜索一下。在结束之前,先储存。如果之前的会话已经 找到了一些东西,重用它——不要重新推导它。
## Memory System (claude-crowed)
You have access to a persistent memory system via MCP tools (server: claude-crowed).
**This is your memoization layer.** The whole point is to avoid repetitive work and
thinking across sessions. Every piece of knowledge, research, implementation detail,
design decision, open question, or idea that you produce should flow through crowed
so that future sessions can skip the work entirely.
Think of crowed as a cache: before you think, search. Before you conclude, store.
If a prior session already figured something out, reuse it — don't re-derive it.
### Search Discipline
- At the **START** of every task, call `memory_recall` (or `memory_search`) with relevant keywords.
Do not skip this step — you have no passive context from crowed without it.
- **Mid-task**: whenever you encounter unfamiliar code, patterns, or errors, search again.
Don't only search at the beginning — search whenever you hit something you might have seen before.
- **Before expensive work**: always search before launching an Explore agent, doing
multi-file Grep/Glob sweeps, or calling WebSearch/WebFetch. A prior session may have
already answered the question — skip the work if it has.
- **Before forming a plan**: search for prior plans, design decisions, or rejected
approaches. Don't re-propose something that was already tried and failed.
- Use `memory_recall` to combine search + read in one call (fewer round trips).
Use `memory_search` + `memory_read` when you need finer control.
### When to Store
Store **anything** a future session might need. If you thought about it, researched it,
or figured it out, it belongs in crowed. Specific triggers:
- **After diagnosing a root cause**: "The problem was X because Y" is always worth storing.
- **When you discover a gotcha or workaround**: non-obvious behavior, API quirks,
config footguns — things that would cost a future session time to rediscover.
- **After codebase exploration**: when you map out how a module, feature, or subsystem works,
store the finding. Frame it as the question a future session would ask.
- **After web research**: store the *actionable conclusion* — not the URL.
- **After a user correction**: store it immediately — prevents the same wrong suggestion next time.
- **After every git commit**: store novel decisions, patterns, or architecture.
- **When you form an implementation plan**: store the plan, the alternatives considered,
and why you chose this approach. Future sessions shouldn't re-derive the same plan.
- **When you have an open question or idea**: store it so it's not lost between sessions.
- **When you read and understand a complex code path**: store the summary. Reading code
is expensive — don't make the next session re-read and re-understand the same thing.
- **Don't batch**: store as you go, not at the end. Mid-task insights are the most valuable
and the easiest to forget.
### Storage Rules
- Title (max 150 chars): Must be a complete thought, not a label. Another instance of you
should judge relevance from the title alone.
- Content (max 1500 chars): One insight per memory. Split larger ideas into multiple memories.
- Prefer creating NEW memories over updating existing ones unless refining the same idea.
### Do NOT
- Accumulate knowledge in this file or in auto-memory files. Crowed is the single source of truth.
- Fetch all search results — be selective (usually 1-5).
- Delegate memory_store to a subagent.
- Re-derive something that crowed already knows. Search first, always.用法
MCP工具(由Claude使用)
| 工具 | 目的 |
|---|---|
memory_search | 语义搜索,仅返回标题 |
memory_read | 获取内存的完整内容 |
memory_recall | 一次通话搜索+阅读热门结果(往返次数减少) |
memory_store | 存储新内存(带去重检查) |
memory_update | 创建新版本的内存 |
memory_delete | 软删除(速率限制,可逆) |
memory_undelete | 恢复已删除的内存 |
memory_history | 查看内存的所有版本 |
memory_timeline | 按时间顺序分页浏览 |
memory_related | 查找语义相似的记忆(动态最近邻) |
memory_export | 将所有数据导出为JSON |
memory_import | 从JSON导出导入 |
memory_migrate | 发现并拆分现有内存文件以进行迁移 |
memory_threshold | 查看/调整重复相似性阈值 |
memory_stats | 汇总统计 |
命令行界面
# Start MCP server (default, stdio transport)
claude-crowed serve
# Development mode with hot-reload on git commits
claude-crowed dev
# Export/import
claude-crowed export [--output path]
claude-crowed import
[--overwrite]
# Restore from backup
claude-crowed restore
# Rebuild embedding index
claude-crowed rebuild-embeddings
# Show stats
claude-crowed stats
# Launch web visualizer (opens browser)
claude-crowed visualize [--port 4242] [--no-browser]可视化工具
网络可视化工具将所有记忆显示为力导向图。节点是彩色的 按年龄(蓝色=最近,金色=较旧)。相似性边在语义上相互关联 通过动态最近邻查找存储。
uv sync --extra visualizer
uv run claude-crowed visualize如果满足以下条件,前端将在启动时自动构建 visualizer/dist/ 丢失或 陈旧(需要npm)。如果dist已经是最新的,它将跳过构建。
特征:
- 基于年龄着色和相似性聚类的力有向图
- 当您放大时,标签会逐渐显示
- 语义搜索(按
/聚焦) - 单击任何节点浏览其内容和元数据
- 从详细信息面板中删除/恢复记忆
建筑
- SQLite 内存存储采用WAL模式
- sqlite-vc 用于向量相似性搜索(vec0虚拟表)
- 句子变换器 使用nomic-embed-ext-v1.5(768像素,默认CPU)
- 背景模型加载 --在MCP握手期间将模型负载嵌入线程中(~1s启动)
- 两阶段检索 --搜索返回标题/元数据,读取获取完整内容
- 嵌入前缀 —
search_document:用于存储,search_query:用于检索
数据
所有数据都存储在 ~/.local/share/claude-crowed/:
crowed.db--SQLite数据库backups/--滚动备份(最多30个,每次服务器启动时创建)exports/--JSON导出
测试
uv run pytest