oaustegard/claude-skills/bm25
Claude Code and agent skill by oaustegard/claude-skills
- community
Checking that the SKILL.md file is still in the repository.
Ranked content search over a text corpus you point it at, using BM25 (via xhluca/bm25s). Corpus-agnostic: cloned repos, project knowledge stores, uploaded files and archives, any local directory. In-memory BM25 index per invocation, with a session-local disk cache for repeat runs against the same corpus. Use for "rank these documents", "search this corpus", "which files are most about X", "find content about Y", or any multi-word concept query against a known body of text where grep would return everything or nothing. Needs a corpus on disk. Not for searching stored memories or prior-session decisions (remembering), not for a named symbol or a file's structure (tree-sitting), and not for a literal string you could grep.
Install
npx vskill@latest install oaustegard/claude-skills/bm25SKILL.md
bm25
Ranked content search over any text corpus. One CLI, in-memory BM25 index per process, with a session-local disk cache so repeat invocations against the same corpus load in tens of milliseconds instead of rebuilding.
Setup
Install is sub-second on a warm uv cache. That's the entire dependency.
Usage
Corpus types
| Spec | Meaning | |
|---|---|---|
./path or /abs/path | Local directory | |
uploads | /mnt/user-data/uploads/ | |
project | /mnt/project/ | |
github.com/owner/repo[@ref] | Tarball fetch via GitHub API (GH_TOKEN used if set) |
Options
| Option | Default | Description | |
|---|---|---|---|
--top-k N | 10 | Results per query | |
--include GLOB | (auto) | Repeatable. If set, only files matching one of these globs are indexed | |
--exclude GLOB | Repeatable. Skip files matching these globs | ||
--snippet-lines N | 3 | Lines of snippet context per hit (0 = none) | |
--max-file-bytes N | 2,000,000 | Skip files larger than this | |
--json | Machine-readable output | ||
--interactive / -i | REPL mode for ad-hoc querying within one session | ||
--stats | Print discover + index timings as JSON | ||
--no-cache | Bypass the session-local index cache; build in-memory only |
With no --include, a default set of text/code extensions is indexed (Python, JS/TS, Go, Rust, Markdown, JSON, YAML, etc.). Standard noise dirs are skipped unconditionally: .git, node_modules, __pycache__, .venv, dist, etc.
When to use bm25
| Question shape | Tool | |
|---|---|---|
"Find lines matching class.*Error" | grep / ripgrep | |
"Show me where parse_input is defined" | tree-sitting (find:/source:) | |
| "Which files are about CSRF handling?" | bm25 | |
| "Rank these docs by relevance to 'rate limiting strategies'" | bm25 | |
| "What's the implementation of the atomic transaction context manager?" | bm25, then tree-sitting source: | |
| "Find code by natural-language concept (in a code repo)" | searching-codebases (which has its own TF-IDF mode) |
The boundary with searching-codebases: that skill is code-specific (routes between regex and TF-IDF, expands via tree-sitting AST). bm25 is the simpler general-purpose tool — any corpus, no AST awareness, no routing. Prefer searching-codebases for code; reach for bm25 when the corpus is mixed (docs + code), non-code (notes, transcripts, PDFs converted to text), or when you specifically want BM25's length-normalized scoring.
Design notes
- Session-local disk cache at
/home/claude/.bm25-cache/<key>/. The
key is a hash of (resolved_corpus_path, include_globs, exclude_globs, max_file_bytes) — any change invalidates naturally. First invocation builds and saves; subsequent invocations against the same corpus and filters load in tens of milliseconds. The cache lives in /home/claude, which is ephemeral, so it expires at the session boundary — same lifetime as the corpus state itself, no cross-session staleness. ~5–35MB per cached index, depending on corpus size.
- `--no-cache` bypasses both load and save — useful only if you've
mutated the corpus mid-session (rare) or want to confirm a rebuild matches.
- Reuse within a single invocation. The retriever stays in memory
between queries in one process. Passing multiple queries positionally, or using --interactive, amortizes any rebuild cost across queries.
- No AST awareness. Chunking is per-file. For symbol-level results in
code, combine with tree-sitting queries on the same paths.
- Tokenizer. Default
bm25s.tokenizewith stopwords disabled — over a
small Django sample, AST-derived token streams (identifiers/strings/ comments only) gave near-identical rankings, so we don't bother.
Output format
Default (human-readable):
--json produces {"query": ..., "results": [{"path", "score", "snippet"}, ...]}.
Architecture
Cache contents per directory:
bm25/— bm25s.BM25.save() output (NumPy arrays + vocab)corpus.pkl— pickled{paths, docs}so we can render snippets without
re-reading the source files
manifest.json— corpus root, files count, built_at timestamp
No network beyond optional tarball fetch on github.com/... corpora. No state outside /home/claude/, which is ephemeral.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingbm25/SKILL.md
Popularity
- Repository stars
- 151
- Repository forks
- 7
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/oaustegard/claude-skills/bm25)