Skip to main content

Indexed grep + glob for AI agents

Project description

glep

Indexed grep + glob for AI agents.

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

Why

Coding agents call Grep and Glob dozens of times per session. On monorepo-scale projects each call costs seconds. glep replaces both with index-backed equivalents built on ripgrep's own crates (ignore, grep-searcher, regex-syntax), so correctness is inherited, not reimplemented.

When to use it

Use glep Stick with rg / fd
Agent sessions firing dozens of searches over one repo (the bundled hook reroutes Grep/Glob) One-off searches in a tree you will never search again
Monorepos where rg takes 100ms+ per query; glep measured 21-298 ms at kernel scale Small repos where rg already answers in under ~50ms
Repeated glob listings: glep --files reads the manifest, no re-walk past the freshness sweep Ephemeral CI runners where the index never persists between runs
Read-heavy bursts with --ttl 5 to amortize the freshness sweep rg features glep lacks: replacements, PCRE2, compressed files
Correctness-critical work: self-healing index, sound full-scan fallback Corpora dominated by binaries or files over the 1MB cap (live-scanned anyway)

Numbers

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

Scenario glep glep --ttl 5 ripgrep fd
Rare pattern 173 ms 21 ms 1.42 s
Common pattern (~10k matches) 298 ms 90 ms 1.54 s
List all .c files (--files) 242 ms 44 ms 92 ms
Index build (one-time) 24 s

Default glep pays the self-healing freshness sweep (a stat of every file) on each query; --ttl amortizes it across read bursts. Index size: 154 MB, about 10% of the corpus. The parity harness pins byte-equality with rg's output; speed differs, bytes do not.

How it works

  • A file-level trigram inverted index (the Russ Cox / csearch model) lives in .glep/, memory-mapped, about 10% of corpus size measured on the kernel tree.
  • Every query self-heals: a fast parallel mtime sweep incrementally reindexes only what changed, then answers. No watcher, no background process.
  • The regex becomes a trigram plan, postings intersection yields a handful of candidate files, and ripgrep's searcher runs over just those.
  • Patterns trigrams can't narrow fall back to a full parallel scan: never a wrong answer, worst case is rg-speed.

Interface

glep 'fn parse_intent' src/     # content search (Grep replacement)
glep --files '**/*.py'          # glob listing (Glob replacement)
glep --json 'pattern'           # machine-readable output for agents
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 --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

Ships with a Claude Code skill and a PreToolUse hook that routes built-in Grep/Glob calls through glep automatically.

Install

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

Claude Code integration (skill + hook): claude/install.sh.

Status

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

glep-0.2.3-py3-none-win_amd64.whl (1.6 MB view details)

Uploaded Python 3Windows x86-64

glep-0.2.3-py3-none-musllinux_1_2_x86_64.whl (2.0 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

glep-0.2.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.9 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

glep-0.2.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.9 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

glep-0.2.3-py3-none-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

glep-0.2.3-py3-none-macosx_10_12_x86_64.whl (1.8 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file glep-0.2.3-py3-none-win_amd64.whl.

File metadata

  • Download URL: glep-0.2.3-py3-none-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for glep-0.2.3-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 08f3423777f05c2cabd2b5f50639fbca5199be8cc6832354865215459a8fe763
MD5 f2201acfbdee9c8196413210da0de4e5
BLAKE2b-256 c920298616d3cb7db691496838b6698485decfbcc69186842ab2b919ed7c945e

See more details on using hashes here.

File details

Details for the file glep-0.2.3-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for glep-0.2.3-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 fec55aedfc022fee4fc42d78c8353d892a055169ca0e36e62687735c3a69083a
MD5 2742cb754e2ab6d307050f83cb2d4804
BLAKE2b-256 dca41a87c182901523d5b38fedf53be0e64dfc67d6440edfa7e45eb312018910

See more details on using hashes here.

File details

Details for the file glep-0.2.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for glep-0.2.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e9f863ebf08d1380f46b22a3038a8341e2b1ab77aa1c9dca73a4bb040f003de5
MD5 943f48e7d575ad33e662cc2321aee40d
BLAKE2b-256 5cbe827b756f06dad6da769aa17a0ff45ab197e4447455bffe74ac77189102e7

See more details on using hashes here.

File details

Details for the file glep-0.2.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for glep-0.2.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 369f3260534c1cf21ee0420ffec1c7dc773ae46aa331d581913ec56a0e3cc090
MD5 2f12c57a6344080f455879268e112d1a
BLAKE2b-256 2d9331e4cd8f2a9e5070a53294402ce3aac30d9024c7fd5ddcb0ded8f032885d

See more details on using hashes here.

File details

Details for the file glep-0.2.3-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for glep-0.2.3-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2e99ab3ab111752b46aa0f48589ce02a8f4400999cf99bb6ebd9d0e690a18d4f
MD5 39518a2295f5e475f7c7bcc277277e4d
BLAKE2b-256 e9a9fe4da4b677f6be32a794fc8f8c01042a599623e3862b09b82a96449da778

See more details on using hashes here.

File details

Details for the file glep-0.2.3-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for glep-0.2.3-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 31f6aac7c5bd16f10169c21dccbce9a969f8c107157693e0bd3deab0f21086eb
MD5 9d454c80814bccb4c75cdda8a24b8c77
BLAKE2b-256 a32e528cb1634b0341eaa65243acbec7afe1f4d364988420e0b75612684d2c2e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page