
Wiki Retrieve
Build and query a vault-local contextual BM25 retrieval index with optional...
Install
npx skills add AgriciDaniel/claude-obsidian --skill wiki-retrieve -g -a claude-code -y- Repository
- AgriciDaniel/claude-obsidian16.1k
- Category
- Engineering
- Updated
- 10d ago
- License
- MIT
- Context cost
- Mediumabout 1,698 tokens
- Runs scripts
- No, instructions only
What it does
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.
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.
