| name | semble |
| description | Fast, accurate code search for AI agents using ~98% fewer tokens than grep+read. Indexes any local or remote repository in under a second (~250ms on CPU, no GPU or API key needed). Supports natural-language and symbol queries, semantic similar-code discovery, and MCP server integration for Claude Code, Codex, Cursor, and OpenCode. Python library available for programmatic use. Triggers on: semble, code search, semantic code search, semble search, token-efficient search, find code, code search mcp, agent code search, semble find-related, semble savings.
|
| allowed-tools | Read Write Bash Grep Glob WebFetch |
| metadata | {"tags":"semble, code-search, semantic-search, mcp, token-efficient, agent-tools, python, cli, codebase-navigation","platforms":"Claude Code, Codex CLI, Gemini CLI, OpenCode, Cursor","keyword":"semble","version":"latest","source":"MinishLab/semble","license":"MIT"} |
semble — Fast Token-Efficient Code Search for Agents
~98% fewer tokens than grep+read. Index in ~250ms. Query in ~1.5ms. No GPU, no API key.
Semble returns only the relevant code snippets agents need, without grepping full files or reading directories. A natural-language or symbol query like "authentication flow" or "save_pretrained" returns exact chunks with file paths and line ranges — nothing more.
Installation
MCP (Claude Code — recommended)
claude mcp add semble -s user -- uvx --from "semble[mcp]" semble
MCP (Codex)
Add to ~/.codex/config.toml:
[mcp_servers.semble]
command = "uvx"
args = ["--from", "semble[mcp]", "semble"]
MCP (Cursor)
Add to ~/.cursor/mcp.json:
{
"mcpServers": {
"semble": {
"command": "uvx",
"args": ["--from", "semble[mcp]", "semble"]
}
}
}
MCP (OpenCode)
Add to ~/.opencode/config.json:
{
"mcp": {
"semble": {
"type": "local",
"command": ["uvx", "--from", "semble[mcp]", "semble"]
}
}
}
CLI / pip
pip install semble
uv tool install semble
Skill (any platform)
npx skills add https://github.com/akillness/oh-my-skills --skill semble
When to use
- Search a codebase by describing behavior in natural language (
"how is rate limiting handled")
- Look up a symbol or identifier without knowing the exact file (
"save_pretrained")
- Discover code semantically similar to a known location (
find-related)
- Give an agent token-efficient access to any repo via MCP instead of letting it grep/read full files
- Index a remote git repo without cloning first
Do not use when
- You need to read a full file or directory listing → use native
Read, Glob tools
- You need regex or exact-string search →
Grep is more appropriate
- The repo is too small to justify indexing (a few files) — just read them directly
- You need to run tests, build, or execute code — this is a search-only tool
CLI usage
semble search "authentication flow" ./my-project
semble search "save_pretrained" ./my-project
semble search "save model to disk" ./my-project --top-k 10
semble search "save model to disk" https://github.com/MinishLab/model2vec
semble find-related src/auth.py 42 ./my-project
semble savings
semble savings --verbose
Python library
from semble import SembleIndex
index = SembleIndex.from_path("./my-project")
index = SembleIndex.from_git("https://github.com/MinishLab/model2vec")
results = index.search("save model to disk", top_k=3)
related = index.find_related(results[0], top_k=3)
result = results[0]
print(result.chunk.file_path)
print(result.chunk.start_line)
print(result.chunk.end_line)
print(result.chunk.content)
AGENTS.md / CLAUDE.md integration
Add this section to your project's AGENTS.md or CLAUDE.md to enable semble for all agents:
## Code Search
Use `semble search` to find code by describing what it does or naming a symbol, instead of grep:
```bash
semble search "authentication flow" ./my-project
semble search "save_pretrained" ./my-project
semble search "save model to disk" ./my-project --top-k 10
```
Use `semble find-related` to discover code similar to a known location (pass `file_path` and `line` from a prior search result):
```bash
semble find-related src/auth.py 42 ./my-project
```
`path` defaults to the current directory when omitted; git URLs are accepted.
If `semble` is not on `$PATH`, use `uvx --from "semble[mcp]" semble` in its place.
For Claude Code sub-agents, initialize once in the project root:
semble init
Performance benchmarks
| Metric | Semble | grep+read |
|---|
| Indexing speed | ~250ms | n/a |
| Query speed | ~1.5ms | varies |
| Token use at 94% recall | ~2k tokens | ~100k tokens |
| NDCG@10 | 0.854 | — |
| vs 137M-param CodeRankEmbed | 99% quality | — |
| Indexing vs transformer | 218× faster | — |
Operating rules
- Prefer MCP installation for interactive agent use; prefer CLI/pip for scripting and CI.
- Use
--top-k to limit results and keep context small — default is often too generous for agent prompts.
- Use
find-related after search when you need to expand from one known chunk into similar code.
- Use
semble init in project roots to pre-warm the index for Claude Code sub-agents.
- If
semble is not on $PATH, replace with uvx --from "semble[mcp]" semble in scripts.
- Treat semble as the first pass — read full files only when the returned chunk is insufficient context.
Examples
semble search "rate limiting middleware" ./api-service
semble search "database migration" ./backend --top-k 5
semble find-related src/middleware/auth.py 88 ./api-service
semble search "tokenizer padding" https://github.com/huggingface/transformers
Source: MinishLab/semble — MIT License