# harshaappikatla/codegraph-rag architecture

> Architecture diagram of the GitHub repository harshaappikatla/codegraph-rag, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/harshaappikatla/codegraph-rag
- Repository: https://github.com/harshaappikatla/codegraph-rag

## Overview

CodeGraph-RAG ingests source repositories into a scope-aware AST, then indexes code in a vector store and structural dependencies in a graph store. Users query through the interactive entry point or MCP tools; the agent combines semantic retrieval with graph-based impact analysis to produce answers. The README also documents polyglot parsing, model failover, and IDE integrations. Some ingestion and synthesis internals are unsampled, so those links are shown only where the README or source index supports them.

Main entry points: [`modules/repo_ingestor.py`](https://github.com/harshaappikatla/codegraph-rag/blob/main/modules/repo_ingestor.py) (Repository Ingestor), [`modules/agent_workflow.py`](https://github.com/harshaappikatla/codegraph-rag/blob/main/modules/agent_workflow.py) (CodeGraph Agent), [`main.py`](https://github.com/harshaappikatla/codegraph-rag/blob/main/main.py) (Interactive Entry), [`modules/graph_store.py`](https://github.com/harshaappikatla/codegraph-rag/blob/main/modules/graph_store.py) (Dependency Graph)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Repository Ingestion"]
  node_ingestor["Repository Ingestor<br/>[repo_ingestor.py]"]
  node_parser["Polyglot AST Parser<br/>[ast_parser.py]"]
end

subgraph group_index["Code Indexes"]
  node_graph_store[("Dependency Graph<br/>[graph_store.py]")]
  node_vector_store[("Vector Index<br/>[vector_store.py]")]
end

subgraph group_query["Retrieval and Reasoning"]
  node_agent["CodeGraph Agent<br/>[agent_workflow.py]"]
end

subgraph group_serve["Interfaces"]
  node_main["Interactive Entry<br/>[main.py]"]
  node_mcp["MCP Server<br/>[mcp_server.py]"]
end

node_developer(("Developer"))
node_target_repo["Target Repository"]
node_gemini{{"Gemini Models"}}
node_ide_clients(("IDE Clients"))

node_developer -->|"asks query"| node_main
node_target_repo -->|"provides source"| node_main
node_main -->|"parses files"| node_parser
node_main -->|"writes structures"| node_graph_store
node_main -->|"indexes snippets"| node_vector_store
node_target_repo -->|"supplies repository"| node_ingestor
node_ingestor -->|"extracts structures"| node_parser
node_ingestor -->|"indexes graph"| node_graph_store
node_ingestor -->|"indexes vectors"| node_vector_store
node_parser -->|"provides AST data"| node_graph_store
node_parser -->|"provides code chunks"| node_vector_store
node_developer -->|"submits query"| node_agent
node_agent -->|"searches snippets"| node_vector_store
node_agent -->|"analyzes impact"| node_graph_store
node_agent -.->|"generates answer"| node_gemini
node_ide_clients -->|"sends MCP requests"| node_mcp
node_mcp -->|"routes search"| node_agent
node_mcp -->|"requests impact"| node_graph_store
node_mcp -->|"starts ingestion"| node_ingestor

click node_main "https://github.com/harshaappikatla/codegraph-rag/blob/main/main.py"
click node_ingestor "https://github.com/harshaappikatla/codegraph-rag/blob/main/modules/repo_ingestor.py"
click node_parser "https://github.com/harshaappikatla/codegraph-rag/blob/main/modules/ast_parser.py"
click node_graph_store "https://github.com/harshaappikatla/codegraph-rag/blob/main/modules/graph_store.py"
click node_vector_store "https://github.com/harshaappikatla/codegraph-rag/blob/main/modules/vector_store.py"
click node_agent "https://github.com/harshaappikatla/codegraph-rag/blob/main/modules/agent_workflow.py"
click node_mcp "https://github.com/harshaappikatla/codegraph-rag/blob/main/mcp_server.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ingestor,node_parser,node_ide_clients toneBlue
class node_graph_store,node_vector_store toneAmber
class node_agent toneMint
class node_main,node_mcp toneRose
class node_developer,node_target_repo,node_gemini toneIndigo
```

## Components

### Repository Ingestion

- [Repository Ingestor](https://github.com/harshaappikatla/codegraph-rag/blob/main/modules/repo_ingestor.py): `modules/repo_ingestor.py`
- [Polyglot AST Parser](https://github.com/harshaappikatla/codegraph-rag/blob/main/modules/ast_parser.py): `modules/ast_parser.py`

### Code Indexes

- [Dependency Graph](https://github.com/harshaappikatla/codegraph-rag/blob/main/modules/graph_store.py): `modules/graph_store.py`
- [Vector Index](https://github.com/harshaappikatla/codegraph-rag/blob/main/modules/vector_store.py): `modules/vector_store.py`

### Retrieval and Reasoning

- [CodeGraph Agent](https://github.com/harshaappikatla/codegraph-rag/blob/main/modules/agent_workflow.py): `modules/agent_workflow.py`

### Interfaces

- [Interactive Entry](https://github.com/harshaappikatla/codegraph-rag/blob/main/main.py): `main.py`
- [MCP Server](https://github.com/harshaappikatla/codegraph-rag/blob/main/mcp_server.py): `mcp_server.py`

### Other components

- **Developer**
- **Target Repository**
- **Gemini Models**
- **IDE Clients**

## Connections

- Developer → Interactive Entry: asks query (evidence: `main.py`)
- Target Repository → Interactive Entry: provides source (evidence: `main.py`)
- Interactive Entry → Polyglot AST Parser: parses files (evidence: `main.py`)
- Interactive Entry → Dependency Graph: writes structures (evidence: `main.py`)
- Interactive Entry → Vector Index: indexes snippets (evidence: `main.py`)
- Target Repository → Repository Ingestor: supplies repository (evidence: `README.md`)
- Repository Ingestor → Polyglot AST Parser: extracts structures (evidence: `modules/repo_ingestor.py`)
- Repository Ingestor → Dependency Graph: indexes graph (evidence: `modules/repo_ingestor.py`)
- Repository Ingestor → Vector Index: indexes vectors (evidence: `modules/repo_ingestor.py`)
- Polyglot AST Parser → Dependency Graph: provides AST data (evidence: `main.py`)
- Polyglot AST Parser → Vector Index: provides code chunks (evidence: `main.py`)
- Developer → CodeGraph Agent: submits query
- CodeGraph Agent → Vector Index: searches snippets (evidence: `modules/agent_workflow.py`)
- CodeGraph Agent → Dependency Graph: analyzes impact (evidence: `modules/agent_workflow.py`)
- CodeGraph Agent → Gemini Models: generates answer (evidence: `README.md`)
- IDE Clients → MCP Server: sends MCP requests (evidence: `README.md`)
- MCP Server → CodeGraph Agent: routes search (evidence: `mcp_server.py`)
- MCP Server → Dependency Graph: requests impact (evidence: `mcp_server.py`)
- MCP Server → Repository Ingestor: starts ingestion (evidence: `mcp_server.py`)
