Metadata-Version: 2.4
Name: glep
Version: 0.1.1
License-File: LICENSE
Summary: Indexed grep + glob for AI agents
Author: anishfyi
License: MIT
Requires-Python: >=3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Repository, https://github.com/anishfyi/glep

<p align="center">
  <img src="https://raw.githubusercontent.com/anishfyi/glep/main/assets/logo.svg" width="400" alt="glep">
</p>

<p align="center"><strong>Indexed grep + glob for AI agents.</strong></p>

Ripgrep pays the full scan cost on every query. glep pays it once: a persistent, self-healing trigram index answers warm content queries in ~1-20ms and glob listings with zero filesystem traversal, with output byte-compatible with ripgrep's and 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; warm glep answers in ~1-20ms | Small repos where rg already answers in under ~50ms |
| Repeated glob listings: `glep --files` reads the manifest, no traversal | Ephemeral CI runners where the index never persists between runs |
| Read-heavy bursts with `--ttl 5` to amortize the freshness sweep | rg features glep v1 lacks: count mode, replacements, multiline, 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) |

## How it works

- A file-level trigram inverted index (the Russ Cox / csearch model) lives in `.glep/`, memory-mapped, a few percent of corpus size.
- 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

```bash
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 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

```bash
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](https://github.com/anishfyi/glep/blob/main/docs/superpowers/specs/2026-07-14-glep-design.md).

