Architecture
OmniContext combines syntactic analysis, vector embeddings, dependency graph reasoning, and a universal IDE orchestrator to deliver fast, accurate semantic code search — entirely on your local machine.
System Overview
The system consists of five main components working together:
100%Click to activate controls
Data Flow Architecture
Indexing Pipeline
The indexing pipeline processes source files through multiple stages to build searchable indexes.
100%Click to activate controls
Search Pipeline
The search pipeline combines multiple retrieval strategies for optimal results.
100%Click to activate controls
Component Architecture
1. Parser and Chunker
Extracts AST structure and creates semantic chunks with full context.
100%Click to activate controls
Supported Languages: Python, TypeScript, JavaScript, Rust, Go, Java, C, C++, C#, Ruby, PHP, Swift, Kotlin, CSS
Chunk Structure:
- Symbol path (e.g.,
module::class::method) - Code content with full syntax
- Context prefix (parent file and class context)
- Line numbers and file path
- Doc comment (extracted for search)
- Metadata (< 2 KB per chunk)
2. Embedding System
Generates vector embeddings using a local ONNX model — no external API calls.
100%Click to activate controls
Specifications:
- Model: Jina embeddings v2 base code (
jina-embeddings-v2-base-code) - Format: ONNX (~550 MB, downloaded once to
~/.omnicontext/models/) - Dimensions: 768
- Throughput: > 800 chunks / second on CPU
- Quantization: INT8 (4× memory reduction when enabled)
- Batch size: Dynamic (16–128)
3. Search Engine
Hybrid retrieval combining keyword, semantic, and symbol search with graph-boosted reranking.
100%Click to activate controls
Search Stages:
- Intent Classification: Architectural / Implementation / Debugging / Refactor
- Query Expansion: Synonyms + HyDE (Hypothetical Document Embeddings)
- Multi-Signal Retrieval: BM25 + HNSW Vector + Symbol exact match (in parallel)
- RRF Fusion: Reciprocal Rank Fusion with adaptive weights
- Cross-Encoder Reranking:
jina-reranker-v2-base-multilingual - Graph Boosting: Dependency proximity scoring
4. Dependency Graph
Tracks relationships between code elements for architectural understanding and blast radius analysis.
100%Click to activate controls
Edge Types:
| Type | Meaning |
|---|---|
IMPORTS | Module or package import |
INHERITS | Class inheritance |
CALLS | Function call relationship |
INSTANTIATES | Object instantiation |
HISTORICAL_CO_CHANGE | Files changed together in git commits |
Operations:
- N-hop BFS traversal (< 10 ms for 1-hop on 10 K+ nodes)
- PageRank importance scoring
- Community detection
- Blast radius analysis
- Proximity boosting for search reranking
5. Orchestrator Module
The Orchestrator (crates/omni-cli/src/orchestrator.rs) auto-discovers every AI IDE and agent installed on the host and injects a single universal MCP server entry using --repo ..
100%Click to activate controls
Design principles:
- Universal entry: always keyed
"omnicontext"— never project-specific hash variants. --repo .standard: the MCP server is started with--repo .so it resolves the workspace dynamically from the IDE's working directory orOMNICONTEXT_REPOenv var.- Atomic JSON patching: existing IDE config files are never overwritten wholesale; only the
"omnicontext"key inside the MCP servers map is inserted or updated. - Legacy purge: any
omnicontext-<hex>duplicate entries from older versions are removed automatically. - Idempotent: running
omnicontext setup --allmultiple times is safe — it is a no-op when the entry is already current. - Self-repair: the orchestrator performs a silent health check on each
omnicontextinvocation and re-injects any entries that were lost due to an IDE update overwriting its config.
Storage Architecture
Database Schema
100%Click to activate controls
Index Structure
100%Click to activate controls
Performance Characteristics
Search Latency Breakdown (P99 target: < 50 ms)
100%Click to activate controls
Scalability
| Index Size | Search P99 | Memory | Throughput |
|---|---|---|---|
| 10 K chunks | < 50 ms | 200 MB | 1 000 qps |
| 100 K chunks | < 50 ms | 1.5 GB | 800 qps |
| 1 M chunks | < 75 ms | 12 GB | 500 qps |
| 10 M chunks | < 100 ms | 100 GB | 200 qps |
Technology Stack
100%Click to activate controls
Deployment Architecture
Standalone Mode (Default)
100%Click to activate controls
Binary names:
| Binary | Role |
|---|---|
omnicontext | Primary CLI (index, search, config, setup, mcp subcommand) |
omnicontext-mcp | Dedicated MCP server binary (stdio transport) |
omnicontext-daemon | Background file-watcher daemon for incremental re-indexing |
Key Differentiators
| Capability | OmniContext | Sourcegraph | GitHub Copilot | ripgrep |
|---|---|---|---|---|
| 100% local | ✅ | ❌ (cloud) | ❌ (cloud) | ✅ |
| Semantic search | ✅ | ✅ | ✅ | ❌ |
| Graph-aware ranking | ✅ | Partial | ❌ | ❌ |
| MCP native | ✅ | ❌ | ❌ | ❌ |
| Sub-50 ms queries | ✅ | Varies | Varies | ✅ |
| Open source | ✅ (Apache 2.0) | Partial | ❌ | ✅ |
Research Foundation
| Technique | Reference | Application in OmniContext |
|---|---|---|
| RAPTOR | arXiv:2401.18059 (2024) | Hierarchical chunking |
| Late Chunking | arXiv:2409.04701 (2024) | Context-preserving chunk boundaries |
| Contextual Retrieval | Anthropic (2024) | Chunk enrichment with context prefixes |
| HyDE | arXiv:2212.10496 (2022) | Query expansion via hypothetical documents |
| HNSW | arXiv:1603.09320 (2018) | Approximate nearest-neighbor vector indexing |
| RRF | Cormack SIGIR (2009) | Multi-signal result fusion |
| MS MARCO | Microsoft (2021) | Cross-encoder reranking training data |