/code-index:setup [rescan | rebuild]from code-index
Sets up zvec-grep semantic code search for a repository in Claude Code, Codex, and oh-my-pi. Scans the repo, configures exclusions, embedding model, call graph, and hosts, registers the MCP server, and builds a GPU-based index.
Ships in code-index. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Give one repository a zvec-grep index that is worth searching, wired up for this project only in each chosen host (Claude Code, Codex, oh-my-pi): an MCP server and usage rules in project-local files, exclusions in .zgignore, and an index built on the GPU. Nothing is written to global config.
When ${CLAUDE_PLUGIN_ROOT} appears unexpanded in this file, you run under oh-my-pi: read ../../references/omp-runtime.md from this skill's directory first. Paths references/… below are relative to the plugin root.
Input: $ARGUMENTS. rescan reruns the scan and proposes changed exclusions; rebuild rebuilds the index with the current configuration. With nothing given, set up from scratch, or, when the project is already configured (step 1), show the current configuration and ask which of the two the user wants.
zg --version. When zg is missing, stop and give the install command: pnpm add -g @zvec/zvec-grep --allow-build=@zvec/zvec-grep.git rev-parse --path-format=absolute --git-common-dir; outside git, use the current directory. Call it <root> below and say which path you use. When the session runs in a worktree, note its root (git rev-parse --show-toplevel) too: Codex and oh-my-pi read config from the checkout they run in.command -v claude codex omp, plus the host you run in. Each host has a wiring reference: references/hosts/claude-code.md, references/hosts/codex.md, references/hosts/omp.md. Read the references of the installed hosts.zg --status <root> and <root>/.zgignore.Run ${CLAUDE_PLUGIN_ROOT}/scripts/scan.sh <root>. It lists what zg would scan, with .gitignore and any .zgignore applied, and prints totals, the heaviest directories and extensions, the largest files, generated-looking paths, text files with NUL bytes, the machine (OS, CPU, cores, memory and the GPU device it found), and zg's model and device defaults.
From it, draft .zgignore entries (gitignore syntax, anchored with a leading /) for content that costs build time and adds noise to results without answering questions about the code:
generated/ and __generated__/ trees, schema dumps;dist/, build/, rendered HTML previews, storybook output;Open a file before proposing to exclude it when its name alone does not show that it is generated. Keep hand-written docs such as ADRs, specs and READMEs: they answer "why" questions, often in another language than the code. Each entry needs a reason you can state in a few words.
Text files with NUL bytes need no entry from you; the guard adds them (step 5).
Present one proposal and ask with AskUserQuestion. Lead with the machine in one line (OS, CPU, memory, device) and the numbers: files and size before and after the exclusions, and the expected build time.
Exclusions: the drafted entries, each with its size and reason.
Device: zg's device from the scan when it has one (ZVEC_GREP_DEVICE first, then the device configured for the chosen model), otherwise the GPU device the scan found. Say which it is and where it comes from. When that is cpu, say that the machine has no GPU zg can use.
Model: recommend the model the scan reports as zg's default for new indexes, and name where it comes from (ZVEC_GREP_EMBEDDING or zg --config model set <model> --default). When it is not one of the models below, offer it first, with no speed estimate. When zg has no default, say so, recommend none, and mention that zg --config model set <model> --default sets one for every repository.
local/embeddinggemma-300m: multilingual, llama.cpp, about 1 file per second on the GPU of an Apple M4 Pro.local/qwen3-embedding-0.6b: llama.cpp, ranks results better but builds about 5 times slower; the largest of the three, so the first to strain a machine with 8 GB of memory or less.local/potion-code-16m-v2: English code only, runs on the CPU, builds in minutes, weakest ranking.On a cpu device, the llama.cpp models (Gemma, Qwen) take hours for a large repository: recommend potion instead of zg's default and say why.
Call graph (--graph): adds zvec_grep_callers and zvec_grep_callees, costs little. zg 0.3 builds edges for TypeScript, JavaScript, Python, Rust, Go, Java, PHP, C and C++, and none inside .vue or .svelte files. When the scan shows many of those, say that the graph cannot see that part of the code, and grep has to cover it.
Hosts (multi-select): Claude Code, Codex, oh-my-pi. Preselect the installed ones and those already wired. All of them share the index and .zgignore; each gets its own server entry and rules.
Time: estimate from the chosen model's speed above: about one second per file for Gemma on the GPU, about five for Qwen. Those speeds were measured on an Apple M4 Pro; on any other machine call the estimate rough. The build runs in the background, and a first build that is interrupted keeps nothing.
On rescan, show only what changes against the current .zgignore and say that a changed exclusion set rebuilds the whole index.
.zgignore: write the agreed entries in <root>/.zgignore, grouped under a comment line per reason.ZVEC_GREP_EMBEDDING, the device in ZVEC_GREP_DEVICE, so queries run where the index was built, and the extra build options in ZG_INDEX_ARGS (--graph when the graph is on, otherwise an empty string). Tools that build an index for a new worktree read all three from there. The rules are the section in references/rules.md. Say from when each host loads the server..zgignore, .zvec-grep/ and each path the chosen hosts list under Keep out of git, run git check-ignore -q <path> in <root>. When a path is not ignored, append it to <git-common-dir>/info/exclude, so the repository's .gitignore stays untouched. Worktrees share that file.Run the guard in the background (run_in_background), so the session stays free:
${CLAUDE_PLUGIN_ROOT}/scripts/index-guard.sh <root> --embedding <model> --device <device> [--graph] [--rebuild]
Add --rebuild when an index exists and the model, the graph setting or the exclusions changed. The guard:
.zgignore and lists them; llama.cpp cannot tokenize them, and one such file switches zg to the CPU;--mode direct and passes --ignore-file .zgignore;Tell the user the log path the guard prints and the expected finish time, then end the turn; the background task notifies you when it ends.
When it ends:
files summary line and zg --status <root> coverage..zgignore entry for it, and run the guard again on a yes. For a GPU fault that came back after the restart, say that zg would have finished on the CPU in hours, and leave the next step to the user.An index lives in <checkout>/.zvec-grep/, one per worktree. A worktree whose index was copied from the main checkout (on APFS, cp -c -R makes a clone that takes no extra disk space) needs only an incremental update. To build one in a worktree that has none, copy .zgignore from the main checkout, then run the same guard command with the model from the server's ZVEC_GREP_EMBEDDING, --device from ZVEC_GREP_DEVICE and the options from ZG_INDEX_ARGS. Each host's reference lists under Worktrees which of its files to copy too.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
semantic-search, code-index, mcp-server, project-setup, zvec-grep
npx claudepluginhub grixu/cc-toolkit --plugin code-indexOther plugins' skills for the same job