Files
nexus/wiki/sources/semantic-memory-search.md
2026-04-17 22:17:27 +08:00

52 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Semantic Memory Search"
type: source
tags: []
date: 2026-04-17
---
## Source File
- [[raw/Agent/usecases/semantic-memory-search.md]]
## Summary
- 核心主题:为 OpenClaw 的 markdown 内存系统添加向量语义搜索能力
- 问题域OpenClaw 内存文件无法按语义搜索,仅支持关键词匹配和全文加载
- 方法/机制:使用 memsearch 库 + Milvus 向量数据库实现语义搜索,结合 BM25 全文搜索和密集向量,通过 RRF 排序reranking
- 结论/价值:可以通过自然语义"我们选了什么缓存方案?"找到相关内容,无需关键词匹配
## Key Claims
- OpenClaw 的内存以 markdown 文件存储,便于移植和人类阅读,但无搜索功能
- 语义搜索通过向量嵌入实现,"what caching solution did we pick?"能找到相关内容,即使不含"caching"一词
- SHA-256 内容哈希确保未更改文件永不重新嵌入,零 API 浪费
- 混合搜索结合语义相似度密集向量与关键词匹配BM25通过倒数排名融合RRFreranking
## Key Quotes
> "Index all your OpenClaw markdown memory files into a vector database (Milvus) with a single command" — memsearch 核心功能说明
> "SHA-256 content hashing means unchanged files are never re-embedded — zero wasted API calls" — 成本优化机制
> "Hybrid search (dense vectors + BM25 full-text) with RRF reranking for best results" — 搜索质量保障
## Key Concepts
- [[语义搜索]]:通过向量嵌入实现按语义相似度而非关键词匹配搜索
- [[向量嵌入]]:将文本转换为数值向量,用于语义相似度计算
- [[BM25]]:基于关键词的全文搜索算法
- [[RRFReranking]]:倒数排名融合,将多路搜索结果合并排序
## Key Entities
- [[memsearch]]GitHub 开源项目Zilliz Tech 开发,提供向量搜索 CLI/库
- [[Milvus]]开源向量数据库memsearch 的后端存储
- [[OpenClaw]]AI Agent 管理工具,其内存系统触发此需求
## Connections
- [[memsearch]] ← powers ← [[语义搜索]]
- [[Milvus]] ← stores ← [[向量嵌入]]
- [[OpenClaw]] ← uses ← [[Semantic-Memory-Search]]
- [[语义搜索]] ← combines ← [[向量嵌入]]
- [[语义搜索]] ← combines ← [[BM25]]
## Contradictions
- 与 [[Second-Brain]] 冲突:
- 冲突点:两者都解决"笔记搜索"需求,但方案不同
- 当前观点memsearch 通过向量搜索实现语义检索
- 对方观点Second-Brain 通过 Next.js 搜索界面实现检索,各有优势