Semble - Code search for agents that uses 98% fewer tokens than grep
Key point
Semble claims a 98% token reduction over grep+read for code search built for agents.
Details
Semble is a code search library built so agents can instantly find only the code snippets they need via natural-language or code queries. Instead of reading entire files, it returns only relevant chunks, using about 98% fewer tokens compared to grep+read. It reports indexing an average repository in about 250ms and answering queries in about 1.5ms. Because it uses a static embedding model, there's no transformer forward pass at query time, and it runs on CPU with no API keys, GPU, or external services required.
The benchmark was conducted across 63 repositories in 19 languages with about 1,250 queries. Semble reported achieving 99% of CodeRankEmbed Hybrid quality while indexing 218x faster, and in token-efficiency tests it recorded 94% recall using only 2k tokens.
The implementation uses tree-sitter to create code-aware chunks, combines Model2Vec's potion-code-16M embeddings with BM25, and merges the scores via Reciprocal Rank Fusion. It also applies symbol-type query weighting, definition chunk boosting, identifier stem matching, same-file relevance, and downweighting for tests, legacy code, examples, and .d.ts files.
Its use cases are broad.
- As an MCP server, it can be used with Claude Code, Cursor, Codex, OpenCode, and others.
- For Bash integration,
semble searchandsemble find-relatedworkflows can be added toAGENTS.mdandCLAUDE.md. - In Python, it can be integrated into custom tools via
SembleIndex.from_path,from_git,search, andfind_related. - The CLI accepts both local paths and Git URLs, and defaults to the current directory if
pathis omitted. semble savingsestimates the savings per search and stores them in~/.semble/savings.jsonl.
The package can be installed as semble from PyPI, and it is licensed under MIT.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.