wiki-retrieve
它能做什么
这个技能为你的 wiki 创建搜索索引,并针对某个问题返回最相关的段落。适合拥有大量笔记、希望快速准确查找的人。
适用场景
- ✓当你的 wiki 很大,并且你想为某个问题找到相关段落时。
- ✓当你想为知识库建立或刷新本地搜索索引时。
- ✓当你需要诊断为什么搜索会返回这样的结果时。
技能链接
https://github.com/AgriciDaniel/claude-obsidian/blob/main/skills/wiki-retrieve/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请为我的 wiki 建立搜索索引,并找出关于我们招聘流程的段落。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会把你的页面切分成小块,在这台电脑上建立关键词索引,并返回最匹配的摘录及其所在页面。任何远程处理都需要你明确同意。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Retrieve relevant passages
This extension derives search data from wiki/ into .vault-meta/. It never
changes canonical notes. Always pass the selected vault explicitly.
Resolve the installed product root from this skill's own location, not from the vault or current working directory:
PRODUCT_ROOT=/absolute/path/to/installed/claude-obsidian
PREFIX="$PRODUCT_ROOT/scripts/contextual-prefix.py"
BM25="$PRODUCT_ROOT/scripts/bm25-index.py"
RETRIEVE="$PRODUCT_ROOT/scripts/retrieve.py"
RERANK="$PRODUCT_ROOT/scripts/rerank.py"
test -f "$PREFIX" && test -f "$BM25" && test -f "$RETRIEVE" && test -f "$RERANK"
Pipeline
contextual-prefix.pysplits pages on paragraph boundaries and stores the raw chunk plus a short page-level prefix.bm25-index.pybuilds a local, standard-library BM25 index over the contextualized text.retrieve.pyselects BM25 candidates, optionally reranks them, rejects invalid records, deduplicates by page, and returns paths and snippets.- The caller reads the returned pages and performs synthesis; retrieval output is not itself evidence.
Provision locally
Preview first, then build synthetic prefixes without network egress:
python3 "$PREFIX" --vault "$VAULT" --all --no-llm --peek
python3 "$PREFIX" --vault "$VAULT" --all --no-llm
python3 "$BM25" --vault "$VAULT" build
python3 "$RETRIEVE" --vault "$VAULT" "wiki" --top 1 --no-rerank --explain
Chunk and index files are disposable runtime state. Incremental prefixing skips records whose chunk hashes, page hashes and provider/model profile still match. Legacy records without that profile regenerate on an explicit build. A complete scan removes surplus records for deleted pages, and the prefixer invalidates the BM25 index before changing its chunk set so a mixed stale index is not served. Prefix and BM25 build operations share the vault-wide mutation lock with every other writer; a busy vault fails closed instead of publishing a partial index.
Contextual-prefix privacy
Synthetic prefixes use only local frontmatter and page text. The explicit
Anthropic API profile can send page bodies off-machine and requires the user's
consent plus --allow-egress and a configured API key. There is no Claude CLI
generation tier or ambient subprocess fallback. Never infer consent from an
API key or installed binary. Preview the scope first and state which provider
will receive what data.
Remote Ollama endpoints also require explicit approval and
--allow-remote-ollama; the default reranker accepts localhost only.
Local model prefixes are a separate explicit option. Use an already installed
exact name:tag; no server is started and no model is installed or pulled:
python3 "$PREFIX" --vault "$VAULT" --all --local-ollama --ollama-model installed:tag --peek
python3 "$PREFIX" --vault "$VAULT" --all --local-ollama --ollama-model installed:tag
The prefix adapter verifies cloud-disabled server status and local model
identity before sending page text. Unsupported or unavailable preflight falls
back to synthetic prefixes for new or changed chunks only; prefixes from the
same endpoint and model stay in place, so a transient outage leaves an
unchanged vault's chunks and BM25 index untouched. This requirement can exclude
older Ollama servers.
Reranking and tiling use the same local-only proof before query, page, chunk,
or embedding cache work. --allow-remote-ollama approves the endpoint, not
cloud delegation by the server.
See prefix providers for the exact policy,
cloud model selection and verification limits. The reranker has its own model
and endpoint policy; selecting local prefixes does not enable reranking.
Query
For a strictly read-only lookup, use the prebuilt BM25 index:
python3 "$RETRIEVE" --vault "$VAULT" "$QUERY" --top 5 --no-rerank --explain
For an explicitly requested rerank, omit --no-rerank. The default is Ollama's
multilingual nomic-embed-text-v2-moe model (approximately 958 MB); the product
never pulls it automatically. To use an already-installed, smaller,
English-oriented v1.5 model, pass --model nomic-embed-text explicitly.
Nomic models use search_query: for the query and search_document: for
candidate text. Nomic v2 has a 512-token input context and Ollama truncates
longer embedding inputs by default; BM25 still scores the complete chunk.
Embeddings are cached by exact model, verified digest, input scheme, and hash
of
常见问题
它会把我的笔记发送到互联网上吗?
除非你明确同意,否则不会。远程处理需要你的同意,否则索引只保存在你的电脑上。
它会改动我的笔记吗?
不会。索引作为派生数据存储,规范笔记不会被更改。
如果重新排序步骤不可用怎么办?
搜索会退回到较简单的关键词方法,因此仍然会返回结果。
详情
作者的原始描述
Build and query a vault-local contextual BM25 retrieval index with optional multilingual Nomic cosine reranking; use for retrieve, hybrid retrieval, BM25, rerank, contextual retrieval, chunk search, vault search, semantic search, find relevant passages, or retrieval diagnostics. Derived caches stay under .vault-meta, remote egress requires explicit consent, and unavailable reranking falls back deterministically.
热度
- GitHub 星标
- 16k
- 排名
- #10817
- 许可证
- MIT
- 更新时间
- 2026/10/25
评论
- …
同一仓库的更多技能
autoresearch
16k让你的智能体在设定的范围内研究某个主题,并起草带引用的报告。网络发现的内容只作为证据保存,不会自动加入你的笔记。
canvas
16k帮你的智能体在 Obsidian 中创建和更新可视化画板,画板可以容纳笔记、文件、链接和分组,适合制作思维导图和空间布局。
defuddle
16k帮你的智能体规划如何把网页清理成可读的文本,并保存源文件的本地副本。网络清理功能目前尚不可用。
obsidian-bases
16k帮你的智能体设计 Obsidian Bases 视图,使其像简单的数据库一样工作,支持筛选、公式,以及表格或卡片布局。