semble
Semble is a code search library built for agents. It returns the exact code snippets an agent needs, aiming to cut both token use and waiting time on every step. In Python you index a local directory with `SembleIndex.from_path` or a remote repository with `from_git`, search with a natural-language or code query, and call `find_related` to get code similar to a result; each result carries the file path, line range and content. Install with `pip install semble` or `uv add semble`.
It can also run as an MCP server (set up for Claude Code, Codex, OpenCode and Cursor, requiring uv) with two tools, search and find_related; repositories are cloned and indexed on demand and indexes are cached for the session. Files are split into code-aware chunks and scored by two retrievers, then fused and reranked with code-aware signals: adaptive weighting for symbol-like queries, boosts for chunks that define the queried symbol, identifier stems, file coherence, and penalties for tests, legacy shims, examples and type stubs. Because the embedding model is static, no transformer runs at query time. The README reports about 250 ms to index a repo and 1.5 ms per query on CPU with NDCG@10 of 0.854 on about 1,250 queries across 63 repositories in 19 languages; the project is MIT licensed.