Preface

In large warehouses, agents repeatedly execute code searches. If each grep call rereads disk files, the latency accumulates with frequent invocations. While numerous solutions address retrieval speed through independent indexing processes, they often introduce sidecar processes or daemons, increasing startup, synchronization, and debugging costs.

snapgrep’s approach is to place the trigram index within the process for code search in Pi and DeepSeek Harness (referred to as DSH). It provides both grep and glob tools within DSH and emphasizes that search results are byte-for-byte consistent with ripgrep.

What Is This

snapgrep is maintained by Owen718 and licensed under MIT.

Its core positioning includes:

  • In-process trigram index for code search in Pi and DeepSeek Harness.
  • No sidecar process, no daemon.
  • Search results are byte-for-byte verified with ripgrep, ensuring consistency.
  • Replaces both grep and glob within DSH.
  • glob uses the same ripgrep invocation as the built-in version.
  • Unsupported queries fail closed rather than returning approximate results.
  • Verified documentation specifies a Node engine requirement of >=22.19.0.

Core Features

Replacing grep and glob in DSH

In DSH, snapgrep provides both grep and glob tools.

The documentation indicates that grep and glob are replaced within DSH; the registry rejects duplicate tool names, so the built-in search lines are disabled, and this plugin provides both tools simultaneously. glob uses the same ripgrep invocation as the built-in version.

Result Consistency

Verified facts state that search results are byte-for-byte verified with ripgrep, ensuring consistency. For unsupported queries, snapgrep fails closed rather than returning approximate results.

Deployment Form

snapgrep does not introduce sidecar processes or start daemons. The documentation also mentions that it does not compile; it only downloads addons runnable on the current machine, approximately 1.2 MB in size, consisting of two packages.

Platform Support

The pre-built versions listed in verified documentation include:

  • macOS: Apple Silicon, Intel
  • Linux: x64, arm64, glibc
  • Windows: x64

Alpine/musl is not yet built. On unsupported platforms, the plugin indicates the specific missing file rather than failing silently.

Performance Statement

snapgrep aims to improve code search speed, with the exact multiplier varying based on queries, repository size, and the number of matching files. The range stated in different sources is not entirely consistent; thus, a fixed multiplier should not be treated as a guarantee when using it.

Installation and Enabling

First, confirm that the runtime environment meets the Node engine requirement specified in the verified documentation:

>=22.19.0

The verified documentation provides the following DSH headless installation command:

dsh plugin --profile headless add snapgrep

After installation, you can check if snapgrep appears in the configuration with the following command:

dsh --profile headless --dump-config | grep snapgrep

This command is used to confirm that the current headless profile dump configuration contains snapgrep-related information.

Typical Usage

After enabling in DSH, agents can use the grep and glob tools provided by the plugin.

In Pi, you can verify the search backend: have Pi search for a known existing string, and the tool details will display:

actualBackend: kernel

Use Cases and Notes

It is suitable for scenarios where code search is frequently executed in DSH or Pi workflows, especially when you want to reduce inter-process calls and avoid additional daemons with local plugin installation.

Note:

  • The plugin runs with the permissions of the current dsh process.
  • Before installation, check the source code and license; the license provided in the verified facts is MIT.
  • Unsupported platforms will clearly prompt for missing files and will not fail silently.
  • The installation commands in the verified documentation only cover the headless profile; do not infer installation methods for other profiles based on this.
  • Performance results depend on specific queries, repository scale, and the number of matching files.

Related Links

  • Community Directory (independent site): https://www.skillhub.cn/plugins/Owen718/snapgrep
  • GitHub: https://github.com/Owen718/snapgrep