Graph-aware repository intelligence engine for grounded code retrieval, workflow reconstruction, and repository reasoning.
Because semantic search alone is never enough.
KernelMind is a retrieval + reasoning system built for understanding large repositories through:
- hybrid retrieval
- graph-aware expansion
- workflow reconstruction
- semantic reranking
- grounded answer generation
- repository-level reasoning traces
The system parses repositories into structured chunks, builds a call graph, retrieves semantically relevant regions, expands execution context using graph traversal, reranks candidates using a cross-encoder, and generates grounded responses from retrieved evidence.
KernelMind uses a hybrid architecture:
- grounded answer generation is currently handled through Sarvam AI
- retrieval, graph expansion, reranking, and evaluation run locally
Yes, my GPU has seen things.
Query
│
▼
Query Classification
│
▼
Hybrid Retrieval
(BM25 + Embeddings + RRF)
│
▼
Query-Aware Seed Reranking
│
▼
Graph Expansion
│
├── Depth Decay
├── Propagation Scoring
├── Operation-Aware Traversal
├── Query Overlap Boosting
└── Connectivity Weighting
│
▼
Cross-Encoder Reranking
│
▼
Reasoning Trace Construction
│
▼
Context Building
│
▼
Grounded Answer Generation
KernelMind uses a multi-stage retrieval pipeline designed specifically for repositories.
Semantic retrieval over chunk embeddings.
Exact lexical matching for:
- symbols
- identifiers
- filenames
- short tokens
- error strings
Merges semantic and lexical retrieval.
Scores candidate seeds using:
- overlap
- chunk type
- propagation weighting
- retrieval confidence
Expands repository context using:
- forward traversal
- reverse traversal
- propagation scoring
- connectivity weighting
- operation-aware gating
- depth decay
Final reranking pass using:
cross-encoder/ms-marco-MiniLM-L-6-v2
LLM generation constrained to retrieved repository evidence. Here, I use Sarvam AI, 105b model, which, by the way, is given for FREE. I know, it surprised me too.
sentence-transformers/all-MiniLM-L6-v2
cross-encoder/ms-marco-MiniLM-L-6-v2
Sarvam AI
KernelMind currently uses Sarvam AI for grounded answer generation.
Qwen 7B via Ollama
The retrieval stack, graph expansion, reranking pipeline, vector search, and evaluation infrastructure run locally.
Current local components include:
FAISS
BM25
Cross-Encoder Reranking
Qwen 7B via Ollama
Sarvam AI
FAISS
- BM25
- graph propagation
- reranking layers
- workflow reconstruction
- reasoning traces
Currently supported:
- Python
- Eventually working to add other languages - feel free to help!
Additional languages can be added through parser extensions.
KernelMind routes queries into different execution modes.
Workflow Mode - Deep graph traversal and execution reconstruction.
Symbol Lookup - Precision-oriented retrieval with minimal expansion.
Architecture Mode - Broader repository exploration.
General QA - Balanced retrieval fallback.
KernelMind includes a Textual-based terminal interface featuring:
- repository querying
- retrieval observability
- graph traces
- ranked chunk inspection
- streamed grounded answers
- workflow visualization
KernelMind includes evaluation support using:
RAGAS
with local Ollama-hosted Qwen evaluation.
| Configuration | Faithfulness | Answer Relevancy | Context Precision | Context Recall |
|---|---|---|---|---|
| Graph Expansion Enabled | 0.6080 | 0.7697 | 0.5962 | 0.5357 |
| Graph Expansion Relaxed | 0.6356 | 0.8478 | 0.4732 | 0.5714 |
The evaluation surfaced an important retrieval tradeoff:
- stricter graph traversal improved precision
- relaxed traversal improved workflow continuity and answer relevancy
- broader graph expansion improved recall
- excessive traversal suppression reduced execution-chain visibility
This is currently one of the most interesting active areas of experimentation in the project.
The system is effectively balancing:
precision ↔ recall
semantic locality ↔ workflow continuity
which is a surprisingly deep rabbit hole once graph propagation enters the picture.
- Hybrid retrieval
- FAISS vector search
- BM25 lexical retrieval
- Graph-aware expansion
- Propagation scoring
- Cross-encoder reranking
- Query-aware traversal
- Workflow reconstruction
- Reasoning traces
- Grounded generation
- Persistent repository runtimes
- Textual-based TUI
- Local-first execution - well, mostly!
python -m app.tuiQuery → Retrieval → Expansion → Reranking → Grounded Response
Most repository assistants:
- retrieve disconnected chunks
- ignore execution structure
- lose workflow continuity
- hallucinate relationships
- flatten repositories into embeddings
KernelMind attempts to preserve:
- execution topology
- call relationships
- workflow causality
- repository structure
- retrieval transparency
while still remaining practical to run locally.
Contributions are welcome.
Especially if you enjoy:
- retrieval systems
- graph reasoning
- semantic search
- code intelligence
- information retrieval
- systems engineering
- debugging graph propagation at 2 AM
Open issues, ideas, experiments, benchmarks, weird retrieval failures, and improvements are all appreciated.

