npx claudepluginhub can1357/smgrepSemantic code search for Claude Code. Automatically indexes your project and provides intelligent search capabilities.
Natural-language search that works like grep. Fast, local, GPU-accelerated, and built for coding agents.
Install
cargo install smgrep
Or build from source:
git clone https://github.com/can1357/smgrep
cd smgrep
cargo build --release
For CPU-only builds (no CUDA):
cargo build --release --no-default-features
Setup (Recommended)
smgrep setup
Downloads embedding models (~500MB) and tree-sitter grammars upfront. If you skip this, models download automatically on first use.
Search
cd my-repo
smgrep "where do we handle authentication?"
Your first search will automatically index the repository. Each repository is automatically isolated with its own index. Switching between repos "just works".
smgrep claude-installclaude) and ask questions about your codebase.smgrep serve daemon and provides semantic search.smgrep includes a built-in MCP (Model Context Protocol) server:
smgrep mcp
This exposes a sem_search tool that agents can use for semantic code search. The server auto-starts the background daemon if needed.
smgrep [query]The default command. Searches the current directory using semantic meaning.
smgrep "how is the database connection pooled?"
Options:
| Flag | Description | Default |
|---|---|---|
-m <n> | Max total results to return | 10 |
--per-file <n> | Max matches per file | 1 |
-c, --content | Show full chunk content | false |
--compact | Show file paths only | false |
--scores | Show relevance scores | false |
-s, --sync | Force re-index before search | false |
--dry-run | Show what would be indexed | false |
--json | JSON output format | false |
--no-rerank | Skip ColBERT reranking | false |
--plain | Disable ANSI colors | false |
Examples:
# General concept search
smgrep "API rate limiting logic"
# Deep dive (more matches per file)
smgrep "error handling" --per-file 5
# Just the file paths
smgrep "user validation" --compact
# JSON for scripting
smgrep "config parsing" --json
smgrep indexManually indexes the repository.
smgrep index # Index current dir
smgrep index --dry-run # See what would be indexed
smgrep index --reset # Delete and re-index from scratch
smgrep serveRuns a background daemon with file watching for instant searches.
smgrep serve # Start daemon for current repo
smgrep serve --path /repo # Start for specific path
smgrep stop / smgrep stop-allStop running daemons.
smgrep stop # Stop daemon for current repo
smgrep stop-all # Stop all smgrep daemons
smgrep cleanRemove index data and metadata for a store.
smgrep clean # Clean current directory's store
smgrep clean my-store # Clean specific store by ID
smgrep clean --all # Clean all stores
smgrep statusShow status of running daemons.
smgrep listLists all indexed repositories and their metadata.
smgrep doctorChecks installation health, model availability, and grammar status.
smgrep doctor
smgrep uses candle for ML inference with optional CUDA support.
With CUDA (default):
Requires CUDA toolkit installed with environment configured: