chenchunrun/onyx-soc/rga-knowledge-search
- community
Checking that the SKILL.md file is still in the repository.
在本地知识库中搜索文档内容,从 rga 缓存读取已提取的文本。支持 PDF、Office 文档、电子书、压缩包等格式。当用户询问内部文档、历史报告、本地资料时使用。触发词包括"知识库"、"本地文档"、"<KNOWLEDGE></KNOWLEDGE>"、"之前的报告",或类似"安全报告里说了什么"的问题。
Install
npx vskill@latest install chenchunrun/onyx-soc/rga-knowledge-searchSKILL.md
RGA 本地知识库搜索
关于 RGA
rga (ripgrep-all) 是 ripgrep 的扩展,支持在多种文件格式中进行正则搜索:
- PDF: 通过 poppler (pdftotext) 提取文本
- Office 文档: DOCX/XLSX/PPTX 通过 pandoc 转换
- 电子书: EPUB 通过 pandoc 转换
- 压缩包: ZIP/TAR/GZ 自动递归解压搜索
- 图片: JPG/PNG 通过 tesseract OCR(需安装)
- 数据库: SQLite 直接查询
缓存机制: rga 首次搜索时提取文本并缓存到 SQLite,后续搜索直接使用缓存,速度接近纯文本搜索。
知识库路径
从上下文 <KNOWLEDGE> 标签获取路径,默认: ~/Documents
工作流
第一步:搜索
第二步:读取内容
优先:从缓存读取(毫秒级,与搜索结果一致)
兜底:直接解析文件(缓存不存在时)
第三步:分析与引用
整理内容并回答用户问题。必须标注知识来源以避免幻觉:
引用规范:
- 每个事实性陈述必须关联到具体文档
- 使用
文件名:行号格式便于溯源 - 无法从文档确认的信息需明确标注"文档未提及"
- 禁止编造文档中不存在的内容
正式报告格式见 references/report-format.md。
命令速查
搜索
| 场景 | 命令 | |
|---|---|---|
| 列出文件 | rga -l "关键词" <路径> | |
| 带上下文 | rga -C 3 "关键词" <路径> | |
| 仅 PDF | rga -t pdf "关键词" <路径> | |
| 忽略大小写 | rga -i "关键词" <路径> | |
| 正则搜索 | rga "pattern.*" <路径> |
读取(优先)
| 操作 | 命令 | |
|---|---|---|
| 读取内容 | python scripts/cache_reader.py file.pdf | |
| 取消限制 | python scripts/cache_reader.py file.pdf --no-limit | |
| 文件信息 | python scripts/cache_reader.py --info file.pdf | |
| 列出缓存 | python scripts/cache_reader.py --list |
滑动分页(长文档导航):
| 操作 | 命令 | |
|---|---|---|
| 按页读取 | python scripts/cache_reader.py file.pdf --page 1 | |
| 定位关键词 | python scripts/cache_reader.py file.pdf --around "keyword" | |
| 第 N 处匹配 | python scripts/cache_reader.py file.pdf --around "keyword" --occur 3 | |
| 从偏移读取 | python scripts/cache_reader.py file.pdf --offset 50000 | |
| 从行号读取 | python scripts/cache_reader.py file.pdf --line 100 | |
| 缩进模式 | python scripts/cache_reader.py file.py --indent 100 |
格式化选项:
| 操作 | 命令 | |
|---|---|---|
| 显示行号 | python scripts/cache_reader.py file.pdf -n | |
| 原始输出 | python scripts/cache_reader.py file.pdf --raw | |
| 行号+分页 | python scripts/cache_reader.py file.pdf -n --page 2 |
说明:
- 默认限制 50000 字符(约 12500 tokens)防止超出上下文窗口
- 默认截断超过 500 字符的行,制表符转换为 4 空格
--indent模式按缩进级别提取代码块,适合查看函数/类定义-n显示行号,格式与cat -n一致(右对齐 6 位 + tab + 内容)
读取(兜底)
| 格式 | 命令 | |
|---|---|---|
python scripts/doc_viewer.py file.pdf | ||
| Word | python scripts/doc_viewer.py file.docx | |
| Excel | python scripts/doc_viewer.py file.xlsx | |
| 压缩包 | python scripts/doc_viewer.py file.zip | |
| 取消限制 | python scripts/doc_viewer.py file.pdf --no-limit |
注意: 同样默认限制 50000 字符
缓存位置
| 系统 | 路径 | |
|---|---|---|
| Linux | ~/.cache/ripgrep-all/cache.sqlite3 | |
| macOS | ~/Library/Caches/ripgrep-all/cache.sqlite3 | |
| Windows | %LOCALAPPDATA%/ripgrep-all/cache/cache.sqlite3 |
依赖
系统: ripgrep-all, poppler, pandoc
Python (cache_reader): pip install zstandard
Python (doc_viewer): pip install pdfplumber python-docx openpyxl python-pptx ebooklib
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/rga-knowledge-search/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/chenchunrun/onyx-soc/rga-knowledge-search)