Skip to content
Sameer Verma edited this page Jan 26, 2026 · 1 revision

RepoMind - CAG Architecture

Context Augmented Generation (CAG) is the core engine behind RepoMind, designed to overcome the limitations of traditional Retrieval Augmented Generation (RAG) when dealing with complex codebases.

Instead of retrieving small, disconnected fragments of code, CAG leverages the massive context windows of modern LLMs (1M+ tokens) to understand the whole picture.

CAG vs. Traditional RAG

Feature Traditional RAG RepoMind (CAG)
Context Strategy Fragmented Context: Chops code into small, disconnected vector chunks. Full File Context: Loads entire relevant files into the 1M+ token window.
Retrieval Method Similarity Search: Relies on fuzzy matching which often misses logic and flow. Smart Agent Selection: AI intelligently picks files based on dependency graphs.
State Stateless: Forgets everything after each query. KV Caching: Remembers context for instant follow-up answers.

Key Capabilities

1. Full File Context

CAG moves beyond vector databases by loading complete files into the model's context. This allows the AI to see function definitions, imports, and logic flow in their entirety, rather than guessing from a 5-line snippet.

2. Smart Agent Selection

Rather than relying on simple keyword matching, CAG uses dependency graphs to understand how files relate to each other. If you ask about a component, it knows to also look at the hooks and utilities that component uses.

3. KV Caching

To ensure speed despite large context sizes, CAG utilizes Key-Value (KV) caching. This means once a file is processed, its "understanding" is cached, making follow-up questions instant.