
Claude Index: claudix
Copilot's Codebase Index but for Claude Code. Automatically indexes your repo, embeds with the embedding model of choice and provides semantic search through Claude's slash commands, MCP tools, and grep interception.
What It Does
claudix is a Claude Code plugin that gives the agent local semantic search over any repository. A single Rust binary acts as MCP server, hook handler, and CLI. When Claude Code starts, claudix warmly bootstraps the index if missing. When you edit files, chunks are re-embedded automatically. When grep would be less useful than semantic search, the plugin intercepts and uses dense vectors instead. Configuration lives next to settings.json with optional per-project overrides. First-class language support includes Python, JavaScript, Java, C, C++, C#, SQL, Rust, TypeScript, and Go.
Core design goal: never break the session, always recover gracefully.
Requirements
- macOS 11+ (Apple Silicon) or Linux x86_64 (glibc 2.28+ or musl) or Windows 10+ x86_64
- Rust 1.83+
- Optional: LM Studio or Ollama for custom embedding backends (
- bundled
bge-small-en-v1.5requireslibonnxruntimeoronnxruntime.dll)
- bundled
Installation
Requires: Claude Code 2.0.12+.
claudix ships the bundled bge-small-en-v1.5 embedder and uses it as the fallback when no embedding provider is configured. Set embedding.provider = "http" if you prefer LM Studio, Ollama, or another OpenAI-compatible embedding server.
Linux / macOS
|
Windows
irm https://raw.githubusercontent.com/uwuclxdy/claudix/mommy/install.bat | iex
Manual
The native binary downloads on first session (~150MB). Restart Claude Code, then run /claudix:doctor to verify.
Targets without a prebuilt (e.g. linux-aarch64, darwin-x86_64) fall back to cargo install claudix@<version>. Install Rust first if you are on one of those.
Configuration
Configuration lives in two TOML files (project overrides global):
- Global:
~/.claude/claudix.toml - Project:
<repo>/.claude/claudix.toml
Both optional. If neither file sets an embedding provider, bundled defaults and the bge-small-en-v1.5 embedder are used. Run /claudix:doctor to see active configuration.
Full Schema (defaults)
[]
= "bundled" # bundled | http
= "" # required if provider = http (e.g., http://localhost:1234)
= "bge-small-en-v1.5"
= 384
= 32
= 30000
[]
= true
= false
= 512 # skip files larger than this
= 5 # lines overlapped between chunks
= 24 # background reindex interval
[]
= 10 # results per search
= { = 0.55, = 0.30, = 0.15 } # hybrid retrieval weights
= 1.4 # boost exact identifier matches
= 0.30 # minimum relevance score
[]
= true # replace grep with semantic search when useful
= true # re-embed after Write/Edit
= true # ping embedding endpoint on startup
[]
= ".claudix/index" # relative to repo root; committed to .gitignore
= "~/.claude/claudix/logs"
Configuration is validated at every entry point (MCP, hook, CLI). Invalid config exits early with field-level error messages.
Slash Commands
All commands are available as /claudix:<name>:
| Command | Description | Arguments |
|---|---|---|
/claudix:search |
Semantic code search | <query> [--top-k N] [--language rust --language python] [--path-prefix src/] |
/claudix:index |
Build or refresh index | (none) |
/claudix:status |
Show index metadata | (none) |
/claudix:doctor |
Diagnose health | (none) |
/claudix:reindex-file |
Re-embed one file | <path> |
/claudix:clear |
Delete index | (none) |
Search Example
/claudix:search authentication flow --language rust --top-k 5
Results show file path, line range, language, definition kind, name, and relevance score.
How It Works
SessionStart Hook
On first session or after plugin upgrade, the SessionStart hook:
- Checks that plugin files and global config are present
- Emits
claudix readyviasystemMessagewhen setup is complete - Tells the user to rerun the install script if setup is incomplete
- Kicks off the background update check
If anything fails, the hook exits 0 (fail-open): session continues unaffected.
PostToolUse Hook (File Edit)
After Write, Edit, or MultiEdit tools, the hook:
- Reads edited file path from tool input
- Invokes
claudix hook PostToolUse <path> - Atomically upserts new chunks, removes stale ones
- Index stays live without a watcher
PreToolUse Hook (Grep Intercept)
Before Grep or Bash tools (with rg, grep, ag commands), the hook:
- Analyzes query for regex patterns, globs, short length
- Checks if index is stale or missing
- If index is fresh and query looks conceptual, returns:
- Otherwise allows grep to proceed
Heuristics for passthrough: regex anchors/character classes, explicit file globs, <3 tokens, stale index, intercept_grep = false.
MCP Tool: search_code
Claude invokes claudix.search_code(query, language_filter, path_prefix) directly. Uses hybrid retrieval: dense vector (55%), BM25 (30%), reciprocal rank fusion (15%). Returns ranked list with file location, definition kind, name, line range, and score.
Embedding Backends
Bundled (Default)
bge-small-en-v1.5 runs via ONNX Runtime on CPU. No external dependencies. ~100ms/chunk on modern hardware.
Requires: libonnxruntime (Linux) or onnxruntime.dll (Windows) installed in system library path, or downloaded automatically.
LM Studio
Local LLM inference server. Download lm-studio.ai, load an embedding model (e.g., nomic-ai/nomic-embed-text-v1.5), start the server.
[]
= "http"
= "http://localhost:1234"
= "your-model-name"
Ollama
Local inference. Install ollama.ai, pull embedding model:
Configure:
[]
= "http"
= "http://localhost:11434"
= "nomic-embed-text"
All three backends return 384-dimensional vectors (for bge-small); other models may differ. Dimension mismatch triggers reindex.
Building from Source
Requires Rust 1.83+ and Cargo.
Test suite:
Binary is target/release/claudix. Strip for distribution:
Linux musl builds are statically linked:
Troubleshooting
Check Plugin Health
/claudix:doctor
Diagnostic output:
- Project root
- Index present (yes/no)
- Chunk and file counts
- Active embedding model
- Embedding provider and health (reachable or error)
- Configuration errors
Index Missing or Stale
/claudix:index
Full reindex takes ~1-5 minutes depending on repo size. Incremental updates (on file edit) take milliseconds.
Embedding Endpoint Unreachable
If using LM Studio or Ollama:
- Verify server is running:
curl http://localhost:1234/health(LM Studio) orcurl http://localhost:11434/api/embeddings(Ollama) - Check configuration:
/claudix:doctorshowsendpointin use - Switch to bundled: set
provider = "bundled"in~/.claude/claudix.toml, then run/claudix:indexto reindex
Hooks Don't Trigger or Fail Silently
SessionStart hook exits 0 even on error. Check logs:
Logs are created on first run. Enable debug logging:
RUST_LOG=debug
Schema Mismatch After Upgrade
If the binary is newer than indexed chunks, SessionStart triggers background reindex and emits additionalContext. You can manually reindex with /claudix:clear then /claudix:index.
Fail-Open Guarantee
Hooks never fail the session.
- Binary missing → hook exits 0, session proceeds
- Embedding endpoint down → hook exits 0, grep proceeds normally
- Index corrupted → hook exits 0, search MCP tool returns error with recovery hint
- Configuration invalid → caught at startup; MCP tool returns error message
MCP tool errors are structured JSON with a recovery field Claude can act on:
Development
Architecture is domain-driven (chunking, embedding, store, search, mcp, hooks) rather than kind-driven. Each domain module owns types, traits, and tests. Cross-domain coupling goes through small interface traits.
Key modules:
src/chunking/— tree-sitter code splittingsrc/embedding/— bundled (ONNX) and http (LM Studio, Ollama) providerssrc/store/— LanceDB for vector + FTSsrc/search/— hybrid retrievalsrc/mcp/— Model Context Protocolsrc/hooks/— SessionStart, PostToolUse, PreToolUse handlerssrc/cli/— slash command entry points
Tests live next to code (#[cfg(test)]) or in tests/integration/ with fixtures in tests/fixtures/.
License
MIT