Skip to main content

glep: indexed grep and glob

Indexed grep + glob for AI coding agents.

PyPI crates.io CI License: MIT

Documentation: https://velofy.co/glep/

ripgrep pays the full scan cost on every query. glep pays it once: a persistent, self-healing trigram index answers warm queries in 21 to 298 ms on a Linux-kernel-sized tree where ripgrep takes 1.4 s, with text output byte-compatible with ripgrep's, enforced by a 24-case differential harness in CI. No daemon.

Install

pip install glep          # binary wheel, no Rust toolchain needed
# or
cargo install glep

pipx install glep and uv tool install glep also work. crates.io currently has 0.2.3; PyPI has 0.3.0. See Installation for platforms and other routes.

Example

cd your-project
glep index                      # one-time build; lazy on first query anyway
glep 'fn parse_intent' src/     # content search (Grep replacement)
glep --files '**/*.py'          # glob listing (Glob replacement)

Features

  • Trigram index in .glep/, memory-mapped, about 10% of corpus size on the kernel tree.
  • Self-healing: every query runs a parallel mtime sweep and reindexes only what changed. No watcher, no background process.
  • Sound fallback: patterns the index cannot narrow fall back to a full parallel scan. Never a wrong answer; worst case is ripgrep speed.
  • ripgrep-compatible: built on ripgrep's crates (ignore, grep-searcher, regex-syntax). Text output is byte-compatible with rg; --json emits rg's event stream including the closing summary event.
  • Familiar flags: -i -F -l -c -U -e -g -t -C -A -B --json --hidden --no-ignore.
  • Agent integrations: a Claude Code skill and PreToolUse hook (claude/install.sh) and a Cursor hook (cursor/install.sh) that route built-in Grep/Glob calls through glep.

Interface

glep 'fn parse_intent' src/     # content search (Grep replacement)
glep --files '**/*.py'          # glob listing (Glob replacement)
glep --json 'pattern'           # machine-readable output (includes rg's summary event)
glep -c 'pattern'               # per-file match counts (rg -c)
glep -l -i -F -U ...            # files-with-matches, case-insensitive, fixed, multiline
glep -A 2 -B 1 'pattern'        # context, or -C n for both sides
glep -g '*.rs' -t rust ...      # glob and type filters
glep --hidden 'TODO'            # include dotfiles (.git is always excluded)
glep --no-ignore ...            # search ignored files too (live scan, index untouched)
glep --ttl 5 ...                # skip the freshness sweep within a read burst
glep --max-filesize 2000000 ... # raise the 1MB index cap
glep index                      # explicit (re)build; lazy on first query
glep status                     # index stats

--no-ignore always pays a full scan: it bypasses the index entirely, so gitignored trees never enter it. It costs the same as rg --no-ignore, every time.

With an explicit path argument, bytes_printed in the JSON summary can differ from rg's (rg prints ./-prefixed paths; glep prints them bare).

Other known differences from rg: files with a NUL byte in the first 8 KB (including UTF-16 text) are treated as binary and never searched, and .gitignore rules apply even outside a git repository (like rg --no-require-git). The index lives in .glep/ in the directory you run glep from, so run it from the project root.

When to use it

Use glep for:

  • Agent sessions firing dozens of searches over one repo (the bundled hooks reroute Grep/Glob).
  • Monorepos where rg takes 100 ms or more per query.
  • Repeated glob listings: glep --files reads the manifest, no re-walk past the freshness sweep.
  • Read-heavy bursts with --ttl 5 to amortize the freshness sweep.
  • Correctness-critical work: self-healing index, sound full-scan fallback.

Stick with rg / fd for:

  • One-off searches in a tree you will never search again.
  • Small repos where rg already answers in under about 50 ms.
  • Ephemeral CI runners where the index never persists between runs.
  • rg features glep lacks: replacements, PCRE2, compressed files.
  • Corpora dominated by binaries or files over the 1 MB cap (live-scanned anyway).

Numbers

Linux kernel 6.12 checkout: 86,605 files, about 1.5 GB. Apple Silicon macOS, hyperfine medians, warm filesystem cache, rg and fd at their default parallelism.

Scenario glep (glep --ttl 5) rg / fd
Rare pattern 173 ms (21 ms) rg 1.42 s
Common pattern, ~10k matches 298 ms (90 ms) rg 1.54 s
List all .c files 242 ms (44 ms) fd 92 ms

Index build (one-time): 24 s. Index size: 154 MB. Default glep pays the freshness sweep (a stat of every file) on each query; --ttl amortizes it across read bursts. Details: Benchmarks.

Documentation

Design spec: docs/superpowers/specs/2026-07-14-glep-design.md.

Contributing

Issues and pull requests are welcome at https://github.com/velofy/glep. CI runs on Linux, macOS, and Windows:

cargo test --all                                  # parity tests need rg on PATH
cargo build
PATH="$PWD/target/debug:$PATH" claude/hooks/test_hook.sh
PATH="$PWD/target/debug:$PATH" cursor/hooks/test_hook.sh

CI also rejects em dash and en dash characters anywhere in the repository.

License

MIT. See LICENSE.

Metadata

Release files for glep 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for glep 0.3.1
File
glep-0.3.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
glep-0.3.1-py3-none-musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64 Details
glep-0.3.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details
glep-0.3.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details
glep-0.3.1-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
glep-0.3.1-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details

Total release size: 10.9 MB

Release files / glep-0.3.1-py3-none-win_amd64.whl

Download URL glep-0.3.1-py3-none-win_amd64.whl
Size 1.6 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
64a62872ae18c7374a50defeeaba40684fb2befb159b8d2bb5fc651cd2c8edbc
BLAKE2b-256 checksum
How to use checksums
9b1c6502fa18cd5fd526ea7fcdcb5d14e49732ffb2002eaf3197d25108983a01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / glep-0.3.1-py3-none-musllinux_1_2_x86_64.whl

Download URL glep-0.3.1-py3-none-musllinux_1_2_x86_64.whl
Size 2.0 MB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
7436129450c84e10c9c82515cd5325b7278c92138de566477d533154d177d0c2
BLAKE2b-256 checksum
How to use checksums
0950936d60f74c56b8b82b9e6fd431b87a14cc1d81f4a9c6e5b9ebd29b61b688
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / glep-0.3.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL glep-0.3.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.9 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
a7c2f452487853d57441cd10a2508eb5d261e8759c40e9d4889a960f291ce715
BLAKE2b-256 checksum
How to use checksums
b456155311265733b6b4d6e86de3de827c29d2c854cdecb7c26e354568b82c27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / glep-0.3.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL glep-0.3.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.9 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
ed2b2178a9ce10f7ef1ba01b248ebe001416d2ff313ace604b8da73d3b2e2d2d
BLAKE2b-256 checksum
How to use checksums
fd35e69f913a5a71a803aed5eae0b9db4756c6c6ba574c6a324cab428601f2dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / glep-0.3.1-py3-none-macosx_11_0_arm64.whl

Download URL glep-0.3.1-py3-none-macosx_11_0_arm64.whl
Size 1.7 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d570ba39507efbb33ca961a119df9bf5a52cd0af7ce7fc5a62ccc4e67d55c9a9
BLAKE2b-256 checksum
How to use checksums
6d878215550d13679cb1d280926f2e4d2f69d4cbf661b7ea8c8f7fa2542d82d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / glep-0.3.1-py3-none-macosx_10_12_x86_64.whl

Download URL glep-0.3.1-py3-none-macosx_10_12_x86_64.whl
Size 1.8 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
257862b3d1554611086a213e0b11ea1575fc6777ded9522a79f79cb03a9b598e
BLAKE2b-256 checksum
How to use checksums
21b1756db286c75f4bd518a7e03384505112bbef8771ec249f29d6214ec3e571
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release history Release notifications | RSS feed

This release

0.3.1 This release

6 release files

0.3.0

6 release files

0.2.3

6 release files

0.2.2

6 release files

0.2.1

5 release files

0.2.0

5 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page