
Owen718/snapgrep
80Last commit Aug 15, 2026
snapgrep DSH plugin
snapgrep is a native addon that builds and queries a trigram index over a git snapshot, all within the agent process. It replaces the built-in grep and glob tools in DSH, providing dramatically faster code search with byte-for-byte correctness verified against ripgrep.
How to install the snapgrep DSH plugin
dsh plugin --profile headless add snapgrepCopying does not run this command. Review the repository and version before installing the snapgrep DSH plugin.
snapgrep DSH plugin data source
snapgrep DSH plugin snapshot date: Aug 16, 2026
discovered
What the snapgrep DSH plugin can do
- Index-backed code search using trigrams, typically 40–70× faster than ripgrep on a warm index.
- No sidecar process or daemon; runs as a single 3.2 MB native addon inside the agent process.
- Correctness guaranteed: every result is checked against ripgrep, byte for byte, with missing=0 and extra=0.
- Automatic fallback to ripgrep for unsupported query types, ensuring no partial answers.
- Index rebuilds after file modifications, with recovery time of 41–62 ms on a 300-file repository.
- Prebuilt binaries for macOS (Apple Silicon & Intel), Linux (x64 & arm64, glibc), and Windows x64.
Where the snapgrep DSH plugin fits
- Accelerating code search in large repositories within coding agents like Pi or DSH.
- Replacing grep and glob tools in DSH to reduce search latency from hundreds of milliseconds to a few milliseconds.
- Handling frequent grep calls in development workflows without spawning external processes.
- Searching for rare tokens or symbols across thousands of files with near-instant results.
Who the snapgrep DSH plugin is for
- Developers using Pi or DSH as coding agents who need fast code search.
- Users of DeepSeek Harness (DSH) who want to optimize their grep and glob operations.
snapgrep DSH plugin limitations
- Only supports platforms with prebuilt binaries: macOS (Apple Silicon & Intel), Linux (x64 & arm64, glibc), and Windows x64. Alpine/musl is not built yet.
- Index rebuild is required after file modifications, during which searches fall back to ripgrep (correct but not accelerated).
- Some query types fall back to ripgrep: binary files with NUL-byte output, regex combined with path/glob filters, literals shorter than 3 bytes or spanning line breaks, case-insensitive search with non-ASCII pattern, and glob syntax outside proven subset.
- The speedup diminishes when most files match (e.g., 2.6× when every file matches).
snapgrep DSH plugin: from the repository README
Quoted from the Owen718/snapgrep README, the upstream source of the snapgrep DSH plugin. Copyright remains with the original authors.
An in-process trigram index that makes code search in <a href="https://github.com/earendil-works/pi">Pi</a><br> <b>Typically 40–70× faster than ripgrep</b> on a warm index —<br> and every result is checked against ripgrep, byte for byte. </p> <p align="center"> <img src="assets/demo.gif" alt="Terminal demo: ripgrep takes 147.7 ms to search a 17 MB repository while snapgrep takes 2.1 ms, drawn to true scale" width="820"> </p> <p align="center"> No sidecar process. No daemon. A single 3.2 MB native addon loaded inside the agent process. </p> ## Install ### Pi ```sh npm install -g snapgrep ``` Pi's built-in `grep` is replaced automatically, in every project. To confirm, ask Pi to search for a string you know exists — the tool detail shows `actualBackend: kernel`. ### oh-my-pi (omp) ```sh npm install -g snapgrep ``` Same package, no changes: omp treats `@earendil-works/pi-coding-agent` as an aliased scope and its loader accepts `.pi` directories alongside `.omp`. ### DeepSeek Harness (dsh) ```sh dsh plugin --profile headless add snapgrep ``` Verify with `dsh --profile headless --dump-config | grep snapgrep`. It replaces both `grep` and `glob`: the registry rejects
Read the full READMERepository license: MIT
snapgrep DSH plugin questions
How do I install snapgrep in DSH?
Run `dsh plugin --profile headless add snapgrep`. Verify with `dsh --profile headless --dump-config | grep snapgrep`. It replaces the built-in grep and glob tools automatically.
Does snapgrep work on all operating systems?
Prebuilt binaries are available for macOS (Apple Silicon and Intel), Linux (x64 and arm64, glibc), and Windows x64. Alpine/musl is not supported yet. On unsupported platforms, the extension will report the exact missing file.
Is snapgrep's search results as accurate as ripgrep?
Yes, every result set is checked against ripgrep on the same snapshot with the same flags. The bar is missing=0 and extra=0, and also identical ordering, byte offsets, context lines, and truncation behavior. All 24 conformance queries match ripgrep exactly.
How does snapgrep handle query types it doesn't support?
It falls back to a full ripgrep search rather than returning a partial answer. Fallback is reported in the result metadata with a reason. Currently falling back queries include binary files with NUL-byte output, regex combined with path/glob filters, literals shorter than 3 bytes, etc.
What happens when I edit files while snapgrep is running?
Before any tool that can modify files runs, in-flight searches are drained and the index is invalidated. After the tool finishes, the index is rebuilt from the current working tree. During rebuild, searches fall back to ripgrep. Recovery time is 41–62 ms on a 300-file repository.