Overview
Semble is a code search library built for AI agents rather than for humans reading results in an editor. When an agent explores an unfamiliar codebase with grep and file reads, most of the tokens it burns are lines it did not need. Semble returns the specific chunks that answer the query, which the project measures at roughly 99% fewer tokens than a grep-and-read loop.
It runs entirely on your machine: no API key, no GPU, no external service. Indexing an average repository takes about 500ms and a query answers in about 1ms on CPU, because retrieval combines Model2Vec static embeddings with BM25 lexical matching through reciprocal rank fusion instead of calling a transformer at query time. Chunking is tree-sitter based, so a result is a whole function or class rather than an arbitrary window, and a code-aware reranking pass adds definition boosts, identifier stemming, file coherence and noise penalties.
You can use it three ways: as a CLI, as a Python library, or — most commonly — as an MCP server. `semble install` detects your coding agents and wires it up, exposing a `search` tool for natural-language queries and a `find_related` tool that returns chunks semantically similar to a given file and line.
What it does
- Indexes an average repo in ~500ms and answers queries in ~1ms, on CPU only — no API key, GPU or external service
- Retrieval combines Model2Vec embeddings with BM25 through reciprocal rank fusion, plus code-aware reranking signals
- Tree-sitter chunking, so results are coherent code units with file path and line range attached
- MCP server compatible with Claude Code, Cursor, Codex, OpenCode and other MCP agents, exposing `search` and `find_related`
- Accepts a local path or a git URL and caches the index automatically
- Respects `.gitignore` and `.sembleignore`; skips files over 1MB unless `SEMBLE_MAX_FILE_BYTES` is raised
- Reports 0.854 NDCG@10 across a 63-repository, 19-language benchmark, matching the 137M-parameter CodeRankEmbed while indexing far faster
Getting started
Install the CLI, then let the interactive installer wire Semble into whichever coding agents you have. Everything runs locally.
Install the tool
`semble install` detects your agents and offers MCP server, instructions or sub-agent integration.
uv tool install semble
semble installOr install unattended
Useful in a dotfiles or provisioning script.
semble install --agent claude --type mcp subagent --yesSearch from the CLI
Point it at a local path or a git URL. `find-related` takes a file and a line number instead of a query.
semble search "authentication flow" ./my-project
semble search "save model to disk" https://github.com/MinishLab/model2vec
semble search "deployment guide" ./my-project --content docs
semble find-related src/auth.py 42 ./my-project
semble savingsUse it as a Python library
Build an index from a path and search it directly; each result carries the chunk's file path, line range and content.
from semble import ContentType, SembleIndex
index = SembleIndex.from_path("./my-project")
results = index.search("save model to disk", top_k=3)
result = results[0]
result.chunk.file_path
result.chunk.start_line
result.chunk.end_line
result.chunk.contentCommands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Cut the token cost of a coding agent exploring an unfamiliar repository, by returning snippets instead of whole files
- Give an agent semantic code search on a machine with no GPU and no outbound API calls
- Find every place that resembles a given function or line, using `find_related`, before a refactor
- Search a public repository by git URL without cloning it first
How Semble compares
Semble alongside other open-source code indexing & search tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| CodeGraph | ★ 70.3k | Builds a local SQLite knowledge graph of a codebase with a Rust tree-sitter kernel, keeps it in sync through a file watcher, and serves symbols, call paths and blast radius to coding agents over MCP. |
| GitNexus | ★ 47.2k | Indexes a codebase into a knowledge graph of dependencies, call chains and execution flows, then exposes it to Claude Code, Cursor and Codex through MCP tools. |
| Claude Context | ★ 12.5k | An MCP server that indexes your codebase into a vector database so AI coding agents can find relevant code by meaning instead of loading whole folders. |
| Semble | ★ 6k | CPU-only code search that hands an agent snippets instead of whole files |