@iceinvein/code-intelligence-mcp 1.2.3 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -31
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,8 +14,7 @@ This server indexes your codebase locally to provide **fast, semantic, and struc
|
|
|
14
14
|
|
|
15
15
|
Unlike basic text search, this server builds a local knowledge graph to understand your code.
|
|
16
16
|
|
|
17
|
-
* **Advanced Hybrid Search**: Combines **Tantivy** (keyword BM25) + **LanceDB** (semantic vector) + **
|
|
18
|
-
* **Cross-Encoder Reranking**: Always-on ORT-based reranker for precision result ranking.
|
|
17
|
+
* **Advanced Hybrid Search**: Combines **Tantivy** (keyword BM25) + **LanceDB** (semantic vector) + **jina-code-embeddings-0.5b** (896-dim code-specific model via llama.cpp + Metal GPU) with Reciprocal Rank Fusion (RRF).
|
|
19
18
|
* **Smart Context Assembly**: Token-aware budgeting with query-aware truncation that keeps relevant lines within context limits.
|
|
20
19
|
* **On-Device LLM Descriptions**: Automatically generates natural-language descriptions for every symbol using a local **Qwen2.5-Coder-1.5B** model (llama.cpp with Metal GPU), enriching search with human-readable summaries.
|
|
21
20
|
* **PageRank Scoring**: Graph-based symbol importance scoring that identifies central, heavily-used components.
|
|
@@ -47,7 +46,7 @@ Add to your `opencode.json` (or global config):
|
|
|
47
46
|
}
|
|
48
47
|
```
|
|
49
48
|
|
|
50
|
-
*The server will automatically download the embedding model (~
|
|
49
|
+
*The server will automatically download the embedding model (~531MB) and LLM (~1.1GB) on first launch, then index your project in the background.*
|
|
51
50
|
|
|
52
51
|
---
|
|
53
52
|
|
|
@@ -140,7 +139,7 @@ Both embedded (stdio) and standalone (HTTP) modes store all data in `~/.code-int
|
|
|
140
139
|
~/.code-intelligence/
|
|
141
140
|
├── server.toml # Optional config file (standalone only)
|
|
142
141
|
├── models/ # Shared models (loaded once, shared across repos)
|
|
143
|
-
│ ├── jina-code-
|
|
142
|
+
│ ├── jina-code-embeddings-0.5b-gguf/ # Embedding model (~531MB, GGUF via llama.cpp)
|
|
144
143
|
│ └── qwen2.5-coder-1.5b-gguf/ # LLM model (~1.1GB)
|
|
145
144
|
├── logs/
|
|
146
145
|
│ └── server.log
|
|
@@ -170,10 +169,8 @@ host = "127.0.0.1"
|
|
|
170
169
|
port = 3333
|
|
171
170
|
|
|
172
171
|
[embeddings]
|
|
173
|
-
backend = "
|
|
172
|
+
backend = "llamacpp" # llamacpp (default) or hash (testing)
|
|
174
173
|
device = "metal" # cpu or metal (macOS GPU)
|
|
175
|
-
auto_download = false
|
|
176
|
-
model_repo = "jinaai/jina-embeddings-v2-base-code"
|
|
177
174
|
|
|
178
175
|
[repos.defaults]
|
|
179
176
|
index_patterns = "**/*.ts,**/*.tsx,**/*.rs,**/*.py,**/*.go"
|
|
@@ -189,11 +186,9 @@ warm_ttl_seconds = 300 # How long idle repos stay in memory
|
|
|
189
186
|
| Variable | Example | Description |
|
|
190
187
|
| -------- | ------- | ----------- |
|
|
191
188
|
| `CIMCP_MODE` | `standalone` | Alternative to `--standalone` flag |
|
|
192
|
-
| `EMBEDDINGS_BACKEND` | `hash` | Override embedding backend |
|
|
189
|
+
| `EMBEDDINGS_BACKEND` | `hash` | Override embedding backend (`llamacpp` or `hash`) |
|
|
193
190
|
| `EMBEDDINGS_DEVICE` | `metal` | Override device (cpu/metal) |
|
|
194
|
-
| `EMBEDDINGS_MODEL_REPO` | `jinaai/...` | Override model repo |
|
|
195
191
|
| `EMBEDDINGS_MODEL_DIR` | `/path/to/model` | Override model directory |
|
|
196
|
-
| `EMBEDDINGS_MAX_THREADS` | `4` | Limit embedding threads |
|
|
197
192
|
|
|
198
193
|
---
|
|
199
194
|
|
|
@@ -266,20 +261,19 @@ The server supports semantic navigation and symbol extraction for the following
|
|
|
266
261
|
The ranking engine optimizes results for relevance using sophisticated signals:
|
|
267
262
|
|
|
268
263
|
1. **PageRank Symbol Importance**: Graph-based scoring that identifies central, heavily-used components (similar to Google's PageRank).
|
|
269
|
-
2. **
|
|
270
|
-
3. **
|
|
271
|
-
4. **
|
|
272
|
-
5. **
|
|
273
|
-
6. **
|
|
274
|
-
7. **
|
|
275
|
-
8. **
|
|
276
|
-
9. **
|
|
277
|
-
10. **
|
|
278
|
-
11. **
|
|
279
|
-
12. **
|
|
280
|
-
13. **
|
|
281
|
-
14. **
|
|
282
|
-
15. **Package-Aware Scoring** (multi-repo): Boosts results from the same package when working in monorepos.
|
|
264
|
+
2. **Reciprocal Rank Fusion (RRF)**: Combines keyword, vector, and graph search results using statistically optimal rank fusion.
|
|
265
|
+
3. **Query Decomposition**: Complex queries ("X and Y") are automatically split into sub-queries for better coverage.
|
|
266
|
+
4. **Token-Aware Truncation**: Context assembly keeps query-relevant lines within token budgets using BM25-style relevance scoring.
|
|
267
|
+
5. **LLM-Enriched Indexing**: On-device Qwen2.5-Coder generates natural-language descriptions for each symbol, bridging the vocabulary gap between how developers search and how code is named.
|
|
268
|
+
6. **Morphological Variants**: Function names are expanded with stems and derivations (e.g., `watch` → `watcher`, `index` → `reindex`) to improve recall for natural-language queries.
|
|
269
|
+
7. **Multi-Layer Test Detection**: Three mechanisms — file path patterns (`*.test.ts`), symbol name heuristics (`test_*`), and SQL-based AST analysis (`#[test]`, `mod tests`) — with a final enforcement pass that prevents test code from escaping via edge expansion.
|
|
270
|
+
8. **Edge Expansion**: High-ranking symbols pull in structurally related code (callers, type members) with importance filtering to avoid noise from private helpers.
|
|
271
|
+
9. **Directory Semantics**: Implementation directories (`src`, `lib`, `app`) are boosted, while build artifacts (`dist`, `build`) and `node_modules` are penalized.
|
|
272
|
+
10. **Exported Symbol Boost**: Exported/public symbols receive a ranking boost as they represent the primary API surface.
|
|
273
|
+
11. **Glue Code Filtering**: Re-export files (e.g., `index.ts`) are deprioritized in favor of the actual implementation.
|
|
274
|
+
12. **JSDoc Boost**: Symbols with documentation receive a ranking boost, and examples are included in search results.
|
|
275
|
+
13. **Learning from Feedback** (optional): Tracks user selections to personalize future search results.
|
|
276
|
+
14. **Package-Aware Scoring** (multi-repo): Boosts results from the same package when working in monorepos.
|
|
283
277
|
|
|
284
278
|
### Intent Detection
|
|
285
279
|
|
|
@@ -317,7 +311,7 @@ Works without configuration by default. You can customize behavior via environme
|
|
|
317
311
|
|
|
318
312
|
```json
|
|
319
313
|
"env": {
|
|
320
|
-
"EMBEDDINGS_BACKEND": "
|
|
314
|
+
"EMBEDDINGS_BACKEND": "llamacpp", // llamacpp (default) or hash (testing)
|
|
321
315
|
"EMBEDDINGS_DEVICE": "cpu", // cpu or metal (macOS GPU)
|
|
322
316
|
"EMBEDDING_BATCH_SIZE": "32"
|
|
323
317
|
}
|
|
@@ -394,7 +388,7 @@ flowchart LR
|
|
|
394
388
|
Scan --> Parse[Tree-Sitter]
|
|
395
389
|
Parse --> Extract[Symbol Extraction]
|
|
396
390
|
Extract --> PageRank[PageRank Compute]
|
|
397
|
-
Extract --> Embed[
|
|
391
|
+
Extract --> Embed[jina-code-0.5b Embeddings - llama.cpp]
|
|
398
392
|
Extract --> LLMDesc[LLM Descriptions - Qwen2.5-Coder]
|
|
399
393
|
Extract --> JSDoc[JSDoc/Decorator/TODO Extract]
|
|
400
394
|
end
|
|
@@ -411,7 +405,6 @@ flowchart LR
|
|
|
411
405
|
direction TB
|
|
412
406
|
QueryExpand[Query Expansion]
|
|
413
407
|
Hybrid[Hybrid Search RRF]
|
|
414
|
-
Rerank[Cross-Encoder Reranker]
|
|
415
408
|
Signals[Ranking Signals]
|
|
416
409
|
Context[Token-Aware Assembly]
|
|
417
410
|
end
|
|
@@ -426,8 +419,7 @@ flowchart LR
|
|
|
426
419
|
|
|
427
420
|
Tools -- Query --> QueryExpand
|
|
428
421
|
QueryExpand --> Hybrid
|
|
429
|
-
Hybrid -->
|
|
430
|
-
Rerank --> Signals
|
|
422
|
+
Hybrid --> Signals
|
|
431
423
|
Signals --> Context
|
|
432
424
|
Context --> Tools
|
|
433
425
|
end
|
|
@@ -475,9 +467,9 @@ src/
|
|
|
475
467
|
│ ├── mod.rs # Shared tool dispatch, embedded handler
|
|
476
468
|
│ └── standalone.rs # Standalone HTTP handler with session routing
|
|
477
469
|
├── tools/ # Tool definitions (23 MCP tools)
|
|
478
|
-
├── embeddings/ #
|
|
470
|
+
├── embeddings/ # jina-code-0.5b embedding model (GGUF via llama.cpp)
|
|
479
471
|
├── llm/ # On-device LLM (Qwen2.5-Coder-1.5B via llama.cpp)
|
|
480
|
-
├── reranker/ #
|
|
472
|
+
├── reranker/ # Reranker trait and cache (currently disabled)
|
|
481
473
|
├── path/ # Cross-platform path normalization (camino)
|
|
482
474
|
├── text.rs # Text processing (synonym expansion, morphological variants)
|
|
483
475
|
├── metrics/ # Prometheus metrics
|