К основному содержанию
скилл CX Codex

wiki-retrieve — скилл для Claude Code: поиск по заметкам

Скилл wiki-retrieve для Claude Code строит локальный BM25-индекс заметок из wiki/ и ищет в нём фрагменты. Находит связанные страницы для передачи агенту на разбор.

MIT 348 установок ★ 16 676 обновлён 2026-10-22

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add AgriciDaniel/claude-obsidian --skill wiki-retrieve -a claude-code
Открыть на GitHub

Что делает wiki-retrieve

wiki-retrieve делит страницы на фрагменты, добавляет к ним краткий контекст страницы и строит индекс BM25. Поиск возвращает пути и выдержки; агент читает найденные страницы и сам формирует ответ. Индекс и производные данные хранятся в .vault-meta, исходные заметки скилл не меняет.

Для дополнительного ранжирования можно использовать мультиязычную модель Nomic через Ollama. Если модель или сервис недоступны, результаты остаются в исходном порядке BM25. Для удалённых Ollama и Anthropic API нужны явное согласие и соответствующие флаги; без этого данные не должны отправляться за пределы машины. Вызовы требуют Python 3 и выбранного пути хранилища через --vault.

Какие задачи решает

  • найти фрагменты по запросу в заметках wiki/
  • собрать локальный BM25-индекс для хранилища
  • переранжировать результаты поиска моделью Nomic
  • проверить статистику индекса и объяснить результаты BM25

Примеры запросов агенту

  • Найди в wiki/ заметки о настройке поиска и покажи пять подходящих фрагментов без переранжирования.
  • Построй индекс для выбранного хранилища и проверь запрос wiki с объяснением результатов.
  • Переранжируй найденные страницы моделью nomic-embed-text, если она уже установлена в Ollama.

Как установить wiki-retrieve

1Через Skills CLI (Vercel)

npx skills add AgriciDaniel/claude-obsidian --skill wiki-retrieve -a claude-code

2Вручную: положить файлы

~/.claude/skills/wiki-retrieve/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/wiki-retrieve/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о wiki-retrieve

Как установить wiki-retrieve в Claude Code?

Выполните npx skills add AgriciDaniel/claude-obsidian --skill wiki-retrieve -a claude-code. Файл скилла будет доступен по пути ~/.claude/skills/wiki-retrieve/SKILL.md.

Что делает wiki-retrieve?

Он строит локальный BM25-индекс заметок из wiki/ и возвращает подходящие фрагменты с путями к страницам. Агент читает найденное и отдельно формирует ответ.

Нужна ли модель для поиска?

Нет, базовый поиск использует BM25. Переранжирование через Ollama необязательно; при недоступности модели результаты остаются в порядке BM25.

Исходный текст

SKILL.md · MIT
---
name: wiki-retrieve
description: "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:

```bash
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

1. `contextual-prefix.py` splits pages on paragraph boundaries and stores the
   raw chunk plus a short page-level prefix.
2. `bm25-index.py` builds a local, standard-library BM25 index over the
   contextualized text.
3. `retrieve.py` selects BM25 candidates, optionally reranks them, rejects
   invalid records, deduplicates by page, and returns paths and snippets.
4. 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:

```bash
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:

```bash
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](../../docs/prefix-providers.md) 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:

```bash
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 the exact prefixed input. A missing local Ollama service, malformed HTTP
reply, missing selected model, unusable vector, or any candidate embedding
failure falls back for the complete result set to the original BM25 order; it
never mixes cosine and BM25 score scales.

Query input is bounded at 8,000 normalized characters and result counts must be
between 1 and 1,000. Oversized queries and invalid limits fail with an
actionable usage error instead of looking like an empty successful search.
An untagged model request matches only the installed untagged name or its
`:latest` alias; select any other tag explicitly.

Use direct diagnostics when needed:

```bash
python3 "$BM25" --vault "$VAULT" stats
python3 "$BM25" --vault "$VAULT" query "$QUERY" --top 10
python3 "$RERANK" --vault "$VAULT" "$QUERY" --peek
python3 "$RERANK" --vault "$VAULT" "$QUERY" --model nomic-embed-text --peek
```

## Integrity rules

- Accept only relative chunk and page paths whose resolved targets remain under
  `$VAULT/.vault-meta/chunks/` and `$VAULT/wiki/` respectively.
- Reject hashless legacy chunk records and require chunk-body, page, and index
  hashes to match before a cached record can be built or served.
- Reject absolute paths, symlink escapes, missing pages, mismatched chunk IDs,
  changed page hashes, and stale index/chunk hash pairs.
- Rerank the full candidate set, then deduplicate by page, then apply `--top`.
- An empty index is an honest no-result state. A missing or corrupt index makes
  `retrieve.py` exit 10 with a stable rebuild command; callers fall back to the
  standard vault query/text-search path and do not fabricate matches.
- Do not cite benchmark percentages unless a reproducible vault-specific
  benchmark produced them.

Measure a prebuilt index against explicit labels with `bench --queries FILE
--vault VAULT`. See [offline retrieval evaluation](../../docs/retrieval-evaluation.md)
for recall, MRR, missing labels and negative cases. This is a read-only
measurement and never silently rebuilds an index or calls a model.

## Checkpoint

Observe cache readiness and privacy boundaries, think about whether lexical or
semantic ranking is needed, verify returned paths and source freshness, and
grow by measuring retrieval misses against a maintained local query set.

© AgriciDaniel · MIT · AgriciDaniel/claude-obsidian

Похожие скиллы

Все скиллы по теме «Настройка агента: память, контекст, субагенты» →
llm-wiki Ar9av Скилл llm-wiki для Claude Code задаёт устройство личной вики в Obsidian: слои источников, категории, проекты и шаблон страницы. Определяет структуру хранения знаний, а не загрузку файлов. CX Codex +1 4 200установок wiki-ingest Ar9av Скилл wiki-ingest забирает документы, папки, сырой текст и ссылки в вики Obsidian: перерабатывает их в связанные страницы и пропускает то, что уже разобрано. CX Codex +1 3 700установок wiki-query Rohit Ghumare Скилл wiki-query находит релевантные фрагменты в локальных вики через полнотекстовый поиск SQLite FTS5 с ранжированием BM25. Пригодится перед созданием новых заметок, чтобы избежать дубликатов. CX Codex +1 ★ 2 966звёзд репо wiki Rohit Ghumare Команда wiki для Claude Code ведёт долговременные исследовательские базы знаний. Хранит страницы в Markdown, индексирует их в SQLite FTS5 и находит данные через BM25. CX Codex +1 ★ 2 966звёзд репо llm-wiki-plugin praneybehl Плагин llm-wiki-plugin для Claude Code превращает PDF, статьи и заметки в вики с поиском по цитатам. Агент находит нужный раздел, отвечает со ссылками и сохраняет полезные выводы обратно. ★ 124звёзд репо wiki-knowledge-complier bradduy Плагин wiki-knowledge-complier превращает документы в личную базу знаний на markdown-файлах: плагин разбирает источники, строит граф сущностей и отвечает на вопросы по ним. ★ 12звёзд репо

Из того же набора15

Весь набор →
wiki-query Скилл wiki-query отвечает на вопрос по выбранному хранилищу Obsidian и не меняет в нём ни одного файла. Полезен, когда источником доказательств назначена сама вики. CX Codex +1 512установок wiki-lint Скилл wiki-lint прогоняет детерминированную проверку Obsidian-вики: битые ссылки, страницы-сироты, пробелы во frontmatter. Ничего не правит — только показывает. CX Codex +1 508установок canvas Создаёт и правит доски Obsidian в формате JSON Canvas: текстовые блоки, файлы, ссылки, группы и связи между узлами. Собирает визуальную карту хранилища. CX Codex +1 500установок defuddle Планирует извлечение через Defuddle и сохраняет уже готовые локальные файлы в хранилище. Сетевой очистки внутри нет — только план и захват. CX Codex +1 478установок wiki-fold Скилл wiki-fold для Claude Code собирает сводку из записей wiki/log.md в хранилище Obsidian. По запросу на свёртку он сначала показывает черновик и не меняет дочерние страницы. CX Codex +1 445установок wiki-mode Скилл wiki-mode определяет методологию хранилища Obsidian (PARA, LYT, Zettelkasten или Generic) и предлагает папки для новых заметок без перезаписи существующих файлов. CX Codex +1 344установок wiki-cli Скилл wiki-cli проверяет, можно ли читать хранилище Obsidian через официальный CLI, и ищет по заметкам. Если CLI не готов, читает файлы напрямую. CX Codex +1 341установок think Скилл применяет десятиэтапный цикл OBSERVE–LISTEN–THINK–CONNECT–FEEL–ACCEPT–CREATE–GROW к сложным решениям, архитектурным выборам и разборам. Помогает отделить факты от предположений и выявить скрытые риски. CX Codex +1 337установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой