# kiran4ukir/incident-memory-agent architecture

> Architecture diagram of the GitHub repository kiran4ukir/incident-memory-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kiran4ukir/incident-memory-agent
- Repository: https://github.com/kiran4ukir/incident-memory-agent

## Overview

Incident Memory Agent is a Flask-based SRE triage app. An on-call engineer submits an alert through the UI; the API asks the agent for both a baseline answer and a memory-informed answer. The latter recalls similar incidents and reflects on recurring patterns before composing advice with a Groq model. Engineers can teach the system by retaining resolved incidents; a separate seed loader adds historical examples. The README documents these capabilities, but UI interactions and unsampled implementation details are not independently verified here.

Main entry points: [`app.py`](https://github.com/kiran4ukir/incident-memory-agent/blob/main/app.py) (Flask API), [`agent.py`](https://github.com/kiran4ukir/incident-memory-agent/blob/main/agent.py) (Memory triage), [`memory.py`](https://github.com/kiran4ukir/incident-memory-agent/blob/main/memory.py) (Incident retention), [`static/index.html`](https://github.com/kiran4ukir/incident-memory-agent/blob/main/static/index.html) (Incident UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Triage experience"]
  node_ui["Incident UI<br/>[index.html]"]
  node_api["Flask API<br/>[app.py]"]
  node_resolve["Resolution intake<br/>[app.py]"]
end

subgraph group_reasoning["Agent reasoning"]
  node_triage["Triage orchestrator<br/>[agent.py]"]
  node_baseline["Baseline triage<br/>[agent.py]"]
  node_memory_triage["Memory triage<br/>[agent.py]"]
  node_model_call["LLM request<br/>[agent.py]"]
end

subgraph group_memory["Incident memory"]
  node_bank_setup["Memory bank setup<br/>[memory.py]"]
  node_incident_text["Incident narrative<br/>[memory.py]"]
  node_recall["Similar incident recall<br/>[memory.py]"]
  node_reflect["Pattern reflection<br/>[memory.py]"]
  node_retain["Incident retention<br/>[memory.py]"]
end

subgraph group_history["Incident history"]
  node_demo_alert["Demo alert<br/>[seed_data.py]"]
  node_seed_loader["History loader<br/>[seed.py]"]
  node_incidents["Synthetic incidents<br/>[seed_data.py]"]
end

node_engineer(("On-call engineer"))
node_groq["Groq model API"]
node_hindsight["Hindsight service"]

node_engineer -->|"uses"| node_ui
node_ui -->|"submits alerts"| node_api
node_api -->|"serves demo"| node_demo_alert
node_api -->|"calls triage"| node_triage
node_triage -->|"runs in parallel"| node_baseline
node_triage -->|"runs in parallel"| node_memory_triage
node_baseline -->|"requests answer"| node_model_call
node_memory_triage -->|"requests memories"| node_recall
node_memory_triage -->|"requests insight"| node_reflect
node_memory_triage -->|"requests answer"| node_model_call
node_model_call -->|"sends completion"| node_groq
node_api -->|"ensures bank"| node_bank_setup
node_recall -->|"recalls memories"| node_hindsight
node_reflect -->|"reflects patterns"| node_hindsight
node_bank_setup -->|"creates bank"| node_hindsight
node_engineer -->|"teaches agent"| node_resolve
node_ui -->|"submits resolution"| node_resolve
node_resolve -->|"retains incident"| node_retain
node_retain -->|"formats incident"| node_incident_text
node_retain -->|"stores incident"| node_hindsight
node_seed_loader -->|"loads history"| node_incidents
node_seed_loader -->|"retains each"| node_retain

click node_ui "https://github.com/kiran4ukir/incident-memory-agent/blob/main/static/index.html"
click node_api "https://github.com/kiran4ukir/incident-memory-agent/blob/main/app.py"
click node_demo_alert "https://github.com/kiran4ukir/incident-memory-agent/blob/main/seed_data.py"
click node_triage "https://github.com/kiran4ukir/incident-memory-agent/blob/main/agent.py"
click node_baseline "https://github.com/kiran4ukir/incident-memory-agent/blob/main/agent.py"
click node_memory_triage "https://github.com/kiran4ukir/incident-memory-agent/blob/main/agent.py"
click node_model_call "https://github.com/kiran4ukir/incident-memory-agent/blob/main/agent.py"
click node_bank_setup "https://github.com/kiran4ukir/incident-memory-agent/blob/main/memory.py"
click node_incident_text "https://github.com/kiran4ukir/incident-memory-agent/blob/main/memory.py"
click node_recall "https://github.com/kiran4ukir/incident-memory-agent/blob/main/memory.py"
click node_reflect "https://github.com/kiran4ukir/incident-memory-agent/blob/main/memory.py"
click node_retain "https://github.com/kiran4ukir/incident-memory-agent/blob/main/memory.py"
click node_resolve "https://github.com/kiran4ukir/incident-memory-agent/blob/main/app.py"
click node_seed_loader "https://github.com/kiran4ukir/incident-memory-agent/blob/main/seed.py"
click node_incidents "https://github.com/kiran4ukir/incident-memory-agent/blob/main/seed_data.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_api,node_resolve toneBlue
class node_triage,node_baseline,node_memory_triage,node_model_call toneAmber
class node_bank_setup,node_incident_text,node_recall,node_reflect,node_retain,node_groq toneMint
class node_demo_alert,node_seed_loader,node_incidents toneRose
class node_engineer,node_hindsight toneIndigo
```

## Components

### Triage experience

- [Incident UI](https://github.com/kiran4ukir/incident-memory-agent/blob/main/static/index.html): `static/index.html`
- [Flask API](https://github.com/kiran4ukir/incident-memory-agent/blob/main/app.py): `app.py`
- [Resolution intake](https://github.com/kiran4ukir/incident-memory-agent/blob/main/app.py): `app.py`

### Agent reasoning

- [Triage orchestrator](https://github.com/kiran4ukir/incident-memory-agent/blob/main/agent.py): `agent.py`
- [Baseline triage](https://github.com/kiran4ukir/incident-memory-agent/blob/main/agent.py): `agent.py`
- [Memory triage](https://github.com/kiran4ukir/incident-memory-agent/blob/main/agent.py): `agent.py`
- [LLM request](https://github.com/kiran4ukir/incident-memory-agent/blob/main/agent.py): `agent.py`

### Incident memory

- [Memory bank setup](https://github.com/kiran4ukir/incident-memory-agent/blob/main/memory.py): `memory.py`
- [Incident narrative](https://github.com/kiran4ukir/incident-memory-agent/blob/main/memory.py): `memory.py`
- [Similar incident recall](https://github.com/kiran4ukir/incident-memory-agent/blob/main/memory.py): `memory.py`
- [Pattern reflection](https://github.com/kiran4ukir/incident-memory-agent/blob/main/memory.py): `memory.py`
- [Incident retention](https://github.com/kiran4ukir/incident-memory-agent/blob/main/memory.py): `memory.py`

### Incident history

- [Demo alert](https://github.com/kiran4ukir/incident-memory-agent/blob/main/seed_data.py): `seed_data.py`
- [History loader](https://github.com/kiran4ukir/incident-memory-agent/blob/main/seed.py): `seed.py`
- [Synthetic incidents](https://github.com/kiran4ukir/incident-memory-agent/blob/main/seed_data.py): `seed_data.py`

### Other components

- **On-call engineer**
- **Groq model API**
- **Hindsight service**

## Connections

- On-call engineer → Incident UI: uses (evidence: `README.md`)
- Incident UI → Flask API: submits alerts (evidence: `README.md`)
- Flask API → Demo alert: serves demo (evidence: `app.py`)
- Flask API → Triage orchestrator: calls triage (evidence: `app.py`)
- Triage orchestrator → Baseline triage: runs in parallel (evidence: `agent.py`)
- Triage orchestrator → Memory triage: runs in parallel (evidence: `agent.py`)
- Baseline triage → LLM request: requests answer (evidence: `agent.py`)
- Memory triage → Similar incident recall: requests memories (evidence: `agent.py`)
- Memory triage → Pattern reflection: requests insight (evidence: `agent.py`)
- Memory triage → LLM request: requests answer (evidence: `agent.py`)
- LLM request → Groq model API: sends completion (evidence: `agent.py`)
- Flask API → Memory bank setup: ensures bank (evidence: `app.py`)
- Similar incident recall → Hindsight service: recalls memories (evidence: `memory.py`)
- Pattern reflection → Hindsight service: reflects patterns (evidence: `memory.py`)
- Memory bank setup → Hindsight service: creates bank (evidence: `memory.py`)
- On-call engineer → Resolution intake: teaches agent (evidence: `README.md`)
- Incident UI → Resolution intake: submits resolution (evidence: `README.md`)
- Resolution intake → Incident retention: retains incident (evidence: `app.py`)
- Incident retention → Incident narrative: formats incident (evidence: `memory.py`)
- Incident retention → Hindsight service: stores incident (evidence: `memory.py`)
- History loader → Synthetic incidents: loads history (evidence: `seed.py`)
- History loader → Incident retention: retains each (evidence: `seed.py`)
