用途:在本地文献库(library/markdown/)上做语义检索,适合按概念而非关键词查找论文段落。
主要能力:index 建立或增量更新向量索引;search 按语义返回按相似度排序的 JSON 行结果;similar 查找与某段落相似的其他段落;context 显示某段落前后文;status 与 list 查看索引统计和文档列表;remove 按 citation key 删除文档。
使用方式:命令统一为 uv run plugins/sociology-skillset/scripts/rag.py,如 index、search "cultural capital and educational attainment"、similar <chunk_id>、context <chunk_id>、status、list、remove Smith2020_Cultural;search 支持 --top-k、--min-score,index 支持 --keys,context 支持 --window。依赖由 uv 依 PEP 723 内联元数据首次运行时自动安装,首次索引会下载 all-MiniLM-L6-v2 模型(约 80MB)。
限制与前提:需先安装 uv,并用 ingest.py 将论文转为 markdown、整理文件并写入 references.bib 的 md_path 字段;只有 references.bib 中登记的 markdown 文件会被索引,未登记的松散文件会被标记为 unlinked。索引存于 library/.rag-index/,按 ## 标题分块,无标题文档回退到约 512 token 的固定分块。语义搜索适合概念探索,精确关键词、作者或元数据检索更宜用 grep 配合。