zg (zvec-grep) is a local search tool that combines exact text and regex matching, BM25 ranking, and vector search over one index of a workspace. You can run it as a command-line tool or expose it to a coding agent, which then decides on its own when to call it. It is built on the zvec vector database, and this entry covers the TypeScript implementation (a Rust implementation is developed separately).
The intended loop is to find candidates by meaning, rank them by relevance, and then confirm with exact text or a regex. It indexes source code with symbols, signatures, and breadcrumbs, and retrieves prose as focused sections and chunks, so results come back ranked and linked to file locations. The aim is for an agent to reach the right evidence with fewer tool calls and fewer input tokens than broad file scans.
Files, indexes, and local embedding models stay on the machine by default, and remote embedding providers receive data only with permission. Local embeddings can run through llama.cpp, Transformers.js, or Potion/model2vec, on CPU or GPU, with tunable indexing concurrency. It runs either as one-off commands or as a long-running local server, on macOS, Linux, and Windows.
Agent integrations cover Codex, Claude Code, Qwen Code, Qoder, Cursor, GitHub Copilot, VS Code, Grok Build, and OpenCode through MCP. Published benchmarks use paired A/B agent runs (SWE-QA-Bench with Claude Code, BrowseComp-Plus with Codex) and repository case studies on Pylint, Matplotlib, and Django that compare answer quality, input tokens, tool calls, and time with and without zg. Gains are largest when the evidence spans several files and its location is not known in advance.
Features
- Hybrid retrieval: ripgrep-style exact and regex search, BM25 ranking, and vector search behind one interface
- Code-aware indexing: code is indexed with symbols, signatures, and breadcrumbs, and prose as sections and chunks
- Multi-format search: source code, documents, and structured data, with source locations preserved
- Agent integration: an MCP server for Codex, Claude Code, Qwen Code, Qoder, Cursor, GitHub Copilot, VS Code, Grok Build, and OpenCode
- Local by default: indexes and local models stay on the machine, and remote embeddings are used only with permission
- Embedding backends: local models through llama.cpp, Transformers.js, or Potion/model2vec, or remote embedding providers
- Execution modes: one-off direct commands or a long-running local server that keeps indexes fresh
- Benchmarked: paired A/B runs on SWE-QA-Bench and BrowseComp-Plus measuring answer quality, tokens, tool calls, and time


