# raj-glitch-max/ai-driven-self-healing-cicd architecture

> Architecture diagram of the GitHub repository raj-glitch-max/ai-driven-self-healing-cicd, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/raj-glitch-max/ai-driven-self-healing-cicd
- Repository: https://github.com/raj-glitch-max/ai-driven-self-healing-cicd

## Overview

This is an AI-driven CI failure repair platform. The documented workflow starts when Jenkins triggers the healer: it reads test logs, extracts failure context, asks an LLM for a code fix, then applies the change through Git operations and opens a pull request. A separate Flask service exposes health and example API routes plus Prometheus metrics. Monitoring is a documented capability, but its runtime wiring is not shown in the sampled source; monitoring links are therefore left unasserted. The agent’s control flow is only partially excerpted, so its documented calls are cited to the README.

Main entry points: [`healer/agent.py`](https://github.com/raj-glitch-max/ai-driven-self-healing-cicd/blob/main/healer/agent.py) (Healer agent), [`healer/llm_client.py`](https://github.com/raj-glitch-max/ai-driven-self-healing-cicd/blob/main/healer/llm_client.py) (LLM client), [`healer/git_ops.py`](https://github.com/raj-glitch-max/ai-driven-self-healing-cicd/blob/main/healer/git_ops.py) (Git operations), [`app/main.py`](https://github.com/raj-glitch-max/ai-driven-self-healing-cicd/blob/main/app/main.py) (Flask API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_repair["Healing workflow"]
  node_agent["Healer agent<br/>[agent.py]"]
  node_parser["Failure parser<br/>[log_parser.py]"]
  node_llmclient["LLM client<br/>[llm_client.py]"]
  node_gitops["Git operations<br/>[git_ops.py]"]
  node_config["Healer configuration<br/>[config.py]"]
  node_demo["Healing demo<br/>[demo.py]"]
end

subgraph group_integrations["External services"]
  node_openai{{"OpenAI GPT-4"}}
  node_github{{"GitHub"}}
end

subgraph group_service["Application service"]
  node_flask["Flask API<br/>[main.py]"]
end

subgraph group_observability["Monitoring"]
  node_prometheus[("Prometheus<br/>[prometheus.yml]")]
  node_grafana["Grafana dashboards<br/>[dashboard.yml]"]
end

node_jenkins(("Jenkins CI"))
node_workspace["Build workspace"]
node_user(("API caller"))

node_jenkins -->|"triggers"| node_agent
node_agent -->|"reads logs and code"| node_workspace
node_agent -->|"parses failures"| node_parser
node_agent -->|"requests fixes"| node_llmclient
node_agent -->|"applies fix and opens PR"| node_gitops
node_llmclient -->|"requests analysis"| node_openai
node_gitops -->|"creates pull request"| node_github
node_llmclient -->|"reads settings"| node_config
node_gitops -->|"reads settings"| node_config
node_user -->|"calls routes"| node_flask
node_flask -->|"exposes scrape metrics"| node_prometheus
node_prometheus -.-> node_grafana
node_demo -->|"parses demo logs"| node_parser

click node_jenkins "https://github.com/raj-glitch-max/ai-driven-self-healing-cicd/blob/main/Jenkinsfile"
click node_agent "https://github.com/raj-glitch-max/ai-driven-self-healing-cicd/blob/main/healer/agent.py"
click node_parser "https://github.com/raj-glitch-max/ai-driven-self-healing-cicd/blob/main/healer/log_parser.py"
click node_llmclient "https://github.com/raj-glitch-max/ai-driven-self-healing-cicd/blob/main/healer/llm_client.py"
click node_gitops "https://github.com/raj-glitch-max/ai-driven-self-healing-cicd/blob/main/healer/git_ops.py"
click node_config "https://github.com/raj-glitch-max/ai-driven-self-healing-cicd/blob/main/healer/config.py"
click node_flask "https://github.com/raj-glitch-max/ai-driven-self-healing-cicd/blob/main/app/main.py"
click node_prometheus "https://github.com/raj-glitch-max/ai-driven-self-healing-cicd/blob/main/monitoring/prometheus.yml"
click node_grafana "https://github.com/raj-glitch-max/ai-driven-self-healing-cicd/blob/main/monitoring/grafana/dashboards/dashboard.yml"
click node_demo "https://github.com/raj-glitch-max/ai-driven-self-healing-cicd/blob/main/scripts/demo.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_agent,node_parser,node_llmclient,node_gitops,node_config,node_demo toneBlue
class node_openai,node_github toneAmber
class node_flask,node_user toneMint
class node_prometheus,node_grafana toneRose
class node_jenkins toneTeal
class node_workspace toneIndigo
```

## Components

### Healing workflow

- [Healer agent](https://github.com/raj-glitch-max/ai-driven-self-healing-cicd/blob/main/healer/agent.py): `healer/agent.py`
- [Failure parser](https://github.com/raj-glitch-max/ai-driven-self-healing-cicd/blob/main/healer/log_parser.py): `healer/log_parser.py`
- [LLM client](https://github.com/raj-glitch-max/ai-driven-self-healing-cicd/blob/main/healer/llm_client.py): `healer/llm_client.py`
- [Git operations](https://github.com/raj-glitch-max/ai-driven-self-healing-cicd/blob/main/healer/git_ops.py): `healer/git_ops.py`
- [Healer configuration](https://github.com/raj-glitch-max/ai-driven-self-healing-cicd/blob/main/healer/config.py): `healer/config.py`
- [Healing demo](https://github.com/raj-glitch-max/ai-driven-self-healing-cicd/blob/main/scripts/demo.py): `scripts/demo.py`

### External services

- **OpenAI GPT-4**
- **GitHub**

### Application service

- [Flask API](https://github.com/raj-glitch-max/ai-driven-self-healing-cicd/blob/main/app/main.py): `app/main.py`

### Monitoring

- [Prometheus](https://github.com/raj-glitch-max/ai-driven-self-healing-cicd/blob/main/monitoring/prometheus.yml): `monitoring/prometheus.yml`
- [Grafana dashboards](https://github.com/raj-glitch-max/ai-driven-self-healing-cicd/blob/main/monitoring/grafana/dashboards/dashboard.yml): `monitoring/grafana/dashboards/dashboard.yml`

### Other components

- [Jenkins CI](https://github.com/raj-glitch-max/ai-driven-self-healing-cicd/blob/main/Jenkinsfile): `Jenkinsfile`
- **Build workspace**
- **API caller**

## Connections

- Jenkins CI → Healer agent: triggers (evidence: `README.md`)
- Healer agent → Build workspace: reads logs and code (evidence: `healer/agent.py`)
- Healer agent → Failure parser: parses failures (evidence: `healer/agent.py`)
- Healer agent → LLM client: requests fixes (evidence: `healer/agent.py`)
- Healer agent → Git operations: applies fix and opens PR (evidence: `healer/agent.py`)
- LLM client → OpenAI GPT-4: requests analysis (evidence: `healer/llm_client.py`)
- Git operations → GitHub: creates pull request (evidence: `healer/git_ops.py`)
- LLM client → Healer configuration: reads settings (evidence: `healer/llm_client.py`)
- Git operations → Healer configuration: reads settings (evidence: `healer/git_ops.py`)
- API caller → Flask API: calls routes (evidence: `app/main.py`)
- Flask API → Prometheus: exposes scrape metrics (evidence: `app/main.py`)
- Prometheus → Grafana dashboards
- Healing demo → Failure parser: parses demo logs (evidence: `scripts/demo.py`)
