okf v0.4.0 — Local Vector Semantic Search
okf 现在支持本地语义(自然语言)搜索:内嵌 ONNX Runtime + MiniLM 量化模型(纯 Go,CGO_ENABLED=0,运行时零联网),为知识库构建 HNSW 向量索引,语义与词法结果经 RRF 融合排序。
Highlights
okf search -q "..." -semantic自然语言检索概念,结果标注来源semantic/lexical/both- 全新 CLI 组:
okf vector index | status | rebuild - 每平台二进制内嵌该平台的 ONNX Runtime 动态库与 MiniLM 模型(~33–38MB,按平台裁剪)
- MCP server 新增
okf_semantic_search工具 - 指纹稳定化:CLI 与 MCP 跨进程检索一致(修复 MCP 语义检索 0 结果)
- 依赖锁定:pure-onnx v0.0.1 (MIT)、coder/hnsw v0.6.1 (CC0-1.0);
renameio由本地跨平台 fork 替代(上游 v1.0.1 无法在 Windows 编译)
Quick start
# install
curl -fsSL https://raw.githubusercontent.com/superops-team/okf/v0.4.0/scripts/install.sh | bash
# build the vector index once, then search semantically
okf vector index
okf search -q "check my notes for errors" -semanticInstall
Linux / macOS:
curl -fsSL https://raw.githubusercontent.com/superops-team/okf/v0.4.0/scripts/install.sh | bashWindows (PowerShell):
iwr -useb https://raw.githubusercontent.com/superops-team/okf/v0.4.0/scripts/install.ps1 | iexBuild from source:
go install github.com/superops-team/okf/cmd/okf@v0.4.0Behavior notes
- ONNX Runtime 动态库在运行时从缓存解包加载(
os.UserCacheDir()/okf/,可用OKF_ORT_DIR覆盖),二进制自包含但非静态链接 - MiniLM 单概念截断 256 token;模型以英文语义为主,中文语义质量有限(词法检索仍可用)
- 概念删除/内容变更需
okf vector rebuild全量重建(变更检测增量留待后续版本) - 发布平台:linux amd64/arm64、darwin amd64/arm64、windows amd64(windows/arm64 因上游 ORT 不再发布该平台 CPU 包而暂不提供)