11# CodeGraph Configuration Example
22# Copy this file to .env and update the values for your environment
33
4- # ============================================================================
5- # CodeGraph Core Configuration (Simplified Setup)
6- # ============================================================================
7-
8- # Minimal Setup - Auto-detect embedding provider (ONNX, Ollama, or OpenAI)
9- CODEGRAPH_EMBEDDING_PROVIDER = auto
10-
11- # That's it for basic usage! CodeGraph will auto-detect everything else.
12- # Uncomment and customize the settings below if you need more control.
13-
14- # ============================================================================
15- # Storage and Installation Configuration
4+ ============================================================================
5+ # Storage and Installation Configuration (LEGACY FOR FAISS+RocksDB)
166# ============================================================================
177
188# Storage path for CodeGraph data (indexes, cache, etc.)
@@ -29,17 +19,21 @@ CODEGRAPH_EMBEDDING_PROVIDER=auto
2919# CODEGRAPH_DOMAIN=example.com
3020
3121# ============================================================================
32- # Embedding Provider Configuration
22+ # Embedding Provider Configuration (Local)
3323# ============================================================================
34- # Provider options: "auto", " onnx", "ollama", "openai", "jina", or "lmstudio"
35- # CODEGRAPH_EMBEDDING_PROVIDER=auto
24+ # Provider options: "onnx", "ollama", "openai", "jina", or "lmstudio"
25+ # CODEGRAPH_EMBEDDING_PROVIDER=ollama
3626
3727# ONNX: Specify model path (or leave empty for auto-detection from HuggingFace cache)
3828# CODEGRAPH_LOCAL_MODEL=/path/to/your/onnx/model
3929
4030# Ollama: Specify embedding model name
4131# CODEGRAPH_EMBEDDING_MODEL=all-minilm:latest
4232# CODEGRAPH_OLLAMA_URL=http://localhost:11434
33+ # CODEGRAPH_EMBEDDING_MODEL=qwen3-embedding:4b
34+ # CODEGRAPH_EMBEDDING_DIMENSION=2560 # Important! Has to match the actual output dimensionality of the embedding model you use!
35+ # CODEGRAPH_MAX_CHUNK_TOKENS=28000 # Important! The ctx window of you embedding model qwen3-embedding:4b has 32K tokens so we chunk at 28K and f.ex. all-minilm has 512 tokens so chunk at f.ex. 256 tokens
36+ # Semantic-Chunker is used by default by Codegraph
4337
4438# LM Studio: Best for MLX + Flash Attention 2 (recommended on macOS)
4539# Default: jina-embeddings-v4 (2048 or 1024 dimensions)
@@ -48,11 +42,23 @@ CODEGRAPH_EMBEDDING_PROVIDER=auto
4842# CODEGRAPH_LMSTUDIO_URL=http://localhost:1234
4943# CODEGRAPH_EMBEDDING_DIMENSION=2048
5044
51- # Batch size for embedding generation (applies to all providers)
52- # CODEGRAPH_EMBEDDING_BATCH_SIZE=32 # Default: 32, valid range: 1-4096
45+ # ============================================================================
46+ # Reranking Provider Configuration (Local)
47+ # ============================================================================
48+ # CODEGRAPH_RERANKING_PROVIDER = lmstudio
49+ # CODEGRAPH_RERANKING_MODEL = jina-reranker-v3
50+ # CODEGRAPH_RERANKING_CANDIDATES = 512 # (fetched results by semantic search: semantic search > 512 results > rerank > top 10)
51+
5352
53+ # ============================================================================
54+ # Embedding Provider Configuration (Cloud)
55+ # ============================================================================
5456# OpenAI: Model name (API key configured below in Security section)
5557# CODEGRAPH_EMBEDDING_MODEL=text-embedding-3-small
58+ # CODEGRAPH_EMBEDDING_DIMENSION=1536 # Important! Has to match the actual output dimensionality of the embedding model you use! 1536 for small, 3072 for large
59+
60+ # Batch size for embedding generation (applies to all providers)
61+ # CODEGRAPH_EMBEDDING_BATCH_SIZE=32 # Default: 32, valid range: 1-64 Ollama and LMStudio throttle the throughput with larger batches even when you would have the memory to do so the gains of f.ex. 1024 batches are not that significant to compared to 64
5662
5763# Jina AI: Cloud embeddings with reranking (requires JINA_API_KEY)
5864# CODEGRAPH_EMBEDDING_PROVIDER=jina
@@ -61,12 +67,12 @@ CODEGRAPH_EMBEDDING_PROVIDER=auto
6167# JINA_EMBEDDING_DIMENSION=2048 (supports 1024, 512, 256 but only 1024 has pre-defined column and HNSW index in surrealdb schema)
6268# JINA_API_KEY=your-jina-api-key-here
6369# JINA_MAX_TEXTS=512 # Leverage Jina API Batch functionality max 512 documents with 8192 tokens each remember to set --max-concurrent 1 when indexing
64- # JINA_MAX_TOKENS=7000
70+ # JINA_MAX_TOKENS=7000 # Substitute for CODEGRAPH_MAX_TOKENS
6571# JINA_API_BASE=https://api.jina.ai/v1
6672# JINA_API_TASK=code.passage # used when embedding data, code.query is used when searching data
67- # JINA_TASK=code.passage # Alternative name
68- # JINA_LATE_CHUNKING=false
69- # JINA_TRUNCATE=true # truncate texts and embeddings if over limit
73+ # JINA_TASK=code.passage # Alternative name for JINA_API_TASK
74+ # JINA_LATE_CHUNKING=false # Leverage Jina AIs advanced long-context chunking features for more accurate embeddings
75+ # JINA_TRUNCATE=true # truncate texts and embeddings if over dimension limit
7076# JINA_REQUEST_DELAY_MS=600 # small delay not to throttle the API when batching
7177
7278# Jina Reranking Configuration
@@ -75,15 +81,16 @@ CODEGRAPH_EMBEDDING_PROVIDER=auto
7581# JINA_ENABLE_RERANKING=true
7682# JINA_RERANKING_ENABLED=true # Alternative name
7783# JINA_RERANKING_MODEL=jina-reranker-v3
78- # JINA_RERANKING_TOP_N=10
84+ # JINA_RERANKING_TOP_N=10 # (fetched results by semantic search: semantic search > 512 results > rerank > top 10)
85+ # CODEGRAPH_RERANKING_CANDIDATES = 512 # (fetched results by semantic search: semantic search > 512 results > rerank > top 10)
7986
80- # Jina Relationship Embeddings Configuration
87+ # Jina Relationship Embeddings Configuration, You don't really need to touch this CODEGRAPH_EMBEDDING_BATCH_SIZE is usually enough
8188# JINA_REL_BATCH_SIZE=50
8289# JINA_REL_MAX_TEXTS=50
8390
8491# Jina Batching for Large Indexing Operations
8592# CODEGRAPH_JINA_BATCH_SIZE=2000
86- # CODEGRAPH_JINA_BATCH_MINUTES=9.0 # used by estimate command, this is how long it took on average to index the codegraph codebase nodes with Jina
93+ # CODEGRAPH_JINA_BATCH_MINUTES=9.0 # used by codegraph estimate command, this is how long it took on average to index the codegraph codebase with Jina
8794
8895# ============================================================================
8996# Dual-Mode Search Configuration
@@ -130,20 +137,20 @@ CODEGRAPH_EMBEDDING_PROVIDER=auto
130137# SURREALDB_PASSWORD=root # Alternative name
131138#
132139# Important: HNSW index dimension must match embedding provider
133- # - Jina: Variable Matryoska dimensions depending on model 2048, 1024, 512, 256
140+ # - Jina: Variable Matryoska dimensions depending on model 2048-dims configured
134141# - OpenAI: Small 1536 dimensions, Large 3072 dimensions
135142# - Local ONNX: typically 384 qdrant/all-mini-llm-onnx
136- # - Local Ollama: qwen3-embedder:0.6b-8b 1024, 2048 , 4096, embeddingsgemma 768, all-mini-llm 384
137- # - 384 (all-mini-llm :latest)
143+ # - Local Ollama: qwen3-embedder:0.6b-8b 1024, 2056 , 4096, embeddingsgemma: 768, all-minilm: 384
144+ # - 384 (all-minilm :latest)
138145# - 768 (embeddingsgemma:latest)
139146# - 1024 (qwen3-embedding:0.6b)
140147# - 1536 (text-embedding-3-small)
141- # - 2048 (qwen3-embedding:4b, jina-embeddings-v4)
148+ # - 2048 (jina-embeddings-v4)
149+ # - 2056 (qwen3-embedding:4b)
142150# - 3072 (text-embedding-3-large)
143151# - 4096 (qwen3-embedding:8b)
144- # The following embedding fields and HNSW indexes have been built into the surrealdb schema and codegraph codebase
145- # For pure speed use onnx or ollama all-mini-llm
146- # For considerably better retriaval switch to Ollama and qwen3-embedding:0.6b
152+ # For pure speed use onnx or ollama all-mini-llm ~10mins to index the whole codegraph codebase
153+ # For considerably better retriaval switch to qwen3-embedding:0.6b or code language aware 4b or 8b versions for even better accuracy
147154# Scale qwen3-embedding model per criticality of accuracy on Ollma
148155# For enhancing local accuracy enable CODEGRAPH_RERANKING_PROVIDER=lmstudio and f.ex. CODEGRAPH_RERANKING_MODEL=qwen-reranker-3:0.6b
149156# For true SOTA use jina provider and jina-embeddings-v4 with the jina-reranker-v3 - takes longer to index but works better
@@ -162,23 +169,20 @@ CODEGRAPH_EMBEDDING_PROVIDER=auto
162169# Set to enable local LLM insights generation
163170
164171# LM Studio with DeepSeek Coder v2 Lite Instruct (or what ever fits in your vGPU memory)
165- # Supported LLM provider options: "auto", "onnx", " lmstudio", "openai", "claude " or "ollama"
172+ # Supported LLM provider options: "lmstudio", "openai", "anthropic " or "ollama"
166173# Superior MLX support, Flash Attention 2, KV-cache and Distillation model support on macOS
167174# CODEGRAPH_LLM_PROVIDER=lmstudio
168175# LLM_PROVIDER=lmstudio # Alternative name
169176# CODEGRAPH_MODEL=lmstudio-community/DeepSeek-Coder-V2-Lite-Instruct-GGUF/DeepSeek-Coder-V2-Lite-Instruct-Q4_K_M.gguf
170177# CODEGRAPH_LMSTUDIO_URL=http://localhost:1234
171- # CODEGRAPH_CONTEXT_WINDOW=32000
178+ # CODEGRAPH_CONTEXT_WINDOW=32000 # The context window of the used model directly affects the quality and depth of the results generated by the agentic_ MCP-server tools
172179# CODEGRAPH_TEMPERATURE=0.1
173180
174- # Reasoning effort for complex queries (affects token usage)
175- # CODEGRAPH_REASONING_EFFORT=medium
176-
177181# Ollama (alternative)
178- # LLM model (e.g., "qwen2.5-coder:14b ", "Kimi-K2-Instruct")
179- # CODEGRAPH_MODEL=qwen2.5-coder:14b
182+ # LLM model (e.g., "qwen3:4b ", "Kimi-K2-Instruct")
183+ # CODEGRAPH_MODEL=qwen3:4b
180184# CODEGRAPH_OLLAMA_URL=http://localhost:11434
181- # CODEGRAPH_CONTEXT_WINDOW=252000 # Max for Ollama depends on the model though
185+ # CODEGRAPH_CONTEXT_WINDOW=252000 # The context window of the used model directly affects the quality and depth of the results generated by the agentic_ MCP-server tools
182186
183187# Anthropic (cloud - 200K/1M tokens)
184188# CODEGRAPH_LLM_PROVIDER=anthropic
@@ -188,10 +192,10 @@ CODEGRAPH_EMBEDDING_PROVIDER=auto
188192
189193# OpenAI (cloud - 200K/400K tokens)
190194# CODEGRAPH_LLM_PROVIDER=openai
191- # CODEGRAPH_MODEL=gpt-5-codex-mini
195+ # CODEGRAPH_MODEL=gpt-5.1 -codex-mini
192196# OPENAI_API_KEY=sk-your-key-here
193197# OPENAI_ORG_ID=your_fabulous_org
194- # CODEGRAPH_CONTEXT_WINDOW=200000 # 400K tokens
198+ # CODEGRAPH_CONTEXT_WINDOW=200000 # 400K tokens for gpt-5.1 and gpt-5.1-codex
195199# CODEGRAPH_REASONING_BUDGET=medium
196200
197201# xAI (cloud - 252K/2M context window, $0.50-$1.50/M tokens!)
@@ -202,10 +206,10 @@ CODEGRAPH_EMBEDDING_PROVIDER=auto
202206# CODEGRAPH_REASONING_BUDGET=high
203207
204208# MCP-server code insights agent max output tokens - uses the CODEGRAPH_MODEL
205- # MCP_CODE_AGENT_MAX_OUTPUT_TOKENS=52000
209+ # MCP_CODE_AGENT_MAX_OUTPUT_TOKENS=52000 # F.ex. Claude Code hard-caps this to 64K tokens and usually crashes is such an large output is produced by an MCP-server
206210
207211# ============================================================================
208- # Performance & Caching Configuration
212+ # Performance & Caching Configuration (LEGACY only for FAISS+RocksDB)
209213# ============================================================================
210214
211215# Performance mode (affects optimization settings)
@@ -222,17 +226,7 @@ CODEGRAPH_EMBEDDING_PROVIDER=auto
222226# CODEGRAPH_SYMBOL_DB_BATCH_SIZE=1000 # Batch size for database writes
223227
224228# ============================================================================
225- # Qwen-Coder-2.5-128K Integration (Legacy)
226- # ============================================================================
227-
228- # Qwen model configuration
229- # CODEGRAPH_ENABLE_QWEN=true
230- # CODEGRAPH_QWEN_MAX_TOKENS=128000 # Max completion tokens (0 disables limit)
231- # CODEGRAPH_QWEN_TIMEOUT_SECS=180 # Request timeout before fallback (0 disables)
232- # CODEGRAPH_QWEN_CONNECT_TIMEOUT_MS=5000 # Connection timeout to Ollama
233-
234- # ============================================================================
235- # Server Configuration
229+ # Server Configuration (LEGACY for REST-API use NAPI instead)
236230# ============================================================================
237231
238232# Server host and port (for HTTP/REST API)
@@ -258,20 +252,20 @@ RUST_LOG=warn
258252# CODEGRAPH_CMD="cargo run -p codegraph-mcp --bin codegraph --"
259253
260254# ============================================================================
261- # Security Configuration (for production deployments )
255+ # Security Configuration (LEGACY for REST-API )
262256# ============================================================================
263257
264258# JWT Authentication
265- JWT_SECRET = replace_with_secure_random_secret_minimum_32_characters_long
266- JWT_EXPIRY_HOURS = 24
259+ # JWT_SECRET=replace_with_secure_random_secret_minimum_32_characters_long
260+ # JWT_EXPIRY_HOURS=24
267261
268262# API Key Configuration
269- API_KEY_PREFIX = cgk
263+ # API_KEY_PREFIX=cgk
270264
271265# Server Configuration
272- HOST = 127.0.0.1
273- PORT = 8080
274- ENVIRONMENT = development
266+ # HOST=127.0.0.1
267+ # PORT=8080
268+ # ENVIRONMENT=development
275269
276270# TLS/HTTPS Configuration (for production)
277271# TLS_CERT_PATH=/path/to/certificate.pem
@@ -283,49 +277,48 @@ ENVIRONMENT=development
283277# REDIS_URL=redis://localhost:6379
284278
285279# Rate Limiting
286- RATE_LIMIT_ANONYMOUS = 60
287- RATE_LIMIT_USER = 1000
288- RATE_LIMIT_PREMIUM = 5000
289- RATE_LIMIT_ADMIN = 10000
280+ # RATE_LIMIT_ANONYMOUS=60
281+ # RATE_LIMIT_USER=1000
282+ # RATE_LIMIT_PREMIUM=5000
283+ # RATE_LIMIT_ADMIN=10000
290284
291285# Security Settings
292- MAX_REQUEST_SIZE = 10485760 # 10MB
293- SESSION_TIMEOUT_HOURS = 24
294- PASSWORD_MIN_LENGTH = 12
286+ # MAX_REQUEST_SIZE=10485760 # 10MB
287+ # SESSION_TIMEOUT_HOURS=24
288+ # PASSWORD_MIN_LENGTH=12
295289
296290# Logging (see RUST_LOG above for CodeGraph core logging)
297291# LOG_LEVEL=info # For application-level logging
298- SECURITY_LOG_LEVEL = warn
299- LOG_FORMAT = json
292+ # SECURITY_LOG_LEVEL=warn
293+ # LOG_FORMAT=json
300294
301295# Monitoring
302- METRICS_ENABLED = true
303- PROMETHEUS_PORT = 9090
296+ # METRICS_ENABLED=true
297+ # PROMETHEUS_PORT=9090
304298
305299# External Services
306300# SENTRY_DSN=https://your-sentry-dsn
307301# ANALYTICS_KEY=your_analytics_key
308302
309303# Development/Testing Only
310- DEV_MODE = true
311- DISABLE_AUTH = false # Never set to true in production!
312- ENABLE_DEBUG_ENDPOINTS = false
304+ # DEV_MODE=true
305+ # DISABLE_AUTH=false # Never set to true in production!
306+ # ENABLE_DEBUG_ENDPOINTS=false
313307
314308# ============================================================================
315- # HTTP Server Configuration (when using --transport http)
309+ # MCP Server Configuration (when using --transport http)
316310# ============================================================================
317311
318312# Host address to bind HTTP server (default: 127.0.0.1)
319313# Use 0.0.0.0 to allow external connections
320314CODEGRAPH_HTTP_HOST = 127.0.0.1
321315
322- # Port for HTTP server (default: 3000 )
323- CODEGRAPH_HTTP_PORT = 3000
316+ # Port for HTTP server (default: 3003 )
317+ CODEGRAPH_HTTP_PORT = 3003
324318
325319# SSE keep-alive interval in seconds (default: 15)
326320# Prevents proxy timeouts for long-running agentic operations
327321CODEGRAPH_HTTP_KEEP_ALIVE = 15
328322
329- # MCP Test Transport (for test_agentic_mcp.py)
330- # MCP_TRANSPORT=stdio # Use stdio transport (starts server automatically)
331- MCP_TRANSPORT = http # Use HTTP/SSE transport (requires running server)
323+ # MCP Test Transport (for test_agentic_mcp.py) can be set by just running codegraph start http --port xxxx or codegraph start stdio
324+ # MCP_TRANSPORT=http # Use HTTP/SSE transport (requires running server)
0 commit comments