📈 GH Trending Explorer 🎲 Surprise me

← all repos

context-dot-dev / sgrep

git clone https://github.com/context-dot-dev/sgrep.git v0.3.0 · 11d ago

—

—
stars, 24h
—
stars, 7 days
+320
stars, 30 days · #821
320
★ total
10
forks · 6 open issues

Star history starts 2026-10-20; the chart appears after the second daily snapshot.

LanguagePython
LicenseMIT
Created2026-10-07 (13d ago)
Last push5d ago
Watchers0
OwnerOrganization

Links

README excerpt
sgrep 
 Search code and documents in plain English. Runs locally. 
## Why sgrep
Agents often know what code should do before they know a name to search.
sgrep finds local passages by words and meaning. It can also rank the results of a focused ripgrep command.
No account, hosted index, or model server is needed.
 When to use ripgrep, CK, or mgrep 
- ripgrep is the right tool for known names, exact text, and regexes. For an intent query, an agent must first choose useful patterns. Broad patterns can return too much; narrow ones can miss relevant code.
- CK offers local semantic and hybrid search, several embedding models, and an MCP server. Account for index construction and updates as well as query time. Its semantic mode beats sgrep on our CoSQA test. Our CK results use BGE Small, not every CK model or mode.
- mgrep offers hosted semantic search, reranking, and agent integrations. It syncs files to Mixedbread and needs authentication. Agents must account for sync completion, network access, and upload limits. It is not measured in this benchmark.
Use sgrep when local semantic discovery and a small CPU model suit the job.
The benchmark notes also record CK query-parser failures and missing indexed files.
## Install
Requires Rust 1.90 or later and ripgrep.
 [code] 
Or download a macOS Apple Silicon binary.
Remove any older Python install with `uv tool uninstall sgrep` or `pip uninstall sgrep` first.
## Search
 [code] 
Results show the file, line range, and source. Use `-n 10` for ten results or `--json` for JSON output.
To rank only the results from ripgrep:
 [code] 
Run both commands from the same directory. Use ripgrep for exact matches; sgrep can return approximate matches.
The first search downloads a model (32–34 MB) and any required code parsers. Later searches can run offline.
Source and queries stay on your machine. The local index stores copies of source passages.
## Code and documents
Auto mode selects the text model only when all candidate passages have prose extensions, such as `.md` or `.txt`.
Mixed code and prose use the code model. Text mode targets general English prose. To choose explicitly:
 [code] 
Code uses syntax-aware chunks where supported. Other text uses text chunks. This does not parse PDFs or images.
Both modes return source passages, not generated answers. The benchmarks below measure code retrieval, not document search.
## Static embeddings
A static model stores one learned vector per token.
The code model distills CodeRankEmbed and trains on code/query pairs.
sgrep looks up those vectors, averages them, and normalizes the result to 256 numbers.
Related text can have similar vectors without sharing exact words.
There is no transformer pass at search time. This supports local CPU search with a small model and no per-query API call.
Averaging loses token order and can miss context. sgrep combines semantic scores with BM25 and gives exact identifiers priority.
A high score is a ranking signal, not proof that code performs