Summary
本地向量知识库,支持按项目管理文档(docx/doc/pdf/md),语义检索。默认用硅基流动免费 API,零模型安装即可使用。支持多项目隔离、中文制度文档专用切片、Embedding+Rerank 两阶段检索。触发词:知识库、向量检索、RAG、制度检索、文档入库、语义搜索、local…
nigo81/nigo-skills
本地向量知识库,支持按项目管理文档(docx/doc/pdf/md),语义检索。默认用?
npx skills add nigo81/nigo-skills --skill local-rag
本地向量知识库,支持按项目管理文档(docx/doc/pdf/md),语义检索。默认用硅基流动免费 API,零模型安装即可使用。支持多项目隔离、中文制度文档专用切片、Embedding+Rerank 两阶段检索。触发词:知识库、向量检索、RAG、制度检索、文档入库、语义搜索、local…
Related neighbors and high-traction skills in the same topics — useful to compare before installing.
Use for Azure AI: Search, Speech, OpenAI, Document Intelligence. Helps with search, vector/hybr…
568.2K installsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or bot…
216.8K installsUse this skill whenever the user wants to do anything with PDF files. This includes reading or …
192.4K installsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.do…
184.5K installsUse this skill any time a spreadsheet file is the primary input or output. This means any task …
165K installsOther skills from nigo81/nigo-skills · top by installs.
npx skills add nigo81/nigo-skills
Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.
Alternate registries and mirrors of this skill.
npx skills add https://modelscope.cn/skills/oranhsds/local-rag
main
Parsed from SKILL.md frontmatter.
Files included with this skill beyond the listing page.
SKILL.md
8,353 B
SUMMARY.md
566 B
轻量级本地向量知识库,支持按项目管理文档,语义检索制度条款。
作者: nigo(公众号「逆行的狗」)
面向财务/审计从业者的 AI 效率工具,有任何问题可关注公众号反馈。
bin/local-rag 是独立的 CLI 入口脚本,自动定位 skill 目录,可在任意位置运行。
# 设置快捷方式(一次性,加到 PATH)
export PATH="$HOME/.claude/skills/local-rag/bin:$PATH"
# 或创建别名:alias local-rag="$HOME/.claude/skills/local-rag/bin/local-rag"
# 首次配置(交互式向导)
local-rag setup
# 项目管理
local-rag create my-project
local-rag delete my-project
local-rag list
# 入库
local-rag ingest my-project /path/to/docs
local-rag ingest my-project /path/to/file.docx --label "财务制度"
# 检索
local-rag search my-project "消防安全管理"
local-rag search my-project "消防安全管理" --rerank --top-k 20
# 工具
local-rag chunk-test /path/to/file.doc
local-rag info
也可以直接用完整路径:~/.claude/skills/local-rag/bin/local-rag
import sys, os
# 添加 skill 目录(根据实际安装位置调整)
sys.path.insert(0, os.path.expanduser("~/.claude/skills/local-rag"))
from src.pipeline import Pipeline
pipeline = Pipeline()
# 项目管理
pipeline.create_project("my-project")
pipeline.list_projects()
pipeline.delete_project("my-project")
# 入库(文件或文件夹)
result = pipeline.ingest("my-project", "/path/to/docs")
# 检索
results = pipeline.search("my-project", "消防安全管理", top_k=15)
# 检索 + Rerank
results = pipeline.search_with_rerank("my-project", "消防安全管理", final_k=10)
# 测试切片
result = pipeline.chunk_test("/path/to/file.doc")
pip install fastmcp
python3 ~/.claude/skills/local-rag/mcp_server.py
6 个 tool:createproject / deleteproject / listprojects / ingest / search / reranksearch
| Provider | 适用场景 | 需要什么 |
|---|---|---|
| siliconflow(默认) | 大多数场景,免费额度无限量 | API Key |
| ollama | 离线/内网环境 | Ollama + 模型(~2.5GB) |
| openai | 已有 OpenAI 账号 | API Key |
⚠️ API Key 安全: 不要把 API Key 直接写在 config.yaml 里!请设置环境变量
SILICONFLOWAPIKEY,config.yaml 中用${SILICONFLOWAPIKEY}引用。
环境变量 SILICONFLOWAPIKEY 设置硅基流动 Key 即可使用默认配置。如果没有 Key,请先到 硅基流动 免费注册并创建 API Key。
当用户没有设置 API Key 时,按以下顺序查找,不要 grep 搜索:
SILICONFLOWAPIKEY(echo $SILICONFLOWAPIKEY / Windows: echo %SILICONFLOWAPIKEY%)- macOS: ~/Library/Application Support/local-rag/config.yaml - Windows: %LOCALAPPDATA%\local-rag\config.yaml - Linux: ~/.local/share/local-rag/config.yaml
``` 请先设置硅基流动 API Key(免费,注册地址:https://cloud.siliconflow.cn):
macOS/Linux: echo 'export SILICONFLOWAPIKEY="sk-xxx"' >> ~/.zshrc && source ~/.zshrc
Windows (PowerShell): [Environment]::SetEnvironmentVariable("SILICONFLOWAPIKEY", "sk-xxx", "User")
或运行:local-rag setup ```
Chonkie RecursiveChunker 三级递归:
chunking.strategy: generic配置文件路径(跨平台自动选择):
~/Library/Application Support/local-rag/config.yaml%LOCALAPPDATA%\local-rag\config.yaml~/.local/share/local-rag/config.yaml环境变量优先:SILICONFLOWAPIKEY / OPENAIAPIKEY / RAGDATADIR / RAGEMBEDDINGMODEL
默认路径(跨平台自动选择):
~/Library/Application Support/local-rag/%LOCALAPPDATA%\local-rag\~/.local/share/local-rag/可通过环境变量 RAGDATADIR 或 config.yaml 的 storage.data_dir 修改。
qwen3-embedding:4blocal-rag setup 或手动设置 SILICONFLOWAPIKEY 环境变量local-rag info 检查配置是否就绪local-rag info 报错"API Key 未设置",直接引导用户(见上方"API Key 查找顺序"),不要到处 greppip install -r ~/.claude/skills/local-rag/requirements.txt,如果命令报 ImportError,引导用户安装RAGEMBEDDINGMODEL 可切换模型list_collections() 返回 Collection 对象,需要 .name/api/embed 返回 {"embeddings": [[...]]} 不是 {"embedding": [...]}