Top
Best
New

Posted by Bibabomas 13 hours ago

Show HN: Semble – Code search for agents that uses 98% fewer tokens than grep(github.com)
Hey HN! We (Stephan and Thomas) recently open-sourced Semble. We kept running into the same problem while using Claude Code on large codebases: when the agent can't find something directly, it falls back to grep, reading full files or launching subagents. This uses a lot of tokens, and often still misses the relevant code. There are existing tools for this, but they were either too slow to index on demand, needed API keys, or had poor retrieval quality.

Semble is our solution for this. It combines static Model2Vec embeddings (using our latest static model: potion-code-16M) with BM25, fused via RRF and reranked with code-aware signals. Everything runs on CPU since there's no transformers involved. On our benchmark of ~1250 query/document pairs across 63 repos and 19 languages, it uses 98% fewer tokens than grep+read and reaches 99% of the retrieval quality of a 137M-parameter code-trained transformer, while being ~200x faster.

Main features:

- Token-efficient: 98% fewer tokens than grep+read

- Fast: ~250ms to index a typical repo on our benchmark, ~1.5ms per query on CPU (very large repos may take longer)

- Accurate: 0.854 NDCG@10, 99% of the best transformer setup we tested

- MCP server: drop-in for Claude Code, Cursor, Codex, OpenCode

- Zero config: no API keys, no GPU, no external services

Install in Claude Code with: claude mcp add semble -s user -- uvx --from "semble[mcp]" semble

Or check our README for other installation instructions, benchmarks, and methodology:

Semble: https://github.com/MinishLab/semble

Benchmarks: https://github.com/MinishLab/semble/tree/main/benchmarks

Model: https://huggingface.co/minishlab/potion-code-16M

Let us know if you have any feedback or questions!

211 points | 61 commentspage 2
nextaccountic 7 hours ago|
How does this compare with colgrep?

https://github.com/lightonai/next-plaid/tree/main/colgrep

stephantul 1 hour ago|
The comparison is in the benchmarks, see the README
abcdefg12 7 hours ago||
Shouldn’t it be a part of the harness at least for local codebase? I wonder how many harnesses are doing that already.
Bibabomas 3 minutes ago||
Afaik many harnesses ship the "default" which is grep+read (like Claude Code). But I agree, IMO it's a weird gap. To be fair I don't think providers are that incentivised to reduce token burn at the moment, but my guess is that that will change and tools like this will become at least an natively supported option in some harnesses.
dopidopHN2 7 hours ago||
I'm playing with PI as a custom harness ( for Claude code because that what is provided to me )

I will try that ! It make sense and I'm curious to see results, for this or any similar projects mentioned in the thread

molszanski 6 hours ago||
allegedly this one is good for PI https://pi.dev/packages/@ff-labs/pi-fff
_ink_ 6 hours ago||
Would this replace something like codebase-memory-mcp[1] or improve when both is being used?

[1] - https://github.com/DeusData/codebase-memory-mcp

gslepak 2 hours ago||
Does this support any language or is it limited to a specific set of languages?
stephantul 1 hour ago|
For chunking Semble supports all languages supported by tree-sitter-language-pack. The models we train are trained on 6 languages, but can handle way more.
jahala 6 hours ago||
This looks great! I built a tool in the same space- and I found that the biggest challenge was often to get the agent to prefer to use the tool over bash tools. What’s your experience with that?
Escapade5160 6 hours ago|
Setup hooks. Hooks are how your harness forces compliance with your own rules.
smcleod 7 hours ago||
How does it compare to context-mode or serina that are both well established now?
onoesworkacct 4 hours ago||
fantastic token savings and performance... but unlike grep it's probabilistic search on search terms.

is that an issue? the tiny model might not surface something important

stephantul 26 minutes ago|
It's not probabilistic, and exact matches will always be preferred over non-exact. So if you search for a function name this will surface it.
esafranchik 11 hours ago||
Is the benchmark measuring one-shot retrieval accuracy, or Coding agent response accuracy?
stephantul 11 hours ago|
Hey! Co-author here. The benchmark currently only measures retrieval accuracy.

We’re interested in measuring it end to end and also optimizing, e.g. the prompt and tools, for this, but we just haven’t gotten around to it.

esafranchik 11 hours ago||
Two follow-ups:

1) How do you compare accuracy? by checking if the answer is in any of the returned grep/bm25/semble snippets?

2) How do you measure token use without the agent, prompt, and tools?

stephantul 11 hours ago||
1) yes! It’s not accuracy, but ndcg 2) we assume that if the agent gets the correct answer in the returned snippets it does not need to read further
esafranchik 11 hours ago||
Wouldn't NDCG/token results vary wildly depending on the agent's query and the number of returned items?

e.g. agents often run `grep -m 5 "QUERY"` with different queries, instead of one big grep for all items.

stephantul 10 hours ago||
The same holds for semble: the agent can fire off many different semble queries with different k/parameters.

I guess the point we’re trying to make is that you need fewer semble queries to achieve the same outcome, compared to grep+readfile calls.

porker 7 hours ago||
Congratulations on the release!

Could you add fff to the benchmarks?

stephantul 1 hour ago|
We hadn't found that one yet. Will do!
mrpf1ster 10 hours ago|
Does this work well for non-coding documents as well? Say api docs or AI memory files?
stephantul 10 hours ago|
Hey, this is something we're actively investigating. We recently added a flag, `--include-text-files`, which, when set, also makes Semble index regular documents (i.e., markdown, text, json). This should also work relatively well.
More comments...