Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,31 @@ HYBRID_IN_PROCESS=1
RERANK_IN_PROCESS=1


# Tree-sitter parsing (enable for more accurate symbols/scopes)
# Query Optimization (adaptive HNSW_EF tuning for 2x faster simple queries)
QUERY_OPTIMIZER_ADAPTIVE=1
QUERY_OPTIMIZER_MIN_EF=64
QUERY_OPTIMIZER_MAX_EF=512
QUERY_OPTIMIZER_SIMPLE_THRESHOLD=0.3
QUERY_OPTIMIZER_COMPLEX_THRESHOLD=0.7
QUERY_OPTIMIZER_SIMPLE_FACTOR=0.5
QUERY_OPTIMIZER_SEMANTIC_FACTOR=1.0
QUERY_OPTIMIZER_COMPLEX_FACTOR=2.0
QUERY_OPTIMIZER_DENSE_THRESHOLD=0.2
QUERY_OPTIMIZER_COLLECTION_SIZE=10000
QDRANT_EF_SEARCH=128

# AST-based code understanding (semantic chunking for 20-30% better precision)
USE_TREE_SITTER=1
INDEX_USE_ENHANCED_AST=1
INDEX_SEMANTIC_CHUNKS=1


# Hybrid/rerank quick-win defaults (can override via flags)
# Hybrid/rerank defaults
HYBRID_EXPAND=0
HYBRID_PER_PATH=1
# Increased symbol boost to prioritize function/class definitions
HYBRID_SYMBOL_BOOST=0.35
HYBRID_RECENCY_WEIGHT=0.1
RERANK_EXPAND=1

# Disable semantic chunking to use micro-chunking instead
INDEX_SEMANTIC_CHUNKS=1


# Memory integration (SSE + Qdrant)
MEMORY_SSE_ENABLED=true
Expand Down
22 changes: 17 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,33 @@ LLM_EXPAND_MAX=4
# PRF defaults (enabled by default)
PRF_ENABLED=1

# Tree-sitter parsing (enable for more accurate symbols/scopes)
# Query Optimization (adaptive HNSW_EF tuning for 2x faster simple queries)
QUERY_OPTIMIZER_ADAPTIVE=1
QUERY_OPTIMIZER_MIN_EF=64
QUERY_OPTIMIZER_MAX_EF=512
QUERY_OPTIMIZER_SIMPLE_THRESHOLD=0.3
QUERY_OPTIMIZER_COMPLEX_THRESHOLD=0.7
QUERY_OPTIMIZER_SIMPLE_FACTOR=0.5
QUERY_OPTIMIZER_SEMANTIC_FACTOR=1.0
QUERY_OPTIMIZER_COMPLEX_FACTOR=2.0
QUERY_OPTIMIZER_DENSE_THRESHOLD=0.2
QUERY_OPTIMIZER_COLLECTION_SIZE=10000
QDRANT_EF_SEARCH=128

# AST-based code understanding (semantic chunking for 20-30% better precision)
USE_TREE_SITTER=1
INDEX_USE_ENHANCED_AST=1
INDEX_SEMANTIC_CHUNKS=1

# Indexer scaling and exclusions
# Exclusions: defaults can be disabled or extended
# QDRANT_DEFAULT_EXCLUDES=0
# QDRANT_IGNORE_FILE=.qdrantignore
# QDRANT_EXCLUDES=tokenizer.json,*.onnx,/vendor
# Chunking + batching (tune for large repos)
# INDEX_CHUNK_LINES=120
# INDEX_CHUNK_OVERLAP=20
# INDEX_BATCH_SIZE=64
# INDEX_PROGRESS_EVERY=200

USE_TREE_SITTER=0


# ReFRAG mode (optional): compact gating + micro-chunking
# Enable to add a 64-dim mini vector for fast gating and use token-based micro-chunks
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Context-Engine is a plug-and-play MCP retrieval stack that unifies code indexing
**Key differentiators**
- One-command bring-up delivers dual SSE/RMCP endpoints, seeded Qdrant, and live watch/reindex loops
- ReFRAG-inspired micro-chunking, token budgeting, and gate-first filtering surface precise spans
- **Dynamic query optimization** with adaptive HNSW_EF tuning and intelligent routing for 2x faster simple queries
- **AST-based semantic chunking** preserves function/class boundaries for 20-30% better retrieval precision
- Shared memory/indexer schema and reranker tooling for dense, lexical, and semantic signals
- **ctx CLI prompt enhancer** with multi-pass unicorn mode for code-grounded prompt rewriting
- VS Code extension with Prompt+ button and automatic workspace sync
Expand Down
23 changes: 22 additions & 1 deletion docs/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Complete environment variable reference for Context Engine.
**On this page:**
- [Core Settings](#core-settings)
- [Indexing & Micro-Chunks](#indexing--micro-chunks)
- [Query Optimization](#query-optimization)
- [Watcher Settings](#watcher-settings)
- [Reranker](#reranker)
- [Decoder (llama.cpp / GLM)](#decoder-llamacpp--glm)
Expand Down Expand Up @@ -37,12 +38,32 @@ Complete environment variable reference for Context Engine.
| TOKENIZER_URL | HF tokenizer.json URL (for Make download) | n/a |
| TOKENIZER_PATH | Local path where tokenizer is saved (Make) | models/tokenizer.json |
| TOKENIZER_JSON | Runtime path for tokenizer (indexer) | models/tokenizer.json |
| USE_TREE_SITTER | Enable tree-sitter parsing (py/js/ts) | 0 (off) |
| USE_TREE_SITTER | Enable tree-sitter parsing (py/js/ts) | 1 (on) |
| INDEX_USE_ENHANCED_AST | Enable advanced AST-based semantic chunking | 1 (on) |
| INDEX_SEMANTIC_CHUNKS | Enable semantic chunking (preserve function/class boundaries) | 1 (on) |
| INDEX_CHUNK_LINES | Lines per chunk (non-micro mode) | 120 |
| INDEX_CHUNK_OVERLAP | Overlap lines between chunks | 20 |
| INDEX_BATCH_SIZE | Upsert batch size | 64 |
| INDEX_PROGRESS_EVERY | Log progress every N files | 200 |

## Query Optimization

Dynamic HNSW_EF tuning and intelligent query routing for 2x faster simple queries.

| Name | Description | Default |
|------|-------------|---------|
| QUERY_OPTIMIZER_ADAPTIVE | Enable adaptive EF optimization | 1 (on) |
| QUERY_OPTIMIZER_MIN_EF | Minimum EF value | 64 |
| QUERY_OPTIMIZER_MAX_EF | Maximum EF value | 512 |
| QUERY_OPTIMIZER_SIMPLE_THRESHOLD | Complexity threshold for simple queries | 0.3 |
| QUERY_OPTIMIZER_COMPLEX_THRESHOLD | Complexity threshold for complex queries | 0.7 |
| QUERY_OPTIMIZER_SIMPLE_FACTOR | EF multiplier for simple queries | 0.5 |
| QUERY_OPTIMIZER_SEMANTIC_FACTOR | EF multiplier for semantic queries | 1.0 |
| QUERY_OPTIMIZER_COMPLEX_FACTOR | EF multiplier for complex queries | 2.0 |
| QUERY_OPTIMIZER_DENSE_THRESHOLD | Complexity threshold for dense-only routing | 0.2 |
| QUERY_OPTIMIZER_COLLECTION_SIZE | Approximate collection size for scaling | 10000 |
| QDRANT_EF_SEARCH | Base HNSW_EF value (overridden by optimizer) | 128 |

## Watcher Settings

| Name | Description | Default |
Expand Down
Loading
Loading