← Back to Skills Marketplace
fantasyrl

doc-search

by FantasyRL · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
173
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install doc-search
Description
Search a local document library (Obsidian vault, wiki, notes, etc.) using BM25 inverted index + LLM query expansion + grep for precise location. Use when the...
README (SKILL.md)

Doc Search

BM25 inverted index + LLM query expansion + grep. Zero external dependencies.

Workflow

Follow these steps in order every time:

Step 1 — Resolve docs_dir

Check if the user mentioned a docs directory. If not, ask:

"Which directory should I search? (e.g. ~/obsidian, ~/notes)"

Step 2 — Check index exists

ls \x3Cdocs_dir>/.cache/index.json
  • If missing → go to Step 3 (build index first)
  • If exists → skip to Step 4

Step 3 — Build index

python3 ~/.claude/skills/doc-search/scripts/build_index.py \x3Cdocs_dir>

Index saved to \x3Cdocs_dir>/.doc-search/index.json. Incremental on subsequent runs.

Step 4 — Expand query terms

Before searching, expand the user's query to cover synonyms, Chinese/English variants, and likely headings. Combine into one string:

"获取音色列表" → "获取 查询 list voice 音色 tts ListVoice 音色列表"

Step 5 — BM25 search

python3 ~/.claude/skills/doc-search/scripts/search.py "\x3Cexpanded query>" \
  --docs-dir \x3Cdocs_dir> --topk 5

Output: JSON array [{path, rel, score, title, summary}, ...]

Step 6 — Grep top-K for precise location

For each result file, grep with the original keywords:

grep -ni -e "keyword1" -e "keyword2" /path/to/doc.md

Report file path + matching line numbers to the user.

Options

Flag Default Description
--topk 5 Number of BM25 results
--ext md,txt,rst,org File extensions to index
--index \x3Cdocs_dir>/.doc-search/index.json Override index path
Usage Guidance
This skill is coherent for local document search and appears to run entirely on your machine (no network calls or secrets required). Before installing or running it: 1) verify where the index will be written — the code writes to <docs_dir>/.cache/index.json but README/SKILL.md also mention .doc-search (fix or be explicit about the path you want); 2) confirm the platform places the scripts at the SKILL.md path (~/.claude/skills/doc-search/scripts/) or adjust the commands to where you store the files; 3) do not point the skill at sensitive system directories — it will read all files under the docs_dir and create an index file there; 4) be aware the SKILL.md expects the agent/LLM to expand the query (the Python search script expects an already-expanded string), so ensure the agent performs expansion or pass expanded queries yourself; 5) inspect the scripts locally (they are plain Python) and run them manually once to confirm behavior before giving the agent permission to invoke them automatically.
Capability Analysis
Type: OpenClaw Skill Name: doc-search Version: 1.0.0 The doc-search skill is a legitimate local document indexing and retrieval tool using BM25 and grep. The Python scripts (build_index.py and search.py) use only standard libraries to process local files and generate a JSON index, with no evidence of network activity, data exfiltration, or obfuscation. The SKILL.md instructions provide a transparent workflow for the AI agent to interact with the local filesystem for the stated purpose of searching user-specified directories.
Capability Assessment
Purpose & Capability
Name/description (local document search using BM25 + LLM expansion + grep) align with the included scripts which build a local inverted index and perform BM25 ranking and JSON output. Required binaries/credentials/config are minimal/none, which is appropriate for a pure-local search tool.
Instruction Scope
The SKILL.md instructions are generally scoped to indexing and searching the user-provided docs_dir, and to running local grep for line-level hits. However there are inconsistencies: SKILL.md/README sometimes refer to storing the index at <docs_dir>/.doc-search/index.json while the actual scripts use <docs_dir>/.cache/index.json. SKILL.md instructs the agent to perform LLM query expansion (which is reasonable for an agent-based skill), but the included search script expects an already-expanded query string — the expansion step is not implemented in the Python code. These inconsistencies could cause the workflow to fail unless the agent or installer follows the correct conventions.
Install Mechanism
No install spec (instruction-only) and included Python scripts are plain text; no network downloads, no package installs, and no archive extraction. Execution is local via python3. This is low-risk from an install-mechanism perspective.
Credentials
The skill requests no environment variables, credentials, or unrelated config paths. It does read user files under the provided docs_dir and writes an index file into the docs directory (per code: <docs_dir>/.cache/index.json). That filesystem access is expected and proportionate to the stated purpose.
Persistence & Privilege
Flags show always:false and normal autonomous invocation allowed. The skill writes an index file next to the documents (per code) and does not request elevated privileges or attempt to modify other skills or system-wide settings.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install doc-search
  3. After installation, invoke the skill by name or use /doc-search
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
- Initial release of doc-search: search local document libraries using BM25, LLM query expansion, and grep. - Supports Chinese and English queries, synonyms, and custom query expansions. - Zero external dependencies; uses simple bash and Python scripts. - Step-by-step workflow includes index building, query expansion, and line-precise grep results. - Flexible options for file extensions, result count, and index location.
Metadata
Slug doc-search
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is doc-search?

Search a local document library (Obsidian vault, wiki, notes, etc.) using BM25 inverted index + LLM query expansion + grep for precise location. Use when the... It is an AI Agent Skill for Claude Code / OpenClaw, with 173 downloads so far.

How do I install doc-search?

Run "/install doc-search" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is doc-search free?

Yes, doc-search is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does doc-search support?

doc-search is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created doc-search?

It is built and maintained by FantasyRL (@fantasyrl); the current version is v1.0.0.

💬 Comments