Vibeleaderboard
Index / tool
Category
Developer Tools
Rank
No. 1205Tools index

Previous survey · No. 1198 ·

Pricing
Open Source
Type
TOOL
Use case
Coding
Interfaces
CLI
GitHub
343 stars
Latest release
v0.3.0
Date

About

sgrep is a command-line tool that searches local code and documents using plain-English queries. It ranks passages with a small static embedding model combined with BM25, runs on CPU, and needs no account, hosted index, or model server. It can also re-rank the output of a focused ripgrep command, which helps agents that know what code should do but not what it is named.

What it does

You type a question like "when does a failed scrape consume credits" and get back the passages of your own files most likely to answer it, with file name and line range. Each passage gets two scores: a keyword-match score and a meaning score from a tiny pretrained word-vector table, so related wording can match even without shared words. Everything happens on your laptop after a one-time model download of about 32 MB. It can also take the hits from a ripgrep search and reorder them by relevance to your question.

Why it's ranked here

The pitch is narrow and the authors test it seriously. In their SWE-bench Verified run, a coding agent piping ripgrep results through sgrep spent about a fifth less on model calls than plain ripgrep and solved 70 of 100 attempts against 68. The write-up states the accuracy interval runs from minus three to plus eight points, so it claims cost savings without a quality loss, not a quality win. Those numbers come from the vendor, on datasets also used during development. Still, an MIT tool with pinned, hash-checked models and a frozen, published harness is unusually honest about its own evidence.

What's good

Model files are checked against fixed hashes before use, and a corrupted download is refused rather than loaded. The local index is rebuilt automatically when any file, ignore rule or model changes, and the source is rechecked before results print, so stale answers are hard to get. Exact identifier matches in the query are pushed to the top, which keeps the meaning score from burying the function you named. The end-to-end tests run the real binary against real models, including a check that a query containing shell syntax creates no file and that searching never modifies the repository.

Tradeoffs

The meaning score averages word vectors, which the README admits loses word order and context. On the authors' own snippet benchmark, a rival tool's semantic mode scores higher. You need ripgrep installed, and outside Apple Silicon Macs you build from source with a recent Rust toolchain. Syntax-aware splitting covers about ten languages; everything else is cut as plain text, and PDFs and images are not read at all. The on-disk index keeps copies of your source passages until cleanup, which matters on machines handling sensitive code.

How to use it well

Hand it to a coding agent that knows what behaviour it is looking for but not the name. The pattern the benchmark measured is a loose ripgrep search with a few lines of context, piped into sgrep to keep the top twenty. Use plain ripgrep when you already know the identifier or need an exact regex. Run one search online first, then set the offline flag so later runs never touch the network. It is not a question-answering tool: it returns passages, not explanations, and its benchmarks cover code, not documentation search.

Technical notes+

src/main.rs pins two Minish Lab static models by revision, size and SHA-256 (potion-code-16M-v2 as F16, potion-base-8M as F32, 256 dimensions) and src/cache.rs refuses any asset whose length or digest differs, honouring HF_HUB_OFFLINE. BM25 uses k1=1.5, b=0.75 with camelCase splitting and a stopword list; identifier_pattern promotes exact matches for tokens containing underscores, dollar signs, digits or camelCase. src/index.rs writes a single mmapped file (magic SGREPIX1, version 4) with a SHA-256 manifest of every source file, model hashes and a CRC32 trailer, and refuses to publish if the manifest changes mid-build. src/cache.rs prunes to 256 MiB, 128 entries and 30 days. src/splitter.rs maps extensions to Tree-sitter grammars for ten languages, falling back to a Chonkie recursive text chunker at 2048 characters; src/codechunker.rs ports the tree-sitter-language-pack boundary algorithm with a 512-depth cap. tests/e2e.py drives the real CLI, including shell-injection and no-write checks. Cargo.toml names mrmps/sgrep as repository while the README installs from context-dot-dev.

Observed

License
MIT
Language
Rust, edition 2024, minimum Rust 1.90 (Cargo.toml)
Interface
Command-line tool with plain-text and JSON output
Install
cargo install from Git, or a prebuilt macOS Apple Silicon binary
Runtime dependency
ripgrep must be on PATH
Models
Minish Lab Potion Code 16M v2 and Potion Base 8M, pinned by revision and SHA-256 (src/main.rs)
Network use
Downloads models and parsers on first run; offline afterwards
Code-aware splitting
Python, C/C++, C#, Go, Java, Rust, JavaScript/JSX, TypeScript/TSX (src/splitter.rs)
Tests
End-to-end CLI checks against real models, no mocked embedding model (tests/e2e.py)

Read from README.md, Cargo.toml, LICENSE, src/main.rs, src/index.rs, src/codechunker.rs, src/cache.rs, src/splitter.rs, benchmarks/README.md, tests/e2e.py.

Similar tools

Browse all tools →

Tags

code-searchsemantic-searchclirustripgrepai-agents

Tech Stack

Rust

Editorially curated, with community endorsements as a secondary signal. Corrections welcome.