# jaga0001/repo_pilot architecture

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

- Interactive diagram: https://gitdiagram.com/jaga0001/repo_pilot
- Repository: https://github.com/jaga0001/repo_pilot

## Overview

RepoPilot receives GitHub CI events, checks workflow outcomes, gathers failure logs and repository context, generates a repair, then commits it and opens a pull request. It also searches and records prior fixes in Elasticsearch. The webhook excerpt directly shows orchestration calls into GitHub, Elasticsearch, and the CrewAI crew; the README documents the broader repair sequence and configurable agents. `main.py`, Elasticsearch internals, and authentication internals were not excerpted, so their internal wiring is not inferred.

Main entry points: [`routes/webhook.py`](https://github.com/jaga0001/repo_pilot/blob/main/routes/webhook.py) (Failure pipeline), [`crew/crew.py`](https://github.com/jaga0001/repo_pilot/blob/main/crew/crew.py) (Repair crew), [`services/github_service.py`](https://github.com/jaga0001/repo_pilot/blob/main/services/github_service.py) (GitHub service), [`services/es_service.py`](https://github.com/jaga0001/repo_pilot/blob/main/services/es_service.py) (Fix search and storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Event handling"]
  node_app["FastAPI app<br/>[main.py]"]
  node_webhook["Webhook handler<br/>[webhook.py]"]
  node_pipeline["Failure pipeline<br/>[webhook.py]"]
end

subgraph group_github["GitHub operations"]
  node_github_service["GitHub service<br/>[github_service.py]"]
  node_github_auth["App authentication<br/>[github_auth.py]"]
end

subgraph group_repair["AI repair"]
  node_crew["Repair crew<br/>[crew.py]"]
  node_agent_config["Agent definitions<br/>[agents.yaml]"]
  node_task_config["Task definitions<br/>[tasks.yaml]"]
end

subgraph group_memory["Fix memory"]
  node_es_service["Fix search and storage<br/>[es_service.py]"]
end

node_github_actor(("GitHub events"))
node_github_api["GitHub API"]
node_gemini["Gemini model"]
node_elasticsearch[("Elasticsearch")]

node_github_actor -->|"sends events"| node_webhook
node_app -.->|"serves endpoint"| node_webhook
node_webhook -->|"schedules"| node_pipeline
node_pipeline -->|"checks and gathers"| node_github_service
node_pipeline -->|"searches fixes"| node_es_service
node_pipeline -->|"submits context"| node_crew
node_pipeline -->|"commits and opens PR"| node_github_service
node_pipeline -->|"stores fix"| node_es_service
node_github_service -->|"gets installation token"| node_github_auth
node_github_service -->|"calls"| node_github_api
node_github_auth -.->|"authenticates"| node_github_api
node_crew -->|"uses configuration"| node_agent_config
node_crew -->|"uses configuration"| node_task_config
node_crew -.->|"uses model"| node_gemini
node_es_service -->|"queries and stores"| node_elasticsearch

click node_app "https://github.com/jaga0001/repo_pilot/blob/main/main.py"
click node_webhook "https://github.com/jaga0001/repo_pilot/blob/main/routes/webhook.py"
click node_pipeline "https://github.com/jaga0001/repo_pilot/blob/main/routes/webhook.py"
click node_github_service "https://github.com/jaga0001/repo_pilot/blob/main/services/github_service.py"
click node_github_auth "https://github.com/jaga0001/repo_pilot/blob/main/services/github_auth.py"
click node_crew "https://github.com/jaga0001/repo_pilot/blob/main/crew/crew.py"
click node_agent_config "https://github.com/jaga0001/repo_pilot/blob/main/crew/config/agents.yaml"
click node_task_config "https://github.com/jaga0001/repo_pilot/blob/main/crew/config/tasks.yaml"
click node_es_service "https://github.com/jaga0001/repo_pilot/blob/main/services/es_service.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_app,node_webhook,node_pipeline toneBlue
class node_github_service,node_github_auth,node_elasticsearch toneAmber
class node_crew,node_agent_config,node_task_config,node_github_api toneMint
class node_es_service toneRose
class node_github_actor,node_gemini toneIndigo
```

## Components

### Event handling

- [FastAPI app](https://github.com/jaga0001/repo_pilot/blob/main/main.py): `main.py`
- [Webhook handler](https://github.com/jaga0001/repo_pilot/blob/main/routes/webhook.py): `routes/webhook.py`
- [Failure pipeline](https://github.com/jaga0001/repo_pilot/blob/main/routes/webhook.py): `routes/webhook.py`

### GitHub operations

- [GitHub service](https://github.com/jaga0001/repo_pilot/blob/main/services/github_service.py): `services/github_service.py`
- [App authentication](https://github.com/jaga0001/repo_pilot/blob/main/services/github_auth.py): `services/github_auth.py`

### AI repair

- [Repair crew](https://github.com/jaga0001/repo_pilot/blob/main/crew/crew.py): `crew/crew.py`
- [Agent definitions](https://github.com/jaga0001/repo_pilot/blob/main/crew/config/agents.yaml): `crew/config/agents.yaml`
- [Task definitions](https://github.com/jaga0001/repo_pilot/blob/main/crew/config/tasks.yaml): `crew/config/tasks.yaml`

### Fix memory

- [Fix search and storage](https://github.com/jaga0001/repo_pilot/blob/main/services/es_service.py): `services/es_service.py`

### Other components

- **GitHub events**
- **GitHub API**
- **Gemini model**
- **Elasticsearch**

## Connections

- GitHub events → Webhook handler: sends events (evidence: `README.md`)
- FastAPI app → Webhook handler: serves endpoint
- Webhook handler → Failure pipeline: schedules (evidence: `routes/webhook.py`)
- Failure pipeline → GitHub service: checks and gathers (evidence: `routes/webhook.py`)
- Failure pipeline → Fix search and storage: searches fixes (evidence: `routes/webhook.py`)
- Failure pipeline → Repair crew: submits context (evidence: `routes/webhook.py`)
- Failure pipeline → GitHub service: commits and opens PR (evidence: `README.md`)
- Failure pipeline → Fix search and storage: stores fix (evidence: `routes/webhook.py`)
- GitHub service → App authentication: gets installation token (evidence: `services/github_service.py`)
- GitHub service → GitHub API: calls (evidence: `README.md`)
- App authentication → GitHub API: authenticates
- Repair crew → Agent definitions: uses configuration (evidence: `README.md`)
- Repair crew → Task definitions: uses configuration (evidence: `README.md`)
- Repair crew → Gemini model: uses model
- Fix search and storage → Elasticsearch: queries and stores (evidence: `README.md`)
