StackMap
Subscribe

tgrep vs zvec-grep

Microsoft's trigram-indexed grep: a client/server index narrows each regex to candidate files. Powers search in GitHub Copilot CLI; ships MCP tools and hooks for Codex and pi. Rust. — versus — zg: ripgrep, BM25 and vector search behind one local-first CLI for humans and agents — index a workspace once, search code, docs and data by meaning, then verify with exact text or regex.

The curated verdict

Both put an index behind grep for humans and agents. zvec-grep adds BM25 and vector search for meaning; tgrep stays pure regex with a trigram index and a warm server for raw speed.

tgrepzvec-grep
Stars3.4k3.8k
Forks135222
LanguageRustTypeScript
LicenseMITApache-2.0
Last activity2 days ago4 days ago
Topicscode-intel, codingcode-intel, rag, local
Curated connections45

tgrep — the curator's take

Use tgrep when ripgrep itself is the slow part — big monorepos where agents grep constantly. A trigram index narrows each regex to candidate files and a background server keeps it fresh; Microsoft's own sweep has it beating ripgrep in 17 of 18 repo/platform cases with a warm index (up to ~52x). It's what GitHub Copilot CLI uses under the hood, and an installer adds MCP search tools for Codex and pi. Mind the trade-offs: the index can lag the filesystem (use --no-index when you need what's on disk right now), patterns without useful trigrams still scan everything, and index, serve and search need matching flags. On a normal-sized repo ripgrep is already fast enough; for search by meaning use a semantic index instead.

zvec-grep — the curator's take

Give it to a coding agent that wastes tool calls grepping: `zg index` builds a local index (embeddings can stay local — potion-retrieval-32m is the default), then `zg query` returns ranked, source-linked results across code, Markdown and structured files, and the agent drops to exact/regex only to confirm. Fewer calls, fewer tokens, nothing leaves the machine unless you allow a remote embedder. Built on Alibaba's zvec engine; direct and server modes. NOT a symbol-aware tool — it doesn't know what a function is, only what text means — and NOT a graph: for call edges and blast radius use a code-intelligence server.