Repository navigation
Changelog
This release adds the knowledge graph, OCR, HTML and org-mode loaders, plus a redesigned console UI — loci grows from a retrieval CLI into a full knowledge platform.
New features
- Knowledge graph —
loci graph buildextracts entity–relation triples from your memories and wiki pages into a single human-readablegraph.json. Every edge cites its source file. Query withloci graph show ENTITYor the newbrain_graphMCP tool (omit the entity to list hub entities). Wiki generation injects related graph relations as extra context. - OCR (
[ocr]extra) — images (.png/.jpg/.jpeg/.bmp/.webp/.tiff) are recognized and indexed via rapidocr;loci doctorreports availability. - HTML loader —
.html/.htmvia stdlibhtml.parser: headings become#-lines,<li>becomes-, script/style skipped,<title>surfaces only when the body has no headings; honors<meta charset>with a gb18030 fallback for legacy Chinese exports. - org-mode loader —
.org/.org_archive:#+TITLEbecomes the h1 with*-sections shifted one level under it,#+FILETAGSbecome frontmatter tags, org links[[url][desc]]become markdown links.
Fixes
- Graph unique note paths and skip isolated force pairs.
- Obsidian vault hardening — ingest no longer prunes offline vaults.
- Config warnings moved to stderr (MCP stdio streams stay clean).
- Console page layout alignment and graph node separation.
Docs
- README screenshots show the console that actually ships.
- Wiki demo output archived in
docs/marketing/wiki-demo-cn.md.
Install and upgrade
Install from PyPI (adds loci and loci-mcp commands):
pip install "loci-rag[pdf,docx,ocr]"Or install from the wheel attached to this release (Python 3.11+ and runtime dependencies still required):
python -m pip install --upgrade ./loci_rag-0.9.0-py3-none-any.whlFor a first run, take config.example.toml from the sdist, copy it to config.toml inside your instance directory, fill in the model and document directories, then run loci ingest. Restart the loci HTTP / MCP services after upgrading so the new code is loaded. Run loci ingest --force only when you change the embedding model.
.whl— cross-platform Python package..tar.gz— Python source distribution (sdist).
This is a code-hosting platform release; the attached files install directly and it does not mean the package was published to PyPI.
Verified
- Offline tests: 160 passed, 8 warnings (Python 3.13 locally, 3.11–3.13 on CI).
- wheel and sdist build successfully; twine check passed.
- Knowledge graph verified on a real corpus: 2 memory files → 8 edges / 13 entities (mixed Chinese and English entities).
- OCR verified: rendered a text image via PIL and read it back through the loader.
更新日志
本次发布新增知识图谱、OCR、HTML 与 org-mode 加载器,以及重新设计的控制台 UI——loci 从检索 CLI 成长为完整的知识平台。
新功能
- 知识图谱:
loci graph build从记忆与 wiki 页抽取实体关系三元组,存入人类可读的graph.json。每条边带来源文件引用。查询用loci graph show 实体或新增的brain_graphMCP 工具(省略实体则列出枢纽实体)。wiki 生成时注入图谱关系作为补充上下文。 - OCR(
[ocr]extra):图片(.png/.jpg/.jpeg/.bmp/.webp/.tiff)经 rapidocr 识别入库;loci doctor报告可用性。 - HTML 加载器:
.html/.htm经标准库html.parser:标题变#行、<li>变-、跳过 script/style、无标题时仅显示<title>;支持<meta charset>与 gb18030 回退。 - org-mode 加载器:
.org/.org_archive:#+TITLE变 h1、*段降一级、#+FILETAGS变 frontmatter 标签、org 链接变 markdown 链接。
修复
- 图谱唯一笔记路径与孤立力对跳过。
- Obsidian vault 巩固——ingest 不再清除离线 vault。
- 配置警告改走 stderr(MCP stdio 流保持干净)。
- 控制台页面布局对齐与图谱节点分离。
文档
- README 截图展示实际交付的控制台。
- wiki 演示输出归档在
docs/marketing/wiki-demo-cn.md。
安装与升级
从 PyPI 安装(附带 loci 和 loci-mcp 命令):
pip install "loci-rag[pdf,docx,ocr]"或从本 Release 下载 wheel 安装(仍需 Python 3.11+ 及运行依赖):
python -m pip install --upgrade ./loci_rag-0.9.0-py3-none-any.whl首次使用请从 sdist 取 config.example.toml,复制为实例目录中的 config.toml,填写模型与文档目录,然后执行 loci ingest。升级后重启 loci HTTP / MCP 服务以加载新代码。仅在更换向量模型时执行 loci ingest --force。
.whl:跨平台 Python 安装包。.tar.gz:Python 源码发行包(sdist)。
本次为代码托管平台 Release,附件可直接安装;不表示已发布到 PyPI。
验证
- 离线测试:160 passed, 8 warnings(本机 Python 3.13,CI 3.11–3.13)。
- wheel 与 sdist 构建成功;twine check 通过。
- 知识图谱真实验证:2 个记忆文件 → 8 条边 / 13 个实体(中英文实体混合)。
- OCR 验证:PIL 渲染文本图片 → loader 识别回读。