zvec-grep

zvec-aiApache-2.0活跃维护

本地优先的工作区全文与语义搜索工具,支持 BM25 和向量检索,提供 CLI 与 MCP 接口,方便人和 AI Agent 快速定位代码与文档。

Local-first search across your workspace, built for humans and AI agents.

v0.3.0发布于 2026-11-03 07:02 UTC4,300star +10 / 7 天263fork同步于 2026-11-10 17:39 UTC

怎么上手

由 README 提炼,执行前请确认
npm install -g @zvec/zvec-grep --allow-scripts=@zvec/zvec-grep
zg --index --embedding local/potion-retrieval-32m
硬件要求按 README 说明

README 未说明显存或 GPU 要求;支持 macOS、Linux、Windows,并提供本地嵌入模型 local/potion-retrieval-32m。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

本地优先的工作区搜索工具,把 ripgrep、BM25 和向量检索统一到一个接口,人和 AI agent 都能用

本地优先的工作区全文与语义搜索工具,支持 BM25 和向量检索,提供 CLI 与 MCP 接口,方便人和 AI Agent 快速定位代码与文档。

核心能力

  • 统一 ripgrep 精确匹配、BM25 词法检索与向量语义检索
  • 用 --hybrid、--fts、--vector 分别发起多组查询并分组展示结果
  • 索引源码时保留符号、签名和调用路径等结构信息
  • 结果带文件与行号定位,减少 agent 工具调用次数和 token 消耗
  • 文件、索引和本地模型默认留在本机,远程嵌入需显式授权

容易踩的坑

npm 全局安装必须带 --allow-scripts=@zvec/zvec-grep,否则安装脚本不会执行;使用前需先对工作区建索引,索引存放在项目根目录的 .zvec-grep/ 下;接入 agent 需额外执行 zg --install --target opencode --yes,示例中的免费模型可能已不可用。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

3 个版本v0.3.0
  1. v0.3.0最新正式版2026-11-03 · 2026-11-03 07:02 UTC

    zg 0.3.0: Taking Local Search Performance Further

    zg 0.3.0 rebuilds the core execution pipeline in Rust, bringing faster indexing, lower memory use, and quicker CLI startup. This release also introduces a simpler CLI, clearer terminal interactions, and more AI agent integrations.

    Performance Improvements

    We compared Node.js 0.2.2 and Rust 0.3.0 on an Apple M3 Pro with 18 GB of memory, running macOS 27.2 and Node.js v24.16.0. Indexing tests used four public BEIR corpora—SciFact, NFCorpus, ArguAna, and FiQA—with 75,128 documents, using the same local embedding model and settings.

    MetricNode.js 0.2.2Rust 0.3.0Improvement
    Package size, including dependencies167.5 MiB34.3 MiB79.5% smaller
    CLI startup time153.1 ms26.8 ms82.5% less time
    Total index build time219.13 s77.84 s64.5% less time
    Mean peak memory during indexing (RSS)4,210.26 MiB1,968.61 MiB53.2% lower
    Mean search latency (MCP)20.93 ms14.88 ms28.9% lower

    Indexing time is totaled across the four corpora; memory is the average of their peak RSS values. MCP search latency is measured with the model and index already loaded.

    Across these corpora, total indexing time dropped from 3 minutes 39 seconds to 1 minute 18 seconds, while mean peak memory fell from 4.11 GiB to 1.92 GiB—less waiting and more room for editors, agents, and other development tools.

    These gains come from improvements throughout the execution pipeline:

    • Native startup: Removes Node.js runtime initialization and JavaScript module loading from standalone CLI invocations.
    • More efficient computation: Uses native code, explicit numeric types, and contiguous arrays in text encoding and vector computation.
    • Fewer data conversions: Reduces intermediate copies and temporary allocations.
    • Shared resources: Reuses loaded tokenizers and model data on supported local inference paths, with computation scheduled by a native thread pool.

    A Simpler CLI

    The CLI adopts an rg-inspired “query + options” format. Search directly with zg, and use options such as --index and --status for management operations.

    # Search by meaning; hybrid search is the default
    zg "where are user permissions checked"
    
    # Build an index for the current workspace
    zg --index
    
    # Find exact matches and show source line numbers
    zg --rg -n "AuthService" src
    

    Terminal colors, layout, and messages are now more consistent, with clearer model selection, indexing progress, and error guidance.

    When searching an unindexed workspace for the first time in an interactive terminal, zg guides you through selecting a local or remote model, builds the index, and continues your query.

    More Agent Integrations

    This release adds support for GitHub Copilot, Grok Build, VS Code, and Pi, alongside existing integrations with Qwen Code, Claude Code, Codex, OpenCode, and others.

    zg --install
    

    Use the interactive installer to configure zg search tools for supported clients.

    Bug Fixes

    • File change detection: Prevents stale deletion events from overriding the state of files recreated at the same path.
    • Search result locations: Fixes line-number offsets in some result previews.
    • Index management: Prevents background refreshes from recreating deleted indexes.
    • Agent configuration: Better preserves comments and unrelated settings when updating configurations.
    • Windows compatibility: Improves path handling and terminal colors.
  2. v0.2.02026-08-27 · 2026-08-27 16:15 UTC
    查看更新说明

    🎉 zvec-grep v0.2.0 — Public Preview

    We are excited to release zvec-grep v0.2.0, our first comprehensive public preview.

    zvec-grep (zg) is a local-first workspace search layer for people and AI agents. It combines ripgrep, BM25 full-text search, and vector search so you can move naturally between exact lookup and semantic discovery—without loading entire files or repositories into an agent’s context.

    This release brings the core product together: hybrid retrieval, structure-aware indexing, managed agent integrations, local and remote Embedding options, incremental updates, and a shared local MCP server.

    ✨ Highlights

    🔎 One search layer for exact and semantic retrieval

    Use natural language when you know the intent but not the exact file or symbol:

    zg query "where theme preferences are restored"
    

    Indexed search combines BM25 and vector retrieval, with Reciprocal Rank Fusion (RRF) for multi-route ranking. Queries can be narrowed by path, glob, file type, symbol type, or modification time.

    When you already know the exact text, symbol, path, or regular expression, use the managed ripgrep route instead:

    zg query --rg -n -F "AuthService" -g "*.ts" src
    

    Managed ripgrep is exhaustive by default and works without an index or Embedding model.

    🤖 Built for AI agents

    v0.2.0 includes managed MCP integrations for:

    • Codex
    • Claude Code
    • Qwen Code
    • OpenCode
    • Cursor

    Run zg install to detect and configure supported agents, or select one explicitly:

    zg install --target codex --yes
    zg install --target qwen --yes
    

    Where supported, the installer configures MCP access, retrieval guidance, and local tool approval or trust settings. The guidance helps agents choose between semantic discovery and exact lookup, combine the two when necessary, and stop searching once the available evidence is sufficient.

    📚 Search more than source code

    zvec-grep is designed for mixed-content workspaces. It can search source code, documentation, configuration, research material, notes, and structured text data through the same interface.

    This preview includes structure-aware extraction for major languages such as C, C++, Go, Java, JavaScript, TypeScript, Python, and Rust; heading-aware Markdown indexing; and text extraction for many additional programming languages and formats including JSON, YAML, TOML, CSV, HTML, XML, and plain text.

    With a compatible multimodal Embedding model, raster images can also be explicitly included in an index.

    🔒 Local-first by default

    Workspace scanning, index storage, retrieval, and local Embedding inference stay on your machine by default. The shared server listens on loopback, and workspace indexes are stored under <workspace>/.zvec-grep/.

    The built-in model catalog includes local Model2Vec, ONNX, and GGUF options for code, English documents, multilingual content, and long-context retrieval. Remote Qwen text and multimodal Embedding models are also supported, but sending workspace content or query text to a remote provider always requires separate, explicit authorization.

    ⚡ Incremental indexing and shared server mode

    Indexes can be updated incrementally while preserving the workspace’s model and file-selection settings:

    zg index --embedding local/potion-code-16m-v2
    zg index
    zg status
    

    For persistent agent workflows, the local server coordinates workspace runtimes, background refreshes, MCP access, and loaded Embedding models:

    zg server on
    zg server status
    

    CLI operations can run in auto, server, or direct mode. Managed ripgrep remains available without the server or an index.

    🎯 Compact, source-grounded results

    Search results are ranked, grouped by file, and returned with source locations and bounded previews. The default output is intentionally compact for agent context, while --human provides richer terminal output:

  3. v0.1.5zvec-grep 0.1.52026-07-16 · 2026-07-16 07:49 UTC
    查看更新说明

    Highlights

    • Introduces the command-first zg query, zg index, zg status, zg install, and zg uninstall interface.
    • Adds managed ripgrep compatibility and shared file-selection controls across indexed and no-index search.
    • Preserves index filters across refreshes and improves cross-platform result normalization.
    • Updates Codex and MCP integration, documentation, diagnostics, and release coverage.

    Compatibility

    This release intentionally includes breaking CLI changes. Use a current Node 22 LTS patch or newer; exact Node 22.0.0 may intermittently hang in native integration workloads.

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    zg (zvec-grep), powered by zvec, unifies ripgrep, BM25, and vector search behind one local-first interface. Use it directly from the terminal, or let your agent use it for you.

    🎬 See it in action

    💫 Why zg?

    • Ready for humans and agents — install once, index once, then use the same workspace from the CLI or your agent on macOS, Linux, and Windows.
    • Search beyond keywords — discover by meaning, rank by relevance, then verify with exact text or regex when needed.
    • Multi-format search — search source code, documents, and structured data while preserving useful structure and source locations.
    • Less searching, less context — ranked, source-linked results surface the right evidence with fewer tool calls, fewer tokens, and less noise.
    • Local by default — files, indexes, and local models stay on your machine; remote embeddings receive data only with your permission.

    🚀 Try it yourself

    1. Set up a sample bookshelf

    npm install -g @zvec/zvec-grep --allow-scripts=@zvec/zvec-grep
    
    mkdir zg-mystery && cd zg-mystery
    curl --retry 3 --retry-all-errors --progress-bar -fL \
      -o alice-in-wonderland.txt https://raw.githubusercontent.com/GITenberg/Alice-s-Adventures-in-Wonderland_11/master/11.txt \
      -o sherlock-holmes.txt https://raw.githubusercontent.com/GITenberg/The-Memoirs-of-Sherlock-Holmes_834/master/834.txt
    
    zg --index --embedding local/potion-retrieval-32m
    

    [!NOTE] The index is stored in .zvec-grep/ under the indexed project root.

    2. Choose how to search

    For agents: ask with OpenCode

    With OpenCode configured:

    zg --install --target opencode --yes
    opencode models
    opencode run --model opencode/nemotron-3-ultra-free \
      "An unseen creature left a few marks. What did the detective infer? Cite local evidence."
    

    Free model availability can change. Check opencode models and replace the example model with one that is currently available in your environment.

    OpenCode chooses zg on its own—the prompt does not name a tool.

    ⚙ zvec_grep_zvec_grep_search {"root":".../zg-mystery","query":"An unseen creature left a few marks. What did the detective infer?","fts":["marks","unseen creature","inferred","detective"],"fuse":true}
    → Read sherlock-holmes.txt [offset=5440, limit=120]
    
    Answer:
    The detective is Sherlock Holmes in *The Adventure of the Crooked Man*.
    From the animal's foot-marks, he inferred:
    
    - It was not a dog, cat, monkey, or other familiar creature: its print had
      five foot-pads, long nails, and was nearly as large as a dessert-spoon
      (sherlock-holmes.txt:5479-5486).
    - It had a long body and very short legs: nearly two feet long, but with a
      stride of only about three inches (sherlock-holmes.txt:5497-5502).
    - It was carnivorous because it climbed the curtain toward a canary's cage
      (sherlock-holmes.txt:5509-5510).
    - It was probably from the weasel or stoat tribe, though unusually large
      (sherlock-holmes.txt:5514-5516).
    
    Holmes also inferred that a man entered through the window with it and later
    left with the key (sherlock-holmes.txt:5464-5470, 5527-5528).
    
    For humans: search directly

    Search the same bookshelf directly, without an agent:

    zg --preview detail "An unseen creature left a few marks. What did the detective infer?" --limit 3
    

    zg returns the relevant passages from sherlock-holmes.txt, ranked ahead of alice-in-wonderland.txt.

    Use repeated --hybrid, --fts, or --vector flags for separate queries. Each nonempty result group starts with its original query and position, such as -- query 2/2: timeout --; colored output uses a dim rule and a magenta label.

    📊 Benchmarks

    Each benchmark uses paired A/B runs with tasks, agent/model, prompt, environment, and limits held constant; only zg access and usage guidance differ.

    See the benchmark documentation for full results and reproduction details.

    1. Cross-Domain Agent Benchmark

    SWE-QA-Bench uses Claude Code with Claude Opus 5 at high reasoning effort; BrowseComp-Plus uses Codex gpt-5.6-sol at medium reasoning effort. Both zg profiles use Qwen3.7 Text Embedding.

    • Why it helps: semantic discovery narrows the search space, ranked lexical retrieval anchors exact identifiers, and compact evidence reduces broad scans, repeated tool calls, and model context.
    • Why it generalizes: the same retrieval loop works across domains—code is indexed with symbols, signatures, and breadcrumbs, while prose is retrieved as focused sections and chunks.

    2. Real-World Case Studies

    • Pylint — Python static analysis: the task asks how AST node handling separates annotated and non-annotated attribute initialization. Symbol-aware retrieval is useful because the architectural entry point is not known in advance.
    • Matplotlib — plotting and rendering: the task traces FontInfo and font selection through multiple math-text rendering stages. Ranked semantic and lexical evidence helps reconstruct the cross-file data and control flow.
    • Django — web framework: the task connects username uniqueness, ORM transactions, and formset bulk operations. Compact ranked evidence brings the distributed design rationale together.
    RepositoryQuestion typeQuestion
    pylint-dev/pylintWhatArchitecture explorationWhat is the architectural pattern that distinguishes type-annotated from non-annotated instance attribute initialization using AST node type separation?
    matplotlib/matplotlibWhereData / Control-flowWhere does the FontInfo NamedTuple propagate font metrics and glyph data through the mathematical text rendering pipeline, and what control flow determines whether the postscript_name or the FT2Font object is used at different stages of character rendering?
    django/djangoWhyDesign rationaleWhy does the User model's unique constraint on the username field interact with Django's ORM transaction handling, and what cascading effects would occur if this constraint were removed on an existing database with formset-based bulk operations?

    zg works best when evidence spans files or modules and the target location is unknown, especially for call-chain, data-flow, and architectural questions. Since agents decide when and how to use it, results vary by model and run; repeated-run averages are more reliable.

    🤝 Join Our Community

    💬 DingTalk📱 WeChat🎮 DiscordX (Twitter)
    DiscordX (formerly Twitter) Follow
    Scan to joinScan to joinClick to joinClick to follow

    ❤️ Contributing

    Community contributions are always welcome—bug fixes, features, and documentation improvements all help make zvec-grep better.

    Check out our Contributing Guide to get started!