跳到主内容
精选86MarkTechPost(RSS)产品发布/更新

Qwen开源zg:统一本地搜索层,降低Coding Agent工具调用成本

Qwen Developers Open-Sources zg (zvec-grep): A Local-First Search Layer Unifying ripgrep, BM25, and Vector Search

原文
发到 X
推荐理由

Coding Agent 开发者的实用利器,用纯本地方案显著降低工具调用开销,值得集成到你的 Agent 工作流中压测一下效果。

Coding agents spend a large share of their tool budget on search. When the target is a known symbol, ripgrep answers it exactly. When the target is a behavior described in plain language, keyword matching often misses, and the agent falls back to guessing terms, reading whole files, and assembling context by hand. Each of those detours costs tool calls, tokens, and wall-clock time.

编码代理将其工具预算的很大一部分用于搜索。当目标是已知符号时,ripgrep 能给出精确答案。当目标是以自然语言描述的行为时,关键词匹配往往会遗漏,代理只能退而求其次猜测术语、通读整个文件并手动组装上下文。这些迂回操作每次都会消耗工具调用次数、Token 和实际时间。

The Qwen Developer team announced zg (zvec-grep), an open-source local-first search layer that puts semantic search, BM25, and ripgrep behind one interface for both humans and agents. The code ships under the zvec-ai GitHub organization with an Apache 2.0 license.

Qwen Developer 团队发布了 zg(zvec-grep),这是一个开源的本地优先搜索层,为人类和代理提供了一个统一的接口,背后融合了语义搜索、BM25 和 ripgrep。代码在 zvec-ai GitHub 组织下发布,采用 Apache 2.0 许可证。

Is it deployable? Yes, today. It installs from npm as @zvec/zvec-grep, requires Node.js 22 or newer on macOS, Linux, or Windows, needs no GPU with the default model, and the Apache 2.0 license permits commercial use.

它可以部署吗?可以,今天就可以。它通过 npm 安装为 @zvec/zvec-grep,在 macOS、Linux 或 Windows 上需要 Node.js 22 或更高版本,使用默认模型时无需 GPU,且 Apache 2.0 许可证允许商业使用。

One index, four retrieval routes

一个索引,四种检索路径

zg indexes a workspace once and then exposes several ways to query it. The retrieval pipeline docs define four routes: a hybrid default that combines intent with lexical anchors, --fts for BM25-ranked exact terms, --vector for conceptual similarity with no lexical ranking, and --rg for exhaustive literal or regex matching. The first three read the index. The --rg route needs no index at all, which matters when a repository has not been indexed yet.

zg 对工作区建立一次索引,然后提供多种查询方式。检索管道文档定义了四种路径:结合意图与词汇锚点的混合默认模式、用于 BM25 排名精确词的 --fts、用于无词汇排名的概念相似性的 --vector,以及用于穷举字面或正则匹配的 --rg。前三种读取索引。--rg 路径完全不需要索引,这在仓库尚未建立索引时尤为重要。

An anonymous workspace index lives in <root>/.zvec-grep/. Both .git and .zvec-grep are always excluded, along with common dependency, build, cache, and log directories, plus anything the repository’s own ignore rules exclude. Re-running zg index updates incrementally; changing the embedding model requires an explicit --rebuild because vector spaces from different models are incompatible even at matching dimensions.

匿名工作区索引位于 <root>/.zvec-grep/ 中。.git 和 .zvec-grep 始终被排除,同时排除常见的依赖、构建、缓存和日志目录,以及仓库自身忽略规则所排除的任何内容。重新运行 zg index 会进行增量更新;更改嵌入模型需要显式执行 --rebuild,因为不同模型的向量空间即使在维度匹配的情况下也不兼容。

Indexed results report a freshness state of fresh or possibly_stale, so an agent can act on a good-enough result instead of running a status preflight first.

索引结果报告的新鲜度状态为 fresh(新鲜)或 possibly_stale(可能过时),因此代理可以直接利用足够好的结果,而无需先运行状态预检。

The MCP surface agents actually see

代理实际看到的 MCP 表面

zg install detects Codex, Claude Code, Cursor, and OpenCode on the machine and wires up the 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.

zg install 会检测机器上的 Codex、Claude Code、Cursor 和 OpenCode,并配置本地 MCP 集成。服务器在仅环回端点 http://127.0.0.1:7999/mcp 上使用 Streamable HTTP MCP 协议通信,并支持可选的 bearer 认证。

The design decision worth noting is restraint. Per the MCP guide, 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. Index lifecycle stays with the CLI. A six-tool compatibility set that adds index create, drop, status, and server status exists but is opt-in through zg server on --mcp-toolset full, and the docs state that an agent must never silently create, rebuild, or delete a persistent index.

值得注意的设计决策是克制。根据 MCP 指南,默认代理工具集仅暴露两个工具:zvec_grep_search 用于意图明确但确切字符串未知的情况,以及 zvec_grep_rg 用于已知符号、路径或正则表达式的场景。索引生命周期仍由 CLI 管理。存在一个包含 index create、drop、status 和 server status 的六工具兼容集,但需通过 zg server on --mcp-toolset full 显式启用,且文档明确指出代理绝不应静默创建、重建或删除持久化索引。

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 so the compact result format holds.

输出格式旨在优化上下文经济性。结果按文件分组返回并附带行跨度信息,除非特别请求,否则默认省略索引源预览。zg 还会拒绝 --json、--count、-l 和 --vimgrep 等会改变输出的 ripgrep 标志,以保持紧凑的结果格式。

Embeddings run on device by default

嵌入模型默认在设备端运行

The embedding catalog currently documents 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; because it uses static vector lookup, 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.

嵌入目录目前记录了十个本地模型和三个远程 Qwen 端点。快速入门默认的 local/potion-code-16m-v2 是一个 Model2Vec 静态模型,具有 256 维输出和 8,192 token 的输入限制;由于它使用静态向量查找,选择 GPU 并不能加速其运行。更重的本地选项包括 jina-embeddings-v2-base-code、embeddinggemma-300m 和 qwen3-embedding-0.6b。远程选项包括 qwen/qwen3.7-text-embedding(支持 128,000 个输入 token)和多模态的 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, revocable with zg auth revoke. The launch post cites eleven on-device models against ten in the current docs, a small discrepancy worth flagging.

远程使用受到限制。配置提供商凭据并不授权数据传输;这需要针对单个命令使用 --allow-remote,或通过 zg auth grant 进行签名的工作区授权,并可通过 zg auth revoke 撤销。发布博文提到有十一个设备端模型,而当前文档中为十个,这一细微差异值得指出。

What the benchmark numbers say

基准测试数据说明了什么

The evaluation numbers appear in the launch post, not in the repository, where the benchmarks section is still a placeholder. Both 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 is excluded from the tables.

评估数据出现在发布博文中,而非代码库中,因为基准测试部分目前仍是占位符。两次运行均为配对 A/B 测试,保持代理、模型、提示词、运行时和任务约束固定,zg 条件仅增加预建索引、MCP 工具和用法指导。表格中未包含索引构建成本。

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.

在20道题的SWE-QA-Bench样本上,zg将工具调用减少了一半以上,输入token减少了近一半,同时将Judge评分提高了1.50分。在80道题的BrowseComp-Plus样本上,准确率从98.67%提升至99.00%,同时输入token下降了37.56%,工具调用下降了43.52%,智能体时间缩短了38.58%。此外,据报道,在Apple M4 Pro上索引Django仓库(3,457个文件)可在30秒内完成。

Sample sizes of 20 and 80 questions are small, and the reported reductions come from the vendor’s own runs, so independent replication is the obvious next step.

20和80道题的样本量较小,且报告的缩减数据来自供应商自身的运行结果,因此独立复现是显而易见的下一步工作。

Interactive explainer

交互式解释器

Key Takeaways

关键要点

  • zg unifies ripgrep, BM25, and vector search behind one local-first interface for humans and agents.
  • The default MCP toolset exposes only two tools; index lifecycle stays with the CLI by design.
  • Indexing, embedding, and retrieval run on device; remote embeddings need explicit per-command or workspace authorization.
  • Vendor A/B runs report roughly 40% to 50% cuts in tool calls and input tokens on small samples.
  • Apache 2.0, npm-installable, Node.js 22+, no GPU needed with the default model.
  • zg在统一的本地优先界面下整合了ripgrep、BM25和向量搜索,供人类和智能体使用。
  • 默认的MCP工具集仅暴露两个工具;索引生命周期按设计保留在CLI中。
  • 索引、嵌入和检索均在设备端运行;远程嵌入需要针对每个命令或工作区进行显式授权。
  • 供应商的A/B测试报告称,在小样本上工具调用和输入token分别减少了约40%至50%。
  • Apache 2.0许可,可通过npm安装,支持Node.js 22+,默认模型无需GPU。

Check out the zvec-ai/zvec-grep, Qwen Developers launch post and Roadmap. Also, feel free to follow us on Twitter and don’t forget to join our 150k+ML SubReddit and Subscribe to our Newsletter. Wait! are you on telegram? now you can join us on telegram as well.

请查看zvec-ai/zvec-grep、Qwen Developers的发布博文以及路线图。也欢迎在Twitter上关注我们,别忘了加入我们拥有15万+成员的ML SubReddit并订阅我们的新闻通讯。等等!你在Telegram上吗?现在你也可以加入我们的Telegram群组。

Need to partner with us for promoting your GitHub Repo OR Hugging Face Page OR Product Release OR Webinar etc.? Connect with us

希望与我们合作推广您的GitHub仓库、Hugging Face页面、产品发布或网络研讨会等?请与我们联系

The post Qwen Developers Open-Sources zg (zvec-grep): A Local-First Search Layer Unifying ripgrep, BM25, and Vector Search appeared first on MarkTechPost.

本文《Qwen Developers开源zg (zvec-grep):一个统一ripgrep、BM25和向量搜索的本地优先搜索层》首发于MarkTechPost。

更进一步:量化金融体系

看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力

进入量化体系 →

关联讨论

同一事件的更多信源

相似阅读

另一事件,读法相近