个人知识库:存笔记、搜内容。跟我说'把这段存到知识库'自动保存并索引,或直接问问题语义搜索。搭配 Bilibili Auto Transcript 使用更佳。
run this clawhubskill inside any MCP-capable agent (Claude Code, Codex, or Cursor). paste the command below and Implexa's MCP server recognizes it, applying the SKILL.md inline via the apply_recommended_skilltool call — the skill executes in your session, no separate install step. you can also invoke it by name in natural language (e.g. "implexa, run knowledge-rag").
implexa run clawhub/knowledge-rag
---
name: knowledge-rag
version: "1.2.0"
description: "个人知识库:存笔记、搜内容。跟我说'把这段存到知识库'自动保存并索引,或直接问问题语义搜索。搭配 Bilibili Auto Transcript 使用更佳。"
metadata:
openclaw:
emoji: "📖"
requires:
bins: ["python3"]
install:
- id: "ollama"
kind: "system"
label: "安装 Ollama(向量引擎)"
url: "https://ollama.com/download"
- id: "embed-model"
kind: "shell"
label: "下载向量模型(nomic-embed-text)"
command: "ollama pull nomic-embed-text"
---
# 📖 Knowledge RAG — 个人知识库搜索
把你的笔记、转录、文章、文档集中管理,用自然语言搜索,不用管文件放哪。
## 能做什么
- 📹 搜你转的 B站视频内容
- 📚 搜你的读书笔记
- 📱 搜你存的公众号文章
- 📄 搜任何你丢进去的文档
- 🌐 还有网页搜索界面,浏览器打开就能用
## 首次设置
### 1. 安装 Ollama(向量引擎)
从 <https://ollama.com/download> 下载安装,或者:
```bash
# Linux / macOS
curl -fsSL https://ollama.com/install.sh | sh
# Windows 在官网下载安装包
```
### 2. 下载向量模型
```bash
ollama pull nomic-embed-text
```
### 3. 准备知识目录
把你想要搜索的文件放在这里:
```
~/workspace/knowledge/
├── bilibili/ ← B站转录文件放这里
├── notes/ ← 读书笔记放这里
├── wechat-articles/ ← 公众号文章放这里
└── other/ ← 其他文档放这里
```
支持 `.txt` 和 `.md` 格式。
### 4. 构建索引
```bash
python3 scripts/index_knowledge.py
```
## 工作流
### 方式一:通过我搜索(推荐)
直接问我,我会自动调用搜索:
> 你:付鹏说的英国经济那事具体怎么讲的?
> 我:在知识库里搜一下 → 带原文回答你
> 你:帮我查一下笔记里关于美联储的部分
> 我:搜 notes 来源 → 返回结果
### 方式二:网页搜索界面
启动搜索网页,在浏览器打开:
```bash
python3 scripts/knowledge_server.py 8765
```
然后打开 `http://localhost:8765`
### 方式三:命令行搜索
```bash
# 全量搜索
python3 scripts/query_knowledge.py "你的问题"
# 只搜某个来源
python3 scripts/query_knowledge.py "美联储" --source bilibili
# 只看某个作者
python3 scripts/query_knowledge.py "英国" --author 付鹏
# 查看更多结果
python3 scripts/query_knowledge.py "英国" --top 10
# 查看索引统计
python3 scripts/query_knowledge.py --stats
```
### 新增资料
有新文件时,跑一下索引更新:
```bash
python3 scripts/index_knowledge.py
```
加 `--force` 会全量重建:
```bash
python3 scripts/index_knowledge.py --force
```
## 保存知识的规范流程
当你说**"把这段存到知识库"**或类似意思时,按以下流程操作:
### 1. 决定存放位置
| 内容类型 | 存放目录 | 文件名规则 |
|---------|---------|-----------|
| 概念解释、技术笔记 | `notes/` | 用中文描述作为文件名,如 `三层架构解释.md` |
| B站转录内容 | `bilibili/` | 转录脚本自动处理 |
| 公众号/网页文章 | `wechat-articles/` | 文章标题.md |
| 以上皆非 | `other/` | 内容摘要.md |
### 2. 格式要求
- 用 `.md` 格式(Markdown)
- 有清晰的标题和层级结构
- 关键概念加粗或列点说明
- 长度不限,但建议按主题拆分文件
### 3. 保存后
保存文件后立即运行索引更新,确保新内容可搜索。
## 推荐搭配:📼 Bilibili Auto Transcript
如果你也转B站视频,装 **bilibili-auto-transcript**,转录完自动存到知识库:
```bash
clawhub install bilibili-auto-transcript
```
装好后,转录的文件自动进 `~/workspace/knowledge/bilibili/`,索引脚本会自动识别。
转完即搜,无需手动操作。
### 设置开机自启(网页界面)
Linux 系统(含 WSL2 开了 systemd):
```bash
# 创建用户级 systemd 服务
mkdir -p ~/.config/systemd/user/
cat > ~/.config/systemd/user/knowledge-server.service << 'SERVICE'
[Unit]
Description=知识仓库搜索界面
After=network-online.target
[Service]
Type=simple
ExecStart=/usr/bin/python3 /path/to/scripts/knowledge_server.py 8765
WorkingDirectory=/path/to/scripts
Restart=on-failure
RestartSec=5
[Install]
WantedBy=default.target
SERVICE
# 记得把上面的 /path/to/ 换成实际路径
systemctl --user daemon-reload
systemctl --user enable knowledge-server.service
systemctl --user start knowledge-server.service
```
## 数据在哪
所有数据存在 `~/workspace/knowledge/`,跟 OpenClaw 无关,卸载也不丢。
索引文件在 `~/workspace/knowledge/.rag_data/`。
## 注意事项
- 依赖 Ollama + nomic-embed-text 做向量化
- 首次索引需联网下载向量模型(~274MB)
- 纯文本搜索,不支持图片/PDF 中的表格
- 删除旧文件后需要重新索引才能从搜索结果中移除
- 搜索网页服务默认监听 8765 端口,可在启动时改
don't have the plugin yet? install it then click "run inline in claude" again.