Skip to content

Commit c22385f

Browse files
committed
Refactor: Deprecated Faiss and Rocksdb completely from the project
- Cleaned up unnecessary comments and code for better readability and maintainability.
1 parent 41bc2f9 commit c22385f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+720
-3620
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
158158
- **Fixed 3 progress bars**: batch, enhanced, simple progress templates
159159

160160
### 🗑️ **Removed**
161+
- **Surreal-only runtime**: Deleted all FAISS/RocksDB features, installers, and vector backends. MCP server, CLI, and SDK now require SurrealDB for graph + vector persistence with no fallback.
161162
- **Dependency cleanup**: Removed 79 unused dependencies across 17 crates
162163
- **Tool**: cargo machete for detection
163164
- **Impact**: Faster compilation, smaller binaries

Cargo.lock

Lines changed: 1 addition & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ sysinfo = "0.37.2"
7575
# Database
7676
rocksdb = "0.24"
7777

78-
# Vector Search (FAISS bindings and scientific computing)
79-
faiss = "0.12"
78+
# Scientific computing
8079
ndarray = "0.16.1"
8180

8281
# OpenAI API client

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ build-release:
1313

1414
# Build MCP server with AutoAgents experimental feature
1515
build-mcp-autoagents:
16-
LIBRARY_PATH=/opt/homebrew/lib:$$LIBRARY_PATH cargo build --release -p codegraph-mcp --bin codegraph --features "ai-enhanced,autoagents-experimental,faiss,embeddings-ollama,codegraph-ai/anthropic,codegraph-ai/openai-llm,codegraph-ai/openai-compatible"
16+
LIBRARY_PATH=/opt/homebrew/lib:$$LIBRARY_PATH cargo build --release -p codegraph-mcp --bin codegraph --features "ai-enhanced,autoagents-experimental,embeddings-ollama,codegraph-ai/anthropic,codegraph-ai/openai-llm,codegraph-ai/openai-compatible"
1717

1818
# Build MCP HTTP server with experimental HTTP transport
1919
.PHONY: build-mcp-http
2020
build-mcp-http:
21-
cargo build --release -p codegraph-mcp --bin codegraph --features "ai-enhanced,autoagents-experimental,faiss,embeddings-ollama,server-http"
21+
cargo build --release -p codegraph-mcp --bin codegraph --features "ai-enhanced,autoagents-experimental,embeddings-ollama,server-http"
2222

2323
# Run HTTP server (depends on build)
2424
.PHONY: run-http-server

README.md

Lines changed: 25 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ CodeGraph indexes your source code to a graph database, creates semantic embeddi
99
- 🔍 Semantic code search across your entire codebase
1010
- 🧠 LLM-powered code intelligence and analysis
1111
- 📊 Automatic dependency graphs and code relationships
12-
- ⚡ Fast vector search with FAISS or cloud SurrealDB HNSW (2-5ms query latency)
12+
- ⚡ Fast vector search backed by SurrealDB HNSW (2-5ms query latency)
1313
- 🔌 MCP server for AI tool integration (stdio and streamable HTTP)
1414
- ⚙️ Easy-to-use CLI interface
1515
- ☁️ **NEW:** Jina AI cloud embeddings with modifiable models and dimensions and reranking
@@ -32,7 +32,7 @@ export CODEGRAPH_EMBEDDING_DIMENSION=1024 # 384, 768, 1024, 1536,
3232
export CODEGRAPH_RERANKING_PROVIDER=lmstudio
3333
```
3434

35-
We automatically route embeddings to `embedding_384`, `embedding_768`, `embedding_1024`, `embedding_2048`, or `embedding_4096` and keep reranking disabled unless a provider is configured. No FAISS/RocksDB plumbing is needed for MCP anymore.
35+
We automatically route embeddings to `embedding_384`, `embedding_768`, `embedding_1024`, `embedding_2048`, `embedding_2056`, or `embedding_4096` and keep reranking disabled unless a provider is configured.
3636

3737
---
3838

@@ -42,7 +42,7 @@ We automatically route embeddings to `embedding_384`, `embedding_768`, `embeddin
4242

4343
### What Changed:
4444
-**MCP server** no longer uses FAISS vector search or RocksDB graph storage
45-
- **CLI and SDK** continue to support FAISS/RocksDB for local operations
45+
- **CLI and SDK** no longer support FAISS/RocksDB for local operations
4646
-**NAPI bindings** still provide TypeScript access to all features
4747
- 🆕 **MCP code-agent tools** now require SurrealDB for graph analysis
4848

@@ -96,15 +96,15 @@ CodeGraph now supports the **AutoAgents framework** for agentic orchestration as
9696
make build-mcp-autoagents
9797

9898
# Or directly with cargo
99-
cargo build --release -p codegraph-mcp --features "ai-enhanced,autoagents-experimental,faiss,ollama"
99+
cargo build --release -p codegraph-mcp --features "ai-enhanced,autoagents-experimental,ollama"
100100

101101
# HTTP server with AutoAgents
102-
cargo build --release -p codegraph-mcp --features "ai-enhanced,autoagents-experimental,faiss,embeddings-ollama,server-http"
102+
cargo build --release -p codegraph-mcp --features "ai-enhanced,autoagents-experimental,embeddings-ollama,server-http"
103103
```
104104

105105
**Without AutoAgents (default):**
106106
```bash
107-
cargo build --release -p codegraph-mcp --features "ai-enhanced,faiss,ollama"
107+
cargo build --release -p codegraph-mcp --features "ai-enhanced,ollama"
108108
```
109109

110110
### Status
@@ -200,16 +200,6 @@ Pick the setup that matches your needs:
200200
```bash
201201
# 1. Install Rust
202202
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
203-
204-
# 2. Install FAISS (vector search library)
205-
# macOS:
206-
brew install faiss
207-
208-
# Ubuntu/Debian:
209-
sudo apt-get install libfaiss-dev
210-
211-
# Arch Linux:
212-
sudo pacman -S faiss
213203
```
214204

215205
---
@@ -240,7 +230,7 @@ ollama pull qwen2.5-coder:14b
240230
cd codegraph-rust
241231

242232
# Build with ONNX embeddings and Ollama support
243-
cargo build --release --features "onnx,ollama,faiss"
233+
cargo build --release --features "onnx,ollama"
244234
```
245235

246236
**Step 4: Configure**
@@ -291,7 +281,7 @@ ollama_url = "http://localhost:11434"
291281
cd codegraph-rust
292282

293283
# Build with OpenAI-compatible support (for LM Studio)
294-
cargo build --release --features "openai-compatible,faiss"
284+
cargo build --release --features "openai-compatible"
295285
```
296286

297287
**Step 5: Configure**
@@ -338,13 +328,13 @@ lmstudio_url = "http://localhost:1234"
338328
cd codegraph-rust
339329

340330
# Build with all cloud providers
341-
cargo build --release --features "anthropic,openai-llm,openai,faiss"
331+
cargo build --release --features "anthropic,openai-llm,openai"
342332

343333
# Or with Jina AI cloud embeddings (Matryoska dimensions + reranking)
344-
cargo build --release --features "cloud-jina,anthropic,faiss"
334+
cargo build --release --features "cloud-jina,anthropic"
345335

346336
# Or with SurrealDB HNSW cloud/local vector backend
347-
cargo build --release --features "cloud-surrealdb,openai,faiss"
337+
cargo build --release --features "cloud-surrealdb,openai"
348338
```
349339

350340
**Step 3: Run setup wizard (easiest)**
@@ -436,7 +426,7 @@ openai_api_key = "sk-..."
436426
dimension = 2048
437427

438428
[vector_store]
439-
backend = "surrealdb" # Instead of "faiss"
429+
backend = "surrealdb"
440430
surrealdb_url = "ws://localhost:8000" # or cloud instance
441431
surrealdb_namespace = "codegraph"
442432
surrealdb_database = "production"
@@ -481,7 +471,7 @@ anthropic_api_key = "sk-ant-..."
481471

482472
Build with required features:
483473
```bash
484-
cargo build --release --features "onnx,anthropic,faiss"
474+
cargo build --release --features "onnx,anthropic"
485475
```
486476

487477
---
@@ -746,7 +736,6 @@ CodeGraph uses feature flags to enable only the components you need. Build with
746736

747737
| Feature | Description | Use Case |
748738
|---------|-------------|----------|
749-
| `faiss` | FAISS vector search + RocksDB | Local vector search with persistent graph storage |
750739
| `ai-enhanced` | Agentic MCP tools | Enables 7 agentic workflows with multi-step reasoning |
751740
| `server-http` | HTTP/SSE transport | Experimental HTTP server (use STDIO for production) |
752741
| `autoagents-experimental` | AutoAgents framework | ReAct orchestration (experimental, replaces custom orchestrator) |
@@ -779,28 +768,28 @@ CodeGraph uses feature flags to enable only the components you need. Build with
779768

780769
```bash
781770
# Local only (ONNX + Ollama)
782-
cargo build --release --features "onnx,ollama,faiss"
771+
cargo build --release --features "onnx,ollama"
783772

784773
# LM Studio
785-
cargo build --release --features "openai-compatible,faiss"
774+
cargo build --release --features "openai-compatible"
786775

787776
# Cloud only (Anthropic + OpenAI)
788-
cargo build --release --features "anthropic,openai-llm,openai,faiss"
777+
cargo build --release --features "anthropic,openai-llm,openai"
789778

790-
# Jina AI cloud embeddings + local FAISS
791-
cargo build --release --features "cloud-jina,faiss"
779+
# Jina AI cloud embeddings + local surrealDB
780+
cargo build --release --features "cloud-jina"
792781

793782
# SurrealDB cloud vector backend
794-
cargo build --release --features "cloud-surrealdb,openai,faiss"
783+
cargo build --release --features "cloud-surrealdb,openai"
795784

796785
# Full cloud (Jina + SurrealDB + Anthropic)
797-
cargo build --release --features "cloud,anthropic,faiss"
786+
cargo build --release --features "cloud,anthropic"
798787

799788
# Everything (local + cloud)
800-
cargo build --release --features "all-cloud-providers,onnx,ollama,cloud,faiss"
789+
cargo build --release --features "all-cloud-providers,onnx,ollama,cloud"
801790

802791
# HTTP server with AutoAgents (experimental)
803-
cargo build --release -p codegraph-mcp --features "ai-enhanced,autoagents-experimental,faiss,embeddings-ollama,server-http"
792+
cargo build --release -p codegraph-mcp --features "ai-enhanced,autoagents-experimental,embeddings-ollama,server-http"
804793
```
805794

806795
---
@@ -812,7 +801,7 @@ cargo build --release -p codegraph-mcp --features "ai-enhanced,autoagents-experi
812801
| Operation | Performance | Notes |
813802
|-----------|------------|-------|
814803
| **Embedding generation** | 120 embeddings/sec | LM Studio with MLX |
815-
| **Vector search (local)** | 2-5ms latency | FAISS with index caching |
804+
| **Vector search (local)** | 2-5ms latency | SurrealDB HNSW |
816805
| **Vector search (cloud)** | 2-5ms latency | SurrealDB HNSW |
817806
| **Jina AI embeddings** | 50-150ms per query | Cloud API call overhead |
818807
| **Jina reranking** | 80-200ms for top-K | Two-stage retrieval |
@@ -822,7 +811,6 @@ cargo build --release -p codegraph-mcp --features "ai-enhanced,autoagents-experi
822811

823812
| Optimization | Speedup | Memory Cost |
824813
|-------------|---------|-------------|
825-
| FAISS index cache | 10-50× | 300-600 MB |
826814
| Embedding cache | 10-100× | ~90 MB |
827815
| Query cache | 100× | ~10 MB |
828816
| Parallel search | 2-3× | Minimal |
@@ -831,19 +819,6 @@ cargo build --release -p codegraph-mcp --features "ai-enhanced,autoagents-experi
831819

832820
## 🔧 Troubleshooting
833821

834-
### Build Issues
835-
836-
**"Could not find library faiss"**
837-
```bash
838-
# Install FAISS first
839-
brew install faiss # macOS
840-
sudo apt-get install libfaiss-dev # Ubuntu
841-
```
842-
843-
**"Feature X is not enabled"**
844-
- Make sure you included the feature flag when building
845-
- Example: `cargo build --release --features "anthropic,faiss"`
846-
847822
### Runtime Issues
848823

849824
**"API key not found"**
@@ -879,7 +854,6 @@ CodeGraph provides native Node.js bindings through NAPI-RS for seamless TypeScri
879854
- 📘 **Auto-Generated Types**: TypeScript definitions generated directly from Rust code
880855
-**Async Runtime**: Full tokio async support integrated with Node.js event loop
881856
- 🔄 **Hot-Reload Config**: Update configuration without restarting your Node.js process
882-
- 🌐 **Dual-Mode Search**: Automatic routing between local FAISS and cloud SurrealDB
883857

884858
### Installation
885859

@@ -966,10 +940,10 @@ console.log(`Nodes: ${stats.node_count}, Edges: ${stats.edge_count}`);
966940

967941
**Feature flags for selective compilation:**
968942
```bash
969-
# Local-only (FAISS, no cloud)
943+
# Local-only (local surrealDB, no cloud)
970944
npm run build # Uses default = ["local"]
971945

972-
# Cloud-only (no FAISS)
946+
# Cloud-only (no local surrealDB
973947
npm run build -- --features cloud
974948

975949
# Full build (local + cloud)

TESTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ SURREALDB_DATABASE=production
9090
Build CodeGraph with the features you want to test:
9191

9292
```bash
93-
# Local-only (ONNX + Ollama + FAISS)
94-
cargo build --release --features "onnx,ollama,faiss"
93+
# Local-only (ONNX + Ollama + SurrealDB)
94+
cargo build --release --features "onnx,ollama,codegraph-graph/surrealdb"
9595

9696
# Cloud features (Jina AI + SurrealDB)
97-
cargo build --release --features "cloud-jina,cloud-surrealdb,faiss"
97+
cargo build --release --features "cloud-jina,cloud-surrealdb,codegraph-graph/surrealdb"
9898

9999
# Full build (all features)
100-
cargo build --release --features "all-cloud-providers,onnx,ollama,cloud,faiss"
100+
cargo build --release --features "all-cloud-providers,onnx,ollama,cloud,codegraph-graph/surrealdb"
101101
```
102102

103103
### 4. Index Your Project
@@ -136,7 +136,7 @@ python3 test_mcp_tools.py
136136

137137
**Recent improvements:**
138138
- Updated default model to `qwen2.5-coder:14b` (better for local testing)
139-
- Updated feature flags to use current features (`onnx,ollama,faiss` instead of deprecated `ai-enhanced,qwen-integration`)
139+
- Updated feature flags to use current features (`onnx,ollama,codegraph-graph/surrealdb` instead of deprecated `faiss`)
140140
- Added cloud configuration display (shows Jina AI and SurrealDB settings if configured)
141141
- Prefers release binary over debug binary for better performance
142142

claude-desktop-config.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

crates/codegraph-ai/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ description = "Advanced AI-powered code analysis: semantic search, clone detecti
1010
codegraph-core = { workspace = true }
1111
# NOTE: Re-enabling codegraph-graph for AI-powered symbol resolution
1212
codegraph-graph = { workspace = true }
13-
codegraph-vector = { workspace = true, features = ["faiss"] }
13+
codegraph-vector = { workspace = true }
1414
async-trait = { workspace = true }
1515
tokio = { workspace = true }
1616
thiserror = { workspace = true }

crates/codegraph-ai/src/llm_factory.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl LLMProviderFactory {
8686
let _ = config;
8787
Err(anyhow!(
8888
"Ollama provider now relies on the 'openai-compatible' feature. \
89-
Rebuild with --features codegraph-ai/openai-compatible or use 'qwen' provider instead."
89+
Rebuild with --features codegraph-ai/openai-compatible"
9090
))
9191
}
9292
}
@@ -156,10 +156,7 @@ impl LLMProviderFactory {
156156

157157
let anthropic_config = AnthropicConfig {
158158
api_key,
159-
model: config
160-
.model
161-
.clone()
162-
.unwrap_or_else(|| "claude".to_string()),
159+
model: config.model.clone().unwrap_or_else(|| "claude".to_string()),
163160
context_window: config.context_window,
164161
timeout_secs: config.timeout_secs,
165162
max_retries: 3,
@@ -185,7 +182,10 @@ impl LLMProviderFactory {
185182
let openai_config = OpenAIConfig {
186183
api_key,
187184
base_url: "https://api.openai.com/v1".to_string(),
188-
model: config.model.clone().unwrap_or_else(|| "gpt-5.1-codex".to_string()),
185+
model: config
186+
.model
187+
.clone()
188+
.unwrap_or_else(|| "gpt-5.1-codex".to_string()),
189189
context_window: config.context_window,
190190
timeout_secs: config.timeout_secs,
191191
max_retries: 3,

0 commit comments

Comments
 (0)