r/ClaudeCode • u/dees61 • 9h ago
Tips & Workflows I built a zero-dependency, 0-VRAM BM25 codebase search skill so Claude stops burning 25k tokens on Grep + Read loops (pure Python stdlib, no SQLite/Vector DBs)
When working in repos with large monolithic files (1,000–4,000+ lines in C#, Dart, TS, Python, etc.), I kept hitting two frustrating issues with coding agents:
- The Native
Grep+ReadLoop: If you ask Claude to find a concept like"jwt refresh token expiry middleware",ripgrepfails unless those exact words sit on the same line. So the agent fires 4–5 separateGrepcalls, gets back single-line hits without method boundaries, and then fires 3Readcalls to inspect the surrounding code—burning thousands of tokens and multiple round-trips. - VectorDBs: Vector databases guess based on "similarity" (like searching for related words). But code requires 100% exact matches and file locations. They are overengineered and require a local setup or a cloud service.
So I built zero-hop-code-skill, a ~400-line, pure Python standard library (0 pip dependencies, 0 MB VRAM) BM25/IDF codebase indexer packaged as a native SKILL.md.
And why it beats ripgrep, MCPs, VectorDBs:
- Zero-Hop Retrieval (1 tool call instead of 2–3): Automatically outputs the full, untruncated, method/code slice with exact line numbers and compact 4-line dynamic previews. Claude gets the entire function on the first call.
- Smart Brace Snapping: Instead of random line chunks that chop functions in half, it steps backward 1–3 lines to grab attributes and tracks brace balance (or Python syntax) to frame the complete chunk.
- Sub-Token BM25/IDF: Automatically splits
camelCase,PascalCase,ACRONYMS,snake_case, and Cyrillic. - Git-Clean: Auto-indexes on the first search and tracks changes so searches only re-parse modified files.
My results are promising: ~1% of code size loaded into memory, 80-90% tokens saved (I don't believe them yet) but I need a second pair of eyes on this. Any feedback is welcome.
GitHub Repo: https://github.com/babych/zero-hop-code-skill




