向量
 ](package.json)    
你的笔记成为AI的记忆
您的标记笔记分散在文件夹中。你知道答案是 *某处* 在那里,但在哪里?
向量 索引您的 .md 文件,并允许您(或您的AI助手)立即搜索它们——不仅按关键字,而且按含义。
问题
You: "How did we set up authentication?"
AI: "I don't have access to your notes."
You: *manually searches 50 files*
You: *finds it 10 minutes later in docs/auth/oauth.md*解决方案
vecmem index ./docs # One-time: index your notes
vecmem query "how did we set up auth?" # Instant: finds it in 100msFound 5 results (87ms)
┌─ docs/auth/oauth.md ─── score: 0.94 ────────────┐
│ ## OAuth 2.0 Flow │
│ Authentication uses OAuth 2.0 with PKCE. │
│ The flow starts with a redirect to /auth/login... │
└───────────────────────────────────────────────────┘发现 oauth.md 即使你搜索了“auth”——因为它理解含义,而不仅仅是单词。
安装
npm install -g vecmem快速开始
vecmem init # Find all .md files in your project
vecmem index # Index them (takes a few seconds)
vecmem query "database schema" # Search by meaning
vecmem status # See what's indexed与AI助手合作
vecmem是一个 MCP服务器 --AI助手可以直接使用它:
Claude CLI --添加到 .mcp.json 在您的项目中:
{
"mcpServers": {
"vecmem": {
"command": "vecmem",
"args": ["--mcp"]
}
}
}也与 光标, VS代码副本, 帆板运动,以及任何兼容MCP的客户端。
连接后,您的AI可以自动搜索您的笔记:
You: "What do we know about the deployment process?"
AI: *searches vecmem* → finds 3 relevant notes → gives you the answer运作原理
Your .md files
│
▼
vecmem index
│
├── Reads and splits into sections (heading-aware)
├── Converts each section into a vector (meaning)
└── Stores in local SQLite database
vecmem query "..."
│
├── Keyword search (exact matches)
├── Meaning search (similar concepts)
└── Combines both → best results first一切都在本地运行。 没有API密钥,没有云,没有数据离开您的机器。
所有命令
| 命令 | 它的作用 |
|---|---|
vecmem init | 查找.md文件并设置数据库 |
vecmem index [path] | 索引文件(仅重新索引已更改的文件) |
vecmem query "..." | 搜索您的笔记 |
vecmem status | 索引了多少个文件/节 |
vecmem doctor | 检查一切是否健康 |
| `vecmem remove | |
| ` | 从索引中删除文件 |
常见问题解答
这与grep有何不同? grep可以找到精确的单词。vecmem查找相关概念。搜索“auth”,它会找到有关“登录”、“OAuth”、“会话管理”的文档。
它需要互联网连接吗? 只需下载一次搜索模型(23 MB)。在那之后,一切都可以离线工作。
它有多快? 在数百个文件中搜索大约需要100毫秒。索引过程约30个文件/秒。
它支持哪些文件? Markdown(.md)仅限文件。它理解标题、代码块和frontmatter。
我的数据存储在哪里? 在 ~/.vector/vector.db --您计算机上的单个文件。随时删除。
它适用于英语以外的语言吗? 搜索模型在英语中效果最好。其他语言可能会降低基于意义的搜索的准确性,但关键字搜索适用于任何语言。
技术细节
For developers who want to know what's under the hood
建筑
.md files → Parser → Embedder → SQLite Store → Hybrid Search
│
CLI ←─┤─→ MCP Server- 解析器 --备注AST、标题感知组块、前体提取
- 嵌入器 --拥抱面变压器(全MiniLM-L6-v2,384昏暗,本地ONNX)
- 商店 --带WAL模式的SQLite、FTS5全文索引、原子事务
- 搜索 --BM25+余弦相似度+互易秩融合,分数归一化为\[0,1\]
工程
- 品牌类型(
DocumentId,ChunkId,UnitScore)--编译时安全 - 在开发模式下每次写入后检查5个系统不变量
- 基于属性的快速检查测试(每个属性1000多个随机输入)
- CI中执行的绩效合同
- 优雅的降级——如果模型不可用,则退回关键字搜索
- 19个测试文件中的255个测试
堆栈
TypeScript 5.7+| Node.js 22+| SQLite(better squelite3)|拥抱人脸变换器|备注|命令| MCP SDK | zod | vitest+快速检查
