FACT-CHECKED
Last Fact-Check: 2025-12-31 Verified Against: CIDX source code (src/code_indexer/)
Complete reference for configuring CIDX.
- Overview
- Embedding Provider
- Configuration File
- Environment Variables
- Per-Project vs Global
- Advanced Configuration
- Troubleshooting
CIDX configuration involves three main areas:
- Embedding Provider - VoyageAI API key (required for semantic search)
- Configuration File -
.code-indexer/config.jsonper project - Environment Variables - Optional tuning and server settings
CIDX uses VoyageAI embeddings for semantic search. This is the only supported provider in v8.0+.
Get API Key:
- Sign up at https://www.voyageai.com/
- Navigate to API Keys section
- Generate new API key
- Copy your API key
Option 1: Environment Variable (Recommended)
# Add to shell profile (~/.bashrc, ~/.zshrc, etc.)
export VOYAGE_API_KEY="your-api-key-here"
# Reload shell
source ~/.bashrc # or ~/.zshrcOption 2: .env.local File (Manual Loading)
# Create .env.local in project directory
echo 'VOYAGE_API_KEY=your-api-key-here' > .env.local
# Load into shell environment (one-time per session)
export $(cat .env.local | xargs)Important: CIDX does NOT automatically load .env.local files. You must export environment variables to your shell before running cidx commands. The .env.local file is simply a convenient place to store the key - you need to load it manually using export or similar shell commands.
Option 3: Per-Session
# Set for current session only
export VOYAGE_API_KEY="your-api-key-here"
# Run CIDX commands
cidx query "search term"# Check environment variable
echo $VOYAGE_API_KEY
# Should output your API keyCIDX automatically uses VoyageAI models:
| Model | Dimensions | Use Case |
|---|---|---|
| voyage-code-3 | 1024 | Default, optimized for code |
| voyage-large-2 | 1536 | Highest quality |
Model Selection: Configured in code, not user-selectable in v8.0+. Default is voyage-code-3.
Per-Project: .code-indexer/config.json in each indexed project
Created automatically by cidx init or first cidx index.
{
"file_extensions": [
"py", "js", "ts", "tsx", "java", "cpp", "c", "cs", "h", "hpp",
"go", "rs", "rb", "php", "pl", "pm", "pod", "t", "psgi",
"sh", "bash", "html", "css", "md", "json", "yaml", "yml", "toml",
"sql", "swift", "kt", "kts", "scala", "dart", "vue", "jsx",
"pas", "pp", "dpr", "dpk", "inc", "lua", "xml", "xsd", "xsl",
"xslt", "groovy", "gradle", "gvy", "gy", "cxx", "cc", "hxx",
"rake", "rbw", "gemspec", "htm", "scss", "sass"
],
"exclude_dirs": [
"node_modules", "venv", "__pycache__", ".git", "dist", "build",
"target", ".idea", ".vscode", ".gradle", "bin", "obj",
"coverage", ".next", ".nuxt", "dist-*", ".code-indexer"
],
"embedding_provider": "voyage-ai",
"indexing": {
"max_file_size": 1048576
}
}Type: Array of strings (WITHOUT dot prefix) Default: Common code file extensions (see structure above) Purpose: File types to index
Important: Extensions are specified WITHOUT dots (e.g., "py" not ".py"). The system adds dots automatically.
Customization:
{
"file_extensions": [
"py", "js", "ts" // Only Python and JavaScript/TypeScript
]
}Add More Extensions:
{
"file_extensions": [
"py", "js", "ts",
"jsx", "tsx", // React
"vue", // Vue
"svelte", // Svelte
"scala", // Scala
"dart" // Dart
]
}Type: Array of strings Default: See complete list in Structure section above Purpose: Directories to exclude from indexing
Default List Includes:
- Build outputs: node_modules, dist, build, target, bin, obj
- Version control: .git
- Virtual environments: venv, pycache
- IDE configs: .idea, .vscode, .gradle
- Test artifacts: coverage, .pytest_cache
- Framework outputs: .next, .nuxt
- CIDX internal: .code-indexer
Customization:
{
"exclude_dirs": [
"node_modules", ".git", "__pycache__",
"vendor", // Add PHP vendor
"Pods", // Add iOS Pods
"build-output" // Custom build dir
]
}Include More:
{
"exclude_dirs": [
"node_modules", ".git",
"test_data", // Test fixtures
"mock_apis", // Mock data
"legacy_code" // Deprecated code
]
}Type: String Default: "voyage-ai" Purpose: Embedding provider selection
Note: Only "voyage-ai" is supported in v8.0+. This field exists for future extensibility but cannot be changed currently.
Type: Integer (bytes) Default: 1048576 (1 MB) Purpose: Maximum file size to index Location: Nested under "indexing" object in config.json
Customization:
{
"indexing": {
"max_file_size": 2097152 // 2 MB
}
}Why Limit File Size?:
- Large files increase indexing time
- Embedding API has token limits
- Quality degrades for very large files
Recommendations:
- 1 MB (default): Good for most code files
- 2-5 MB: If you have larger source files
- <500 KB: If you want faster indexing
You can manually edit .code-indexer/config.json:
# Edit config
nano .code-indexer/config.json
# Reindex to apply changes
cidx index --clear
cidx indexImportant: Changes take effect after re-indexing.
| Variable | Purpose | Example |
|---|---|---|
| VOYAGE_API_KEY | VoyageAI API key | export VOYAGE_API_KEY="your-api-key" |
Note: These variables are ONLY used when running CIDX in server mode (multi-user deployment). They are NOT used in CLI or Daemon modes.
| Variable | Purpose | Default | Example |
|---|---|---|---|
| CIDX_INDEX_CACHE_TTL_MINUTES | Server cache TTL | 10 | export CIDX_INDEX_CACHE_TTL_MINUTES=30 |
| CIDX_SERVER_PORT | Server port | 8000 | export CIDX_SERVER_PORT=9000 |
| CIDX_SERVER_HOST | Server host | localhost | export CIDX_SERVER_HOST=0.0.0.0 |
For CLI/Daemon mode configuration, use cidx config commands instead (see Daemon Mode section).
Linux/macOS:
# Temporary (current session)
export VOYAGE_API_KEY="your-key"
# Permanent (add to ~/.bashrc or ~/.zshrc)
echo 'export VOYAGE_API_KEY="your-key"' >> ~/.bashrc
source ~/.bashrcWindows (PowerShell):
# Temporary (current session)
$env:VOYAGE_API_KEY = "your-key"
# Permanent (System Environment Variables)
# Control Panel → System → Advanced → Environment VariablesLocation: .code-indexer/ in each project
Scope: Single project only
Use Case: Project-specific settings
Files:
config.json- Configurationindex/- Vector indexesscip/- SCIP indexes
Setup:
cd /path/to/project
cidx index
# Creates .code-indexer/ in current directoryNote: The global registry (~/.code-indexer/registry.json) is deprecated since v8.0. CIDX no longer requires centralized registry for CLI/Daemon modes.
Server Mode: Still uses ~/.cidx-server/data/ for golden repositories, but this is server-specific, not a global registry.
# Enable daemon mode
cidx config --daemon
# Disable daemon mode
cidx config --no-daemon
# Check current mode
cidx statusWhat It Configures:
- Enables background daemon process
- Activates in-memory caching
- Enables watch mode capability
# Start watch mode (requires daemon)
cidx watch
# Custom debounce
cidx watch --debounce 3.0
# With FTS indexing
cidx watch --ftsWatch Mode Settings:
- Debounce: Default 2.0 seconds (configurable via
--debounce) - File monitoring: Watches all files matching
file_extensions - Excludes: Respects
exclude_dirsfrom config.json
Customize which languages to index by editing file_extensions:
{
"file_extensions": [
".py" // Python only
]
}Or use --language flag during queries:
cidx query "search" --language python# Semantic only (default)
cidx index
# Add full-text search
cidx index --fts
# Add git history
cidx index --index-commits
# All index types
cidx index --fts --index-commits
# SCIP code intelligence
cidx scip generateError: ERROR: VOYAGE_API_KEY environment variable not set
Solutions:
-
Set environment variable:
export VOYAGE_API_KEY="your-key"
-
Add to shell profile:
echo 'export VOYAGE_API_KEY="your-key"' >> ~/.bashrc source ~/.bashrc
-
Verify it's set:
echo $VOYAGE_API_KEY
Error: ERROR: Invalid config.json
Solutions:
-
Delete and recreate:
rm .code-indexer/config.json cidx index # Creates fresh config.json with defaults -
Manually fix JSON:
nano .code-indexer/config.json # Fix JSON syntax errors -
Validate JSON:
python3 -m json.tool .code-indexer/config.json # Shows JSON syntax errors
Symptom: Large files not indexed
Solution:
{
"max_file_size": 5242880 // Increase to 5 MB
}Then reindex:
cidx index --clear
cidx indexSymptom: Important code in excluded directory not indexed
Solution:
-
Edit config.json:
{ "exclude_dirs": [ "node_modules", ".git" // Removed "__pycache__" ] } -
Reindex:
cidx index --clear cidx index
Symptom: Code files not being indexed
Solution:
-
Add extensions to config.json:
{ "file_extensions": [ ".py", ".js", ".ts", ".jsx", ".tsx" // Add React extensions ] } -
Reindex:
cidx index
Problem: Daemon mode not persisting
Check:
# Verify daemon mode enabled
cidx status
# Re-enable if needed
cidx config --daemon
cidx start