# eternal-drift/ai-incident-commander architecture

> Architecture diagram of the GitHub repository eternal-drift/ai-incident-commander, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/eternal-drift/ai-incident-commander
- Repository: https://github.com/eternal-drift/ai-incident-commander

## Overview

AI Incident Commander is a human-in-the-loop incident-response workspace: an operator submits a report and optional image/audio evidence, receives an evidence-grounded plan with facts, unknowns, hypotheses and proposed actions, then reviews and decides on each action. The backend extracts image and audio descriptions, generates and verifies plans, and persists incidents and audit entries. The graph follows relationships visible in the excerpts or stated in the README; the frontend-to-backend API link is dashed because its HTTP implementation was not excerpted.

Main entry points: [`backend/Controllers/IncidentsController.cs`](https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Controllers/IncidentsController.cs) (Incident API), [`backend/Data/AppDbContext.cs`](https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Data/AppDbContext.cs) (Database context), [`frontend/src/App.tsx`](https://github.com/eternal-drift/ai-incident-commander/blob/main/frontend/src/App.tsx) (Command board), [`frontend/src/api.ts`](https://github.com/eternal-drift/ai-incident-commander/blob/main/frontend/src/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Operator workspace"]
  node_app["Command board<br/>[App.tsx]"]
  node_webapi["API client<br/>[api.ts]"]
end

subgraph group_workflow["Incident workflow"]
  node_controller["Incident API"]
  node_incident["Incident record<br/>[Incident.cs]"]
end

subgraph group_analysis["Evidence and analysis"]
  node_evidence["Evidence item<br/>[EvidenceItem.cs]"]
  node_storage["Evidence storage<br/>[EvidenceStorage.cs]"]
  node_plan["Incident plan<br/>[IncidentPlan.cs]"]
  node_verifier["Plan verifier"]
end

subgraph group_records["Persistence and audit"]
  node_dbcontext["Database context<br/>[AppDbContext.cs]"]
  node_auditlogger["Audit logger<br/>[AuditLogger.cs]"]
  node_auditentry["Audit entry<br/>[AuditEntry.cs]"]
end

subgraph group_integrations["Model integrations"]
  node_vision["Image description"]
  node_voice["Audio transcription<br/>[MetaVoiceClient.cs]"]
  node_planclient["Plan generation<br/>[MetaModelClient.cs]"]
end

node_operator(("Operator"))
node_metamodel["Meta Model API"]

node_operator -->|"submits report"| node_app
node_app -->|"calls"| node_webapi
node_webapi -.->|"sends requests"| node_controller
node_controller -->|"reads and writes"| node_dbcontext
node_controller -->|"saves uploads"| node_storage
node_controller -->|"requests descriptions"| node_vision
node_controller -->|"requests transcripts"| node_voice
node_controller -->|"generates plan"| node_planclient
node_controller -->|"verifies plan"| node_verifier
node_controller -->|"records events"| node_auditlogger
node_controller -->|"creates and reads"| node_incident
node_controller -->|"builds evidence"| node_evidence
node_controller -->|"stores decisions"| node_plan
node_planclient -->|"requests plan"| node_metamodel
node_vision -.->|"uses vision model"| node_metamodel
node_voice -.->|"uses transcription"| node_metamodel
node_dbcontext -->|"maps records"| node_incident
node_dbcontext -->|"maps records"| node_auditentry
node_auditlogger -.->|"appends entries"| node_auditentry

click node_app "https://github.com/eternal-drift/ai-incident-commander/blob/main/frontend/src/App.tsx"
click node_webapi "https://github.com/eternal-drift/ai-incident-commander/blob/main/frontend/src/api.ts"
click node_controller "https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Controllers/IncidentsController.cs"
click node_incident "https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Models/Incident.cs"
click node_evidence "https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Models/EvidenceItem.cs"
click node_storage "https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Services/EvidenceStorage.cs"
click node_vision "https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Services/MetaVisionClient.cs"
click node_voice "https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Services/MetaVoiceClient.cs"
click node_planclient "https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Services/MetaModelClient.cs"
click node_plan "https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Models/IncidentPlan.cs"
click node_verifier "https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Services/IncidentPlanVerifier.cs"
click node_dbcontext "https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Data/AppDbContext.cs"
click node_auditlogger "https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Services/AuditLogger.cs"
click node_auditentry "https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Models/AuditEntry.cs"

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_webapi toneBlue
class node_controller,node_incident toneAmber
class node_evidence,node_storage,node_plan,node_verifier,node_metamodel toneMint
class node_dbcontext,node_auditlogger,node_auditentry toneRose
class node_vision,node_voice,node_planclient,node_operator toneIndigo
```

## Components

### Operator workspace

- [Command board](https://github.com/eternal-drift/ai-incident-commander/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API client](https://github.com/eternal-drift/ai-incident-commander/blob/main/frontend/src/api.ts): `frontend/src/api.ts`

### Incident workflow

- [Incident API](https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Controllers/IncidentsController.cs): `backend/Controllers/IncidentsController.cs`
- [Incident record](https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Models/Incident.cs): `backend/Models/Incident.cs`

### Evidence and analysis

- [Evidence item](https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Models/EvidenceItem.cs): `backend/Models/EvidenceItem.cs`
- [Evidence storage](https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Services/EvidenceStorage.cs): `backend/Services/EvidenceStorage.cs`
- [Incident plan](https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Models/IncidentPlan.cs): `backend/Models/IncidentPlan.cs`
- [Plan verifier](https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Services/IncidentPlanVerifier.cs): `backend/Services/IncidentPlanVerifier.cs`

### Persistence and audit

- [Database context](https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Data/AppDbContext.cs): `backend/Data/AppDbContext.cs`
- [Audit logger](https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Services/AuditLogger.cs): `backend/Services/AuditLogger.cs`
- [Audit entry](https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Models/AuditEntry.cs): `backend/Models/AuditEntry.cs`

### Model integrations

- [Image description](https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Services/MetaVisionClient.cs): `backend/Services/MetaVisionClient.cs`
- [Audio transcription](https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Services/MetaVoiceClient.cs): `backend/Services/MetaVoiceClient.cs`
- [Plan generation](https://github.com/eternal-drift/ai-incident-commander/blob/main/backend/Services/MetaModelClient.cs): `backend/Services/MetaModelClient.cs`

### Other components

- **Operator**
- **Meta Model API**

## Connections

- Operator → Command board: submits report (evidence: `README.md`)
- Command board → API client: calls (evidence: `frontend/src/App.tsx`)
- API client → Incident API: sends requests
- Incident API → Database context: reads and writes (evidence: `backend/Controllers/IncidentsController.cs`)
- Incident API → Evidence storage: saves uploads (evidence: `backend/Controllers/IncidentsController.cs`)
- Incident API → Image description: requests descriptions (evidence: `backend/Controllers/IncidentsController.cs`)
- Incident API → Audio transcription: requests transcripts (evidence: `backend/Controllers/IncidentsController.cs`)
- Incident API → Plan generation: generates plan (evidence: `backend/Controllers/IncidentsController.cs`)
- Incident API → Plan verifier: verifies plan (evidence: `backend/Controllers/IncidentsController.cs`)
- Incident API → Audit logger: records events (evidence: `backend/Controllers/IncidentsController.cs`)
- Incident API → Incident record: creates and reads (evidence: `backend/Controllers/IncidentsController.cs`)
- Incident API → Evidence item: builds evidence (evidence: `backend/Controllers/IncidentsController.cs`)
- Incident API → Incident plan: stores decisions (evidence: `backend/Controllers/IncidentsController.cs`)
- Plan generation → Meta Model API: requests plan (evidence: `backend/Services/MetaModelClient.cs`)
- Image description → Meta Model API: uses vision model (evidence: `README.md`)
- Audio transcription → Meta Model API: uses transcription (evidence: `README.md`)
- Database context → Incident record: maps records (evidence: `backend/Data/AppDbContext.cs`)
- Database context → Audit entry: maps records (evidence: `backend/Data/AppDbContext.cs`)
- Audit logger → Audit entry: appends entries
