# kuruva-radhakrishna/devpilot architecture

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

- Interactive diagram: https://gitdiagram.com/kuruva-radhakrishna/devpilot
- Repository: https://github.com/kuruva-radhakrishna/devpilot

## Overview

DevPilot turns a repository source (GitHub or local) into indexed code, then lets users ask grounded questions or run an autonomous repair loop that tests and patches a workspace. The backend also exposes review, authentication, MCP tools, trace inspection, and pipeline evaluation; the React UI is the primary interactive client. Groups and arrows follow the README and indexed references, with sampled source confirming selected retrieval, repair, provider, and tracing behavior. Unsampled implementations are represented only where documented or indexed; uncertain links are omitted.

Main entry points: [`backend/app/agent/repair.py`](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/agent/repair.py) (Repair Loop), [`backend/app/rag/retriever.py`](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/rag/retriever.py) (Hybrid Retrieval), [`backend/app/llm/client.py`](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/llm/client.py) (Provider Interface), [`backend/app/main.py`](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/main.py) (HTTP API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client and API"]
  node_ui["Web UI<br/>[App.tsx]"]
  node_http_api["HTTP API<br/>[main.py]"]
  node_auth["Authentication<br/>[routes_auth.py]"]
  node_repo_routes["Repository API<br/>[routes_repo.py]"]
  node_agent_routes["Agent API<br/>[routes_agent.py]"]
  node_review_routes["Review API<br/>[routes_review.py]"]
  node_persistent_store[("User Repository Store<br/>[store.py]")]
end

subgraph group_knowledge["Repository Knowledge"]
  node_repo_ingest["Repository Ingestion<br/>[ingest.py]"]
  node_chunker["AST Chunking<br/>[chunker.py]"]
  node_retriever["Hybrid Retrieval<br/>[retriever.py]"]
  node_import_graph["Import Expansion<br/>[import_graph.py]"]
  node_vector_store[("Vector Store<br/>[vector_store.py]")]
  node_registry[("Repository Registry<br/>[registry.py]")]
end

subgraph group_agent["Agent Workflows"]
  node_runtime["QA Agent Loop<br/>[runtime.py]"]
  node_tools["Code Tools<br/>[tools.py]"]
  node_repair["Repair Loop<br/>[repair.py]"]
  node_patcher["Patch Workspace<br/>[patcher.py]"]
  node_sandbox["Test Sandbox<br/>[runner.py]"]
  node_reviewer["Code Reviewer<br/>[reviewer.py]"]
end

subgraph group_models["Model Providers"]
  node_llm_client["Provider Interface<br/>[client.py]"]
  node_gemini["Gemini Provider<br/>[gemini.py]"]
  node_ollama["Ollama Provider<br/>[ollama.py]"]
end

subgraph group_operations["Operations and Evaluation"]
  node_mcp["MCP Server<br/>[server.py]"]
  node_tracing["Lifecycle Tracing<br/>[tracing.py]"]
  node_trace_api["Trace API<br/>[routes_traces.py]"]
  node_evaluation["Evaluation Harness<br/>[harness.py]"]
end

node_user(("Engineer"))

node_user -->|"uses"| node_ui
node_ui -->|"sends requests"| node_http_api
node_http_api -->|"routes requests"| node_repo_routes
node_http_api -->|"routes requests"| node_agent_routes
node_http_api -->|"routes requests"| node_review_routes
node_http_api -->|"routes requests"| node_auth
node_repo_routes -->|"ingests source"| node_repo_ingest
node_repo_routes -->|"registers repository"| node_registry
node_repo_routes -->|"persists ownership"| node_persistent_store
node_repo_ingest -->|"chunks source"| node_chunker
node_repo_ingest -->|"embeds chunks"| node_llm_client
node_repo_ingest -->|"stores vectors"| node_vector_store
node_agent_routes -->|"runs questions"| node_runtime
node_agent_routes -->|"starts repair"| node_repair
node_runtime -->|"dispatches tools"| node_tools
node_tools -->|"searches code"| node_retriever
node_retriever -->|"embeds query"| node_llm_client
node_retriever -->|"searches vectors"| node_vector_store
node_retriever -->|"expands dependencies"| node_import_graph
node_retriever -->|"looks up repository"| node_registry
node_repair -->|"generates patches"| node_llm_client
node_repair -->|"applies patches"| node_patcher
node_repair -->|"runs tests"| node_sandbox
node_repair -->|"uses agent runtime"| node_runtime
node_review_routes -->|"requests review"| node_reviewer
node_reviewer -->|"generates findings"| node_llm_client
node_llm_client -->|"selects provider"| node_gemini
node_llm_client -->|"selects provider"| node_ollama
node_runtime -->|"records execution"| node_tracing
node_repair -->|"records execution"| node_tracing
node_mcp -->|"exposes tools"| node_tools
node_mcp -->|"exposes patching"| node_patcher
node_mcp -->|"exposes testing"| node_sandbox
node_trace_api -->|"reads trace data"| node_tracing
node_evaluation -->|"prepares repositories"| node_repo_ingest
node_evaluation -->|"measures retrieval"| node_retriever
node_evaluation -->|"measures repair"| node_repair

click node_ui "https://github.com/kuruva-radhakrishna/devpilot/blob/main/frontend/src/App.tsx"
click node_http_api "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/main.py"
click node_auth "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/auth/routes_auth.py"
click node_repo_routes "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/api/routes_repo.py"
click node_agent_routes "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/api/routes_agent.py"
click node_review_routes "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/api/routes_review.py"
click node_repo_ingest "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/rag/ingest.py"
click node_chunker "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/rag/chunker.py"
click node_retriever "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/rag/retriever.py"
click node_import_graph "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/rag/import_graph.py"
click node_vector_store "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/rag/vector_store.py"
click node_registry "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/registry.py"
click node_runtime "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/agent/runtime.py"
click node_tools "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/agent/tools.py"
click node_repair "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/agent/repair.py"
click node_patcher "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/patch/patcher.py"
click node_sandbox "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/sandbox/runner.py"
click node_reviewer "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/review/reviewer.py"
click node_llm_client "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/llm/client.py"
click node_gemini "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/llm/providers/gemini.py"
click node_ollama "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/llm/providers/ollama.py"
click node_mcp "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/mcp_server/server.py"
click node_tracing "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/obs/tracing.py"
click node_trace_api "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/api/routes_traces.py"
click node_evaluation "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/eval/harness.py"
click node_persistent_store "https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/db/store.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_ui,node_http_api,node_auth,node_repo_routes,node_agent_routes,node_review_routes,node_persistent_store toneBlue
class node_repo_ingest,node_chunker,node_retriever,node_import_graph,node_vector_store,node_registry toneAmber
class node_runtime,node_tools,node_repair,node_patcher,node_sandbox,node_reviewer toneMint
class node_llm_client,node_gemini,node_ollama toneRose
class node_mcp,node_tracing,node_trace_api,node_evaluation,node_user toneIndigo
```

## Components

### Client and API

- [Web UI](https://github.com/kuruva-radhakrishna/devpilot/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [HTTP API](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/auth/routes_auth.py): `backend/app/auth/routes_auth.py`
- [Repository API](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/api/routes_repo.py): `backend/app/api/routes_repo.py`
- [Agent API](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/api/routes_agent.py): `backend/app/api/routes_agent.py`
- [Review API](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/api/routes_review.py): `backend/app/api/routes_review.py`
- [User Repository Store](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/db/store.py): `backend/app/db/store.py`

### Repository Knowledge

- [Repository Ingestion](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/rag/ingest.py): `backend/app/rag/ingest.py`
- [AST Chunking](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/rag/chunker.py): `backend/app/rag/chunker.py`
- [Hybrid Retrieval](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/rag/retriever.py): `backend/app/rag/retriever.py`
- [Import Expansion](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/rag/import_graph.py): `backend/app/rag/import_graph.py`
- [Vector Store](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/rag/vector_store.py): `backend/app/rag/vector_store.py`
- [Repository Registry](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/registry.py): `backend/app/registry.py`

### Agent Workflows

- [QA Agent Loop](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/agent/runtime.py): `backend/app/agent/runtime.py`
- [Code Tools](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/agent/tools.py): `backend/app/agent/tools.py`
- [Repair Loop](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/agent/repair.py): `backend/app/agent/repair.py`
- [Patch Workspace](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/patch/patcher.py): `backend/app/patch/patcher.py`
- [Test Sandbox](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/sandbox/runner.py): `backend/app/sandbox/runner.py`
- [Code Reviewer](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/review/reviewer.py): `backend/app/review/reviewer.py`

### Model Providers

- [Provider Interface](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/llm/client.py): `backend/app/llm/client.py`
- [Gemini Provider](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/llm/providers/gemini.py): `backend/app/llm/providers/gemini.py`
- [Ollama Provider](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/llm/providers/ollama.py): `backend/app/llm/providers/ollama.py`

### Operations and Evaluation

- [MCP Server](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/mcp_server/server.py): `backend/mcp_server/server.py`
- [Lifecycle Tracing](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/obs/tracing.py): `backend/app/obs/tracing.py`
- [Trace API](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/app/api/routes_traces.py): `backend/app/api/routes_traces.py`
- [Evaluation Harness](https://github.com/kuruva-radhakrishna/devpilot/blob/main/backend/eval/harness.py): `backend/eval/harness.py`

### Other components

- **Engineer**

## Connections

- Engineer → Web UI: uses
- Web UI → HTTP API: sends requests
- HTTP API → Repository API: routes requests (evidence: `backend/app/main.py`)
- HTTP API → Agent API: routes requests (evidence: `backend/app/main.py`)
- HTTP API → Review API: routes requests (evidence: `backend/app/main.py`)
- HTTP API → Authentication: routes requests (evidence: `backend/app/main.py`)
- Repository API → Repository Ingestion: ingests source (evidence: `backend/app/api/routes_repo.py`)
- Repository API → Repository Registry: registers repository (evidence: `backend/app/api/routes_repo.py`)
- Repository API → User Repository Store: persists ownership (evidence: `backend/app/api/routes_repo.py`)
- Repository Ingestion → AST Chunking: chunks source (evidence: `backend/app/rag/ingest.py`)
- Repository Ingestion → Provider Interface: embeds chunks (evidence: `backend/app/rag/ingest.py`)
- Repository Ingestion → Vector Store: stores vectors (evidence: `backend/app/rag/ingest.py`)
- Agent API → QA Agent Loop: runs questions (evidence: `backend/app/api/routes_agent.py`)
- Agent API → Repair Loop: starts repair (evidence: `backend/app/api/routes_agent.py`)
- QA Agent Loop → Code Tools: dispatches tools (evidence: `backend/app/agent/runtime.py`)
- Code Tools → Hybrid Retrieval: searches code (evidence: `backend/app/agent/tools.py`)
- Hybrid Retrieval → Provider Interface: embeds query (evidence: `backend/app/rag/retriever.py`)
- Hybrid Retrieval → Vector Store: searches vectors (evidence: `backend/app/rag/retriever.py`)
- Hybrid Retrieval → Import Expansion: expands dependencies (evidence: `backend/app/rag/retriever.py`)
- Hybrid Retrieval → Repository Registry: looks up repository (evidence: `backend/app/rag/retriever.py`)
- Repair Loop → Provider Interface: generates patches (evidence: `backend/app/agent/repair.py`)
- Repair Loop → Patch Workspace: applies patches (evidence: `backend/app/agent/repair.py`)
- Repair Loop → Test Sandbox: runs tests (evidence: `backend/app/agent/repair.py`)
- Repair Loop → QA Agent Loop: uses agent runtime (evidence: `backend/app/agent/repair.py`)
- Review API → Code Reviewer: requests review (evidence: `backend/app/api/routes_review.py`)
- Code Reviewer → Provider Interface: generates findings (evidence: `backend/app/review/reviewer.py`)
- Provider Interface → Gemini Provider: selects provider (evidence: `backend/app/llm/client.py`)
- Provider Interface → Ollama Provider: selects provider (evidence: `backend/app/llm/client.py`)
- QA Agent Loop → Lifecycle Tracing: records execution (evidence: `backend/app/agent/runtime.py`)
- Repair Loop → Lifecycle Tracing: records execution (evidence: `backend/app/agent/repair.py`)
- MCP Server → Code Tools: exposes tools (evidence: `backend/mcp_server/server.py`)
- MCP Server → Patch Workspace: exposes patching (evidence: `backend/mcp_server/server.py`)
- MCP Server → Test Sandbox: exposes testing (evidence: `backend/mcp_server/server.py`)
- Trace API → Lifecycle Tracing: reads trace data (evidence: `backend/app/api/routes_traces.py`)
- Evaluation Harness → Repository Ingestion: prepares repositories (evidence: `backend/eval/harness.py`)
- Evaluation Harness → Hybrid Retrieval: measures retrieval (evidence: `backend/eval/harness.py`)
- Evaluation Harness → Repair Loop: measures repair (evidence: `backend/eval/harness.py`)
