Qwen Developers Open-Sources zg (zvec-grep), a Local-First Search Layer Unifying ripgrep, BM25, and Vector Search
Qwen Developers announced zg, an open-source local-first search layer that unifies semantic search, BM25, and ripgrep for coding agents and humans.
Coding agents often spend a large share of their tool budget on search. When a known symbol is the target, ripgrep answers exactly; when a behavior is described in plain language, keyword matching can miss, forcing the agent to guess terms, read whole files, and assemble context manually. zg indexes a workspace once and exposes several query routes: a hybrid default that combines intent with lexical anchors, --fts for BM25-ranked exact terms, --vector for conceptual similarity, and --rg for exhaustive literal or regex matching. The first three read the index, while --rg needs no index. An anonymous workspace index lives in /.zvec-grep/, and .git, .zvec-grep, common dependency, build, cache, and log directories, plus repository ignore rules are excluded. Re-running zg index updates incrementally; switching embedding models requires an explicit --rebuild because vector spaces from different models are incompatible even at matching dimensions. Indexed results report a freshness state of fresh or possibly_stale.
For agents, zg install detects Codex, Claude Code, Cursor, and OpenCode on the machine and sets up a local MCP integration. The server speaks Streamable HTTP MCP on a loopback-only endpoint at http://127.0.0.1:7999/mcp, with optional bearer authentication. The default agent toolset exposes exactly two tools: zvec_grep_search for when the intent is known but the exact string is not, and zvec_grep_rg for when a symbol, path, or regex is known. A six-tool compatibility set that adds index create, drop, status, and server status is available but opt-in through zg server --mcp-toolset full, and the docs state that an agent must never silently create, rebuild, or delete a persistent index. Output is shaped for context economy: results come back grouped by file with line spans, and indexed source previews are omitted by default unless requested. zg also rejects output-changing ripgrep flags such as --json, --count, -l, and --vimgrep to preserve the compact result format.
Embeddings run on device by default. The catalog currently lists ten local models and three remote Qwen endpoints. The quickstart default, local/potion-code-16m-v2, is a Model2Vec static model with a 256-dimension output and an 8,192-token input limit; selecting a GPU does not speed it up. Heavier local options include jina-embeddings-v2-base-code, embeddinggemma-300m, and qwen3-embedding-0.6b. Remote options run to qwen/qwen3.7-text-embedding at 128,000 input tokens and the multimodal qwen/qwen3-vl-embedding. Remote use is gated: configuring a provider credential does not authorize data transfer; that requires either --allow-remote for a single command or a signed workspace grant via zg auth grant. MarkTechPost notes a small discrepancy: the launch post cites eleven on-device models while the current docs list ten.
The launch post includes performance benchmarks, while the repository’s benchmarks section remains a placeholder. The runs were paired A/B tests holding agent, model, prompt, runtime, and task constraints fixed, with the zg condition adding only a prebuilt index, MCP tools, and usage guidance; index build cost was excluded from the tables. On a 20-question SWE-QA-Bench sample, zg cut tool calls by more than half and input tokens by nearly half while raising the Judge score by 1.50 points. On an 80-question BrowseComp-Plus sample, accuracy moved from 98.67% to 99.00%, while input tokens fell 37.56%, tool calls 43.52%, and agent time 38.58%. Separately, indexing the Django repository (3,457 files) is reported to finish in under 30 seconds on an Apple M4 Pro. The sample sizes are small, and the reductions come from the vendor’s own runs, so independent replication is the obvious next step.