microsoft/tgrep

Trigram-indexed grep with a client/server architecture for fast regex search in large codebases locally

View on GitHub ↗Jump to charts ↓Open shareable report →

Data as of . Signed-in members get hourly updates — create a free account.

Summary Information

Updated 1 hour ago
Added to GitGenius on September 21st, 2026
Created on April 3rd, 2026
Open Issues & Pull Requests: 0 (+0)
GitHub issues: Enabled
Number of forks: 135
Total Stargazers: 3,352 (+0)
Total Subscribers: 15 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 8.5 hours
Mean response time: 20.6 hours
90th percentile: 3.0 days
Tracked items: 21

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 0
New in 7 days: 1
Closed in 7 days: 2
Avg open age: N/A days
Stale 30+ days: 0
Stale 90+ days: 0

Recent activity

Opened in 7 days: 1
Closed in 7 days: 2
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • enhancement (7)
  • bug (1)

Most active issues this week

Sign in to see which issues are moving.
Sign in

Detailed Description

tgrep is a trigram-indexed grep tool with a client/server architecture for fast regex search in large codebases.

The problem tgrep solves is the performance penalty of scanning every file on every search, which becomes prohibitively slow in monorepos with hundreds of thousands of files. Tools like grep and ripgrep must examine all bytes in the repository for each query. tgrep pre-builds a trigram index that identifies which files could possibly match a given pattern, so searches only need to examine a small subset of files. The architecture uses a persistent server that maintains both an on-disk memory-mapped index and an in-memory overlay for recently modified files, with a background indexer that builds the index in parallel batches while clients can search against incomplete indexes.

Developers working with large codebases should consider tgrep if search latency is a bottleneck. The tool is particularly suited for monorepos with tens of thousands of files or more, where the speedup over ripgrep can exceed fifty times on some platforms. The project is integrated into GitHub Copilot CLI and provides agent integration for AI coding assistants through an MCP interface. The benchmark results show that tgrep's advantage is most pronounced on macOS and Windows with very large repositories, though the margin depends on repository size and match volume—queries returning tens of thousands of matches spend more time delivering results than the index saves on finding them.

The project shows active development with regular updates to the indexing pipeline and server architecture. The codebase includes comprehensive benchmarking documentation and platform-specific optimizations. The tool provides detailed configuration options for background indexing batch sizes and periodic flushing intervals to balance memory usage and index freshness. Integration guides for agent-based workflows are maintained alongside the core functionality.