# rosi87g/aicodeguard architecture

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

- Interactive diagram: https://gitdiagram.com/rosi87g/aicodeguard
- Repository: https://github.com/rosi87g/aicodeguard

## Overview

AI CodeGuard connects public bug reporting, HR triage, and developer incident resolution through a Spring API and a FastAPI multi-agent engine. The main workflow runs from ticket submission and assignment to repository investigation, evidence-checked fixes, regression-test generation, developer approval, isolated validation, and Git commit or PR. The graph preserves the documented portals and operational capabilities; several implementation details are unsampled, so their links are documented from the README rather than inferred from module names.

Main entry points: [`agent-service/main.py`](https://github.com/rosi87g/aicodeguard/blob/main/agent-service/main.py) (Agent Service), [`agent-service/agents/orchestrator.py`](https://github.com/rosi87g/aicodeguard/blob/main/agent-service/agents/orchestrator.py) (Agent Orchestrator), [`backend/codeguard-api/src/main/java/com/codeguard/CodeGuardApplication.java`](https://github.com/rosi87g/aicodeguard/blob/main/backend/codeguard-api/src/main/java/com/codeguard/CodeGuardApplication.java) (Spring API), [`backend/codeguard-api/src/main/java/com/codeguard/service/TicketService.java`](https://github.com/rosi87g/aicodeguard/blob/main/backend/codeguard-api/src/main/java/com/codeguard/service/TicketService.java) (Ticket Workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portals["User Portals"]
  node_ticket_ui["Ticket Portal<br/>[App.jsx]"]
  node_hr_ui["HR Portal<br/>[App.jsx]"]
  node_dev_ui["Developer Workspace<br/>[App.jsx]"]
end

subgraph group_api["Core API"]
  node_api["Spring API"]
  node_ticket_service["Ticket Workflow<br/>[TicketService.java]"]
  node_incident_controller["Incident Control"]
  node_incident_service["Incident State"]
  node_project_explorer["Project Explorer"]
  node_records[("Operational Records<br/>[Incident.java]")]
  node_agent_client["Agent API Client"]
end

subgraph group_engine["AI Resolution Engine"]
  node_agent_api["Agent Service<br/>[main.py]"]
  node_orchestrator["Agent Orchestrator<br/>[orchestrator.py]"]
  node_investigator["Code Investigation"]
  node_fix_agent["Patch Verification<br/>[fix_agent.py]"]
  node_test_agent["Regression Tests"]
  node_validation["Test Validation"]
end

subgraph group_delivery["Approval and Delivery"]
  node_approval["Approval Service"]
  node_patch["Patch Application<br/>[patch_service.py]"]
  node_git["Git Delivery<br/>[git_service.py]"]
end

node_reporter(("Client or QA"))
node_developer(("Developer"))
node_git_remote(("Git Host"))

node_reporter -->|"reports bug"| node_ticket_ui
node_ticket_ui -.->|"submits ticket"| node_api
node_hr_ui -.->|"triages tickets"| node_api
node_dev_ui -.->|"manages incidents"| node_api
node_api -.->|"routes tickets"| node_ticket_service
node_ticket_service -->|"persists ticket"| node_records
node_ticket_service -->|"creates incident"| node_incident_service
node_incident_controller -->|"updates state"| node_incident_service
node_incident_service -->|"persists incident"| node_records
node_dev_ui -.->|"browses repository"| node_project_explorer
node_incident_controller -->|"requests investigation"| node_agent_client
node_agent_client -.->|"calls service"| node_agent_api
node_agent_api -->|"starts workflow"| node_orchestrator
node_orchestrator -->|"investigates code"| node_investigator
node_orchestrator -->|"checks patch"| node_fix_agent
node_orchestrator -->|"generates tests"| node_test_agent
node_orchestrator -->|"validates changes"| node_validation
node_developer -.->|"reviews patch"| node_dev_ui
node_agent_api -.->|"requests approval"| node_approval
node_agent_api -->|"applies approved patch"| node_patch
node_agent_api -->|"commits or pushes"| node_git
node_git -.->|"opens pull request"| node_git_remote

click node_ticket_ui "https://github.com/rosi87g/aicodeguard/blob/main/ticket-portal/src/App.jsx"
click node_hr_ui "https://github.com/rosi87g/aicodeguard/blob/main/hr-portal/src/App.jsx"
click node_dev_ui "https://github.com/rosi87g/aicodeguard/blob/main/frontend/src/App.jsx"
click node_api "https://github.com/rosi87g/aicodeguard/blob/main/backend/codeguard-api/src/main/java/com/codeguard/CodeGuardApplication.java"
click node_ticket_service "https://github.com/rosi87g/aicodeguard/blob/main/backend/codeguard-api/src/main/java/com/codeguard/service/TicketService.java"
click node_incident_controller "https://github.com/rosi87g/aicodeguard/blob/main/backend/codeguard-api/src/main/java/com/codeguard/controller/IncidentController.java"
click node_incident_service "https://github.com/rosi87g/aicodeguard/blob/main/backend/codeguard-api/src/main/java/com/codeguard/service/IncidentService.java"
click node_project_explorer "https://github.com/rosi87g/aicodeguard/blob/main/backend/codeguard-api/src/main/java/com/codeguard/service/ProjectExplorerService.java"
click node_records "https://github.com/rosi87g/aicodeguard/blob/main/backend/codeguard-api/src/main/java/com/codeguard/model/Incident.java"
click node_agent_client "https://github.com/rosi87g/aicodeguard/blob/main/backend/codeguard-api/src/main/java/com/codeguard/client/AgentServiceClient.java"
click node_agent_api "https://github.com/rosi87g/aicodeguard/blob/main/agent-service/main.py"
click node_orchestrator "https://github.com/rosi87g/aicodeguard/blob/main/agent-service/agents/orchestrator.py"
click node_investigator "https://github.com/rosi87g/aicodeguard/blob/main/agent-service/agents/investigator_agent.py"
click node_fix_agent "https://github.com/rosi87g/aicodeguard/blob/main/agent-service/agents/fix_agent.py"
click node_test_agent "https://github.com/rosi87g/aicodeguard/tree/main/agent-service/agents"
click node_validation "https://github.com/rosi87g/aicodeguard/blob/main/agent-service/agents/validation_agent.py"
click node_approval "https://github.com/rosi87g/aicodeguard/blob/main/agent-service/approval_service.py"
click node_patch "https://github.com/rosi87g/aicodeguard/blob/main/agent-service/patch_service.py"
click node_git "https://github.com/rosi87g/aicodeguard/blob/main/agent-service/git_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_ticket_ui,node_hr_ui,node_dev_ui,node_reporter toneBlue
class node_api,node_ticket_service,node_incident_controller,node_incident_service,node_project_explorer,node_records,node_agent_client toneAmber
class node_agent_api,node_orchestrator,node_investigator,node_fix_agent,node_test_agent,node_validation toneMint
class node_approval,node_patch,node_git toneRose
class node_developer,node_git_remote toneIndigo
```

## Components

### User Portals

- [Ticket Portal](https://github.com/rosi87g/aicodeguard/blob/main/ticket-portal/src/App.jsx): `ticket-portal/src/App.jsx`
- [HR Portal](https://github.com/rosi87g/aicodeguard/blob/main/hr-portal/src/App.jsx): `hr-portal/src/App.jsx`
- [Developer Workspace](https://github.com/rosi87g/aicodeguard/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`

### Core API

- [Spring API](https://github.com/rosi87g/aicodeguard/blob/main/backend/codeguard-api/src/main/java/com/codeguard/CodeGuardApplication.java): `backend/codeguard-api/src/main/java/com/codeguard/CodeGuardApplication.java`
- [Ticket Workflow](https://github.com/rosi87g/aicodeguard/blob/main/backend/codeguard-api/src/main/java/com/codeguard/service/TicketService.java): `backend/codeguard-api/src/main/java/com/codeguard/service/TicketService.java`
- [Incident Control](https://github.com/rosi87g/aicodeguard/blob/main/backend/codeguard-api/src/main/java/com/codeguard/controller/IncidentController.java): `backend/codeguard-api/src/main/java/com/codeguard/controller/IncidentController.java`
- [Incident State](https://github.com/rosi87g/aicodeguard/blob/main/backend/codeguard-api/src/main/java/com/codeguard/service/IncidentService.java): `backend/codeguard-api/src/main/java/com/codeguard/service/IncidentService.java`
- [Project Explorer](https://github.com/rosi87g/aicodeguard/blob/main/backend/codeguard-api/src/main/java/com/codeguard/service/ProjectExplorerService.java): `backend/codeguard-api/src/main/java/com/codeguard/service/ProjectExplorerService.java`
- [Operational Records](https://github.com/rosi87g/aicodeguard/blob/main/backend/codeguard-api/src/main/java/com/codeguard/model/Incident.java): `backend/codeguard-api/src/main/java/com/codeguard/model/Incident.java`
- [Agent API Client](https://github.com/rosi87g/aicodeguard/blob/main/backend/codeguard-api/src/main/java/com/codeguard/client/AgentServiceClient.java): `backend/codeguard-api/src/main/java/com/codeguard/client/AgentServiceClient.java`

### AI Resolution Engine

- [Agent Service](https://github.com/rosi87g/aicodeguard/blob/main/agent-service/main.py): `agent-service/main.py`
- [Agent Orchestrator](https://github.com/rosi87g/aicodeguard/blob/main/agent-service/agents/orchestrator.py): `agent-service/agents/orchestrator.py`
- [Code Investigation](https://github.com/rosi87g/aicodeguard/blob/main/agent-service/agents/investigator_agent.py): `agent-service/agents/investigator_agent.py`
- [Patch Verification](https://github.com/rosi87g/aicodeguard/blob/main/agent-service/agents/fix_agent.py): `agent-service/agents/fix_agent.py`
- [Regression Tests](https://github.com/rosi87g/aicodeguard/tree/main/agent-service/agents): `agent-service/agents`
- [Test Validation](https://github.com/rosi87g/aicodeguard/blob/main/agent-service/agents/validation_agent.py): `agent-service/agents/validation_agent.py`

### Approval and Delivery

- [Approval Service](https://github.com/rosi87g/aicodeguard/blob/main/agent-service/approval_service.py): `agent-service/approval_service.py`
- [Patch Application](https://github.com/rosi87g/aicodeguard/blob/main/agent-service/patch_service.py): `agent-service/patch_service.py`
- [Git Delivery](https://github.com/rosi87g/aicodeguard/blob/main/agent-service/git_service.py): `agent-service/git_service.py`

### Other components

- **Client or QA**
- **Developer**
- **Git Host**

## Connections

- Client or QA → Ticket Portal: reports bug (evidence: `README.md`)
- Ticket Portal → Spring API: submits ticket (evidence: `README.md`)
- HR Portal → Spring API: triages tickets (evidence: `README.md`)
- Developer Workspace → Spring API: manages incidents (evidence: `README.md`)
- Spring API → Ticket Workflow: routes tickets (evidence: `README.md`)
- Ticket Workflow → Operational Records: persists ticket (evidence: `backend/codeguard-api/src/main/java/com/codeguard/service/TicketService.java`)
- Ticket Workflow → Incident State: creates incident (evidence: `backend/codeguard-api/src/main/java/com/codeguard/service/TicketService.java`)
- Incident Control → Incident State: updates state (evidence: `backend/codeguard-api/src/main/java/com/codeguard/controller/IncidentController.java`)
- Incident State → Operational Records: persists incident (evidence: `backend/codeguard-api/src/main/java/com/codeguard/service/IncidentService.java`)
- Developer Workspace → Project Explorer: browses repository (evidence: `README.md`)
- Incident Control → Agent API Client: requests investigation (evidence: `backend/codeguard-api/src/main/java/com/codeguard/controller/IncidentController.java`)
- Agent API Client → Agent Service: calls service (evidence: `README.md`)
- Agent Service → Agent Orchestrator: starts workflow (evidence: `agent-service/main.py`)
- Agent Orchestrator → Code Investigation: investigates code (evidence: `agent-service/agents/orchestrator.py`)
- Agent Orchestrator → Patch Verification: checks patch (evidence: `agent-service/agents/orchestrator.py`)
- Agent Orchestrator → Regression Tests: generates tests (evidence: `agent-service/agents/orchestrator.py`)
- Agent Orchestrator → Test Validation: validates changes (evidence: `agent-service/agents/orchestrator.py`)
- Developer → Developer Workspace: reviews patch (evidence: `README.md`)
- Agent Service → Approval Service: requests approval (evidence: `README.md`)
- Agent Service → Patch Application: applies approved patch (evidence: `agent-service/main.py`)
- Agent Service → Git Delivery: commits or pushes (evidence: `agent-service/main.py`)
- Git Delivery → Git Host: opens pull request (evidence: `README.md`)
