Search documentation...Ctrl K
Architecture

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:

  1. Intent Classification: Architectural / Implementation / Debugging / Refactor
  2. Query Expansion: Synonyms + HyDE (Hypothetical Document Embeddings)
  3. Multi-Signal Retrieval: BM25 + HNSW Vector + Symbol exact match (in parallel)
  4. RRF Fusion: Reciprocal Rank Fusion with adaptive weights
  5. Cross-Encoder Reranking: jina-reranker-v2-base-multilingual
  6. 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:

TypeMeaning
IMPORTSModule or package import
INHERITSClass inheritance
CALLSFunction call relationship
INSTANTIATESObject instantiation
HISTORICAL_CO_CHANGEFiles 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 or OMNICONTEXT_REPO env 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 --all multiple 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 omnicontext invocation 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 SizeSearch P99MemoryThroughput
10 K chunks< 50 ms200 MB1 000 qps
100 K chunks< 50 ms1.5 GB800 qps
1 M chunks< 75 ms12 GB500 qps
10 M chunks< 100 ms100 GB200 qps

Technology Stack

100%
Click to activate controls

Deployment Architecture

Standalone Mode (Default)

100%
Click to activate controls

Binary names:

BinaryRole
omnicontextPrimary CLI (index, search, config, setup, mcp subcommand)
omnicontext-mcpDedicated MCP server binary (stdio transport)
omnicontext-daemonBackground file-watcher daemon for incremental re-indexing

Key Differentiators

CapabilityOmniContextSourcegraphGitHub Copilotripgrep
100% local❌ (cloud)❌ (cloud)
Semantic search
Graph-aware rankingPartial
MCP native
Sub-50 ms queriesVariesVaries
Open source✅ (Apache 2.0)Partial

Research Foundation

TechniqueReferenceApplication in OmniContext
RAPTORarXiv:2401.18059 (2024)Hierarchical chunking
Late ChunkingarXiv:2409.04701 (2024)Context-preserving chunk boundaries
Contextual RetrievalAnthropic (2024)Chunk enrichment with context prefixes
HyDEarXiv:2212.10496 (2022)Query expansion via hypothetical documents
HNSWarXiv:1603.09320 (2018)Approximate nearest-neighbor vector indexing
RRFCormack SIGIR (2009)Multi-signal result fusion
MS MARCOMicrosoft (2021)Cross-encoder reranking training data