
Local-first search across your workspace, built for humans and AI agents.
Local-first search across your workspace, built for humans and AI agents.
English | 中文
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.
# Requires Node.js 22 or newer.
npm install -g @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.
[!TIP] If
zg indexorzg queryfails, rerun the same command with--debugfor diagnostics (supported in both direct and server modes).zg status --mode direct --debugreports per-file failures stored in an existing index; rerun a failed direct command to diagnose command-level fatal errors. Usezg status --mode server --debugto inspect recorded server indexing errors. For server connection failures, checkzg server statusand the server logs.
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.
See the full agent run and answer…Search the same bookshelf directly, without an agent:
zg query --human "An unseen creature left a few marks. What did the detective infer?" --limit 3zg returns the relevant passages from sherlock-holmes.txt, ranked ahead of
alice-in-wonderland.txt.
zg --index --index-embedding-concurrency <n> and
ZVEC_GREP_INDEX_EMBEDDING_CONCURRENCY control embedding concurrency while
building or updating an index, for both local and remote models. The environment
variable also applies to automatic indexing and refresh. These controls do not
change query-vector inference. The CLI option is accepted only with --index.
For llama.cpp, the limit controls contexts per indexing model instance. For Transformers.js, it controls calls in flight on one cached pipeline and does not guarantee simultaneous native/GPU execution. Both cap positive integer values at 8. For Potion/model2vec, it controls concurrent embedding batches without that cap; the default is 2 and the CPU worker pool has its own capacity limit. For remote models, both controls set the maximum concurrent batches without the cap of 8. Existing adaptive scheduling and its defaults remain unchanged; it may reduce concurrency after rate limits or retryable failures.
The priority is the explicit CLI/API index option, then the index environment
variable, then ZVEC_GREP_LLAMA_CONTEXT_PARALLELISM (llama.cpp indexing only),
then the automatic default.
For llama.cpp and Transformers.js, CPU execution or a runtime without a VRAM
query uses 1 unless overridden. Transformers.js currently has no VRAM query, so
its automatic limit is 1. When a GPU runtime provides free VRAM, the limit is
floor(freeVRAM × 0.25 / 150 MiB), clamped to 1–8; a failed or invalid VRAM
query uses 2. This retains the existing 150 MiB heuristic, which is not a
guarantee that a model will fit in memory.
For CUDA errors, memory exhaustion, or native crashes, try a limit of 1 and retry the index. These examples run directly so the new environment takes effect immediately:
export ZVEC_GREP_INDEX_EMBEDDING_CONCURRENCY=1
zg --index --mode directWindows PowerShell:
$env:ZVEC_GREP_INDEX_EMBEDDING_CONCURRENCY = "1"
zg --index --mode directAn explicit CLI option overrides the environment for that index operation, including when using the daemon; no daemon restart is needed for the CLI option:
export ZVEC_GREP_INDEX_EMBEDDING_CONCURRENCY=8
zg --index --index-embedding-concurrency 1To change the daemon's environment-variable default, update its startup
environment, then run zg --server off and zg --server on from that environment.
If an agent launches zg, update its environment and restart the agent/MCP
connection too. JavaScript exceptions can be caught, but native aborts can
terminate the process before any CPU fallback runs. A limit of 1 reduces
concurrency; it does not prevent every GPU failure. You can also retry with
--device cpu.
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.
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.
|
FontInfo and font
selection through multiple math-text rendering stages. Ranked semantic and
lexical evidence helps reconstruct the cross-file data and control flow.| Repository | Question type | Question |
|---|---|---|
pylint-dev/pylint |
What Architecture exploration |
What is the architectural pattern that distinguishes type-annotated from non-annotated instance attribute initialization using AST node type separation? |
matplotlib/matplotlib |
Where Data / Control-flow |
Where 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/django |
Why Design rationale |
Why 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.
| Guide | What you can do |
|---|---|
| Agent integrations | Connect zg to Codex, Claude Code, Qwen Code, Qoder, Cursor, or OpenCode and verify that it works. |
| CLI guide | Search, index, and manage your local workspaces from the terminal. |
| MCP guide | Understand which zg tools your agent can use and how access is secured. |
| Retrieval pipeline | Choose what to index, keep it fresh, and get better search results. |
| Architecture | See how zg handles your query and where your data stays. |
| Server and execution modes | Choose between one-off commands and a long-running local server. |
| Embedding models | Pick the right model for speed, search quality, privacy, and your hardware. |
| Roadmap | See what is coming next and help shape zg's priorities. |
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!
No open issues yet, or sync has not completed.