similar
Find the nearest code neighbors of an existing indexed symbol by its stored embedding. Use for deduplication, refactor planning, or spotting parallel implementations.
Instructions
Nearest neighbours of an EXISTING symbol by its stored embedding (HNSW lookup, ~7-15ms). Distinct from find_similar (which embeds a free-text query). Use this when you have a function in hand and want what else in this repo looks like it? — useful for dedup, refactor planning, and finding parallel implementations. Requires vex index --semantic. Supports diff scoping: since (rev), since_branched, changed_only (mutually exclusive) and no_stale_check.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| why | No | Surface a JSON trace under `_meta.why`: seed resolution, applied threshold, candidates before/after path filter, filter snapshot. | |
| name | No | DEPRECATED — use `symbol`. Pre-v1.7 alias, still accepted; emits a deprecated_args notice in _meta. | |
| limit | No | Max results | |
| since | No | Restrict results to files changed between `<rev>..HEAD`. Mutually exclusive with `since_branched` and `changed_only`. | |
| symbol | Yes | Exact name of an existing indexed symbol to use as the seed — canonical key (v1.7+). | |
| exclude | No | Blacklist results by path glob; wins over include (repeatable) | |
| explain | No | Include reasoning per match: identifier-set Jaccard overlap + truncated unified diff between bodies | |
| include | No | Whitelist results by path glob, gitignore syntax (repeatable) | |
| threshold | No | Minimum cosine similarity (0.0..1.0); raise to tighten matches | |
| auto_update | No | Auto-update the index if stale, or bootstrap it if missing, before running (default: true) | |
| filter_path | No | Substring path filter applied to result paths (single substring; use include/exclude for glob patterns). Legacy alias: `filter`. | |
| async_update | No | With auto_update, refresh a stale index in the background instead of waiting for it: results come from the index already on disk and _meta.vex.dev/stale says so (default: false) | |
| changed_only | No | Restrict results to working-tree changes (staged + unstaged + untracked). Mutually exclusive with `since` and `since_branched`. | |
| project_root | No | Absolute path to the project root (defaults to the MCP working directory) | |
| exclude_tests | No | Drop test files from the results (tests/ dirs, *_test.*, test_*.py, *.spec.ts, __tests__/, tests.rs, ...; same set as tests_for). Composes with include/exclude. Path-based only: Rust unit tests inside a `#[cfg(test)] mod tests` block of a non-test file are not excluded. | |
| no_stale_check | No | Skip the staleness check that runs before each call; assumes the index is fresh. Redundant when `auto_update` is true. | |
| since_branched | No | Restrict results to files changed since this branch diverged from `origin/main` (or `main`/`master`). Mutually exclusive with `since` and `changed_only`. |