# yeeeengyu/incidflow architecture

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

- Interactive diagram: https://gitdiagram.com/yeeeengyu/incidflow
- Repository: https://github.com/yeeeengyu/incidflow

## Overview

IncidentFlow is a LangGraph-based incident-report drafting agent. The principal documented workflow accepts incident logs and context, assembles that input, drafts a report with an LLM, and reviews required sections; failed review loops back to drafting. The README also describes broader investigation, risk analysis, approval, and publishing capabilities, but these are not implemented in the sampled graph. The graph therefore separates the implemented workflow from documented extensions. Source excerpts show the graph wiring and prompt/model calls; unsampled capability links reflect README documentation only.

Main entry points: [`app/graph/node/generate_report.py`](https://github.com/yeeeengyu/incidflow/blob/main/app/graph/node/generate_report.py) (Generate report), [`app/graph/node/collect_context.py`](https://github.com/yeeeengyu/incidflow/blob/main/app/graph/node/collect_context.py) (Collect context), [`app/graph/builder.py`](https://github.com/yeeeengyu/incidflow/blob/main/app/graph/builder.py) (Graph builder), [`app/graph/node/review_report.py`](https://github.com/yeeeengyu/incidflow/blob/main/app/graph/node/review_report.py) (Review report)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Report workflow"]
  node_builder["Graph builder<br/>[builder.py]"]
  node_collect["Collect context<br/>[collect_context.py]"]
  node_draft["Generate report<br/>[generate_report.py]"]
  node_review["Review report<br/>[review_report.py]"]
  node_routes["Review routing<br/>[routes.py]"]
end

subgraph group_prompts["Prompt and state"]
  node_state["Incident state<br/>[state.py]"]
  node_prompt["Prompt templates<br/>[prompt.py]"]
  node_types["Result schemas<br/>[type.py]"]
end

subgraph group_extensions["Documented extensions"]
  node_search["Document and history search"]
  node_timeline["Timeline extraction"]
  node_cause["Root cause analysis"]
  node_impact["Impact and risk analysis"]
  node_actions["Action items"]
  node_evidence["Evidence verification"]
  node_approval["Human approval"]
  node_publish["Report publishing"]
end

subgraph group_service["Runtime service"]
  node_model{{"OpenAI model"}}
  node_api["Health endpoint<br/>[main.py]"]
end

node_user(("Incident reporter"))
node_slack{{"Slack"}}
node_notion{{"Notion"}}

node_user -.->|"provides incident details"| node_collect
node_builder -->|"starts graph"| node_collect
node_builder -->|"routes after collection"| node_draft
node_builder -->|"routes after drafting"| node_review
node_builder -->|"configures review routing"| node_routes
node_review -->|"revises when rejected"| node_draft
node_collect -->|"formats input"| node_prompt
node_draft -->|"builds draft prompt"| node_prompt
node_draft -->|"invokes"| node_model
node_collect -->|"reads incident fields"| node_state
node_draft -->|"reads context"| node_state
node_review -->|"checks draft"| node_state
node_routes -->|"checks review result"| node_state
node_collect -->|"returns typed result"| node_types
node_draft -->|"returns typed result"| node_types
node_review -->|"returns typed result"| node_types
node_search -.->|"informs analysis"| node_cause
node_cause -.->|"supports risk assessment"| node_impact
node_publish -.->|"publishes report"| node_slack
node_publish -.->|"publishes report"| node_notion

click node_builder "https://github.com/yeeeengyu/incidflow/blob/main/app/graph/builder.py"
click node_collect "https://github.com/yeeeengyu/incidflow/blob/main/app/graph/node/collect_context.py"
click node_draft "https://github.com/yeeeengyu/incidflow/blob/main/app/graph/node/generate_report.py"
click node_review "https://github.com/yeeeengyu/incidflow/blob/main/app/graph/node/review_report.py"
click node_routes "https://github.com/yeeeengyu/incidflow/blob/main/app/graph/routes.py"
click node_state "https://github.com/yeeeengyu/incidflow/blob/main/app/graph/state.py"
click node_prompt "https://github.com/yeeeengyu/incidflow/blob/main/app/prompt.py"
click node_types "https://github.com/yeeeengyu/incidflow/blob/main/app/type.py"
click node_api "https://github.com/yeeeengyu/incidflow/blob/main/app/main.py"
click node_search "https://github.com/yeeeengyu/incidflow/tree/main/app/graph/node"
click node_timeline "https://github.com/yeeeengyu/incidflow/tree/main/app/graph/node"
click node_cause "https://github.com/yeeeengyu/incidflow/tree/main/app/graph/node"
click node_impact "https://github.com/yeeeengyu/incidflow/tree/main/app/graph/node"
click node_actions "https://github.com/yeeeengyu/incidflow/tree/main/app/graph/node"
click node_evidence "https://github.com/yeeeengyu/incidflow/tree/main/app/graph/node"
click node_approval "https://github.com/yeeeengyu/incidflow/tree/main/app/graph/node"
click node_publish "https://github.com/yeeeengyu/incidflow/tree/main/app/graph/node"

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_builder,node_collect,node_draft,node_review,node_routes toneBlue
class node_state,node_prompt,node_types toneAmber
class node_search,node_timeline,node_cause,node_impact,node_actions,node_evidence,node_approval,node_publish toneMint
class node_model,node_api toneRose
class node_user,node_slack,node_notion toneIndigo
```

## Components

### Report workflow

- [Graph builder](https://github.com/yeeeengyu/incidflow/blob/main/app/graph/builder.py): `app/graph/builder.py`
- [Collect context](https://github.com/yeeeengyu/incidflow/blob/main/app/graph/node/collect_context.py): `app/graph/node/collect_context.py`
- [Generate report](https://github.com/yeeeengyu/incidflow/blob/main/app/graph/node/generate_report.py): `app/graph/node/generate_report.py`
- [Review report](https://github.com/yeeeengyu/incidflow/blob/main/app/graph/node/review_report.py): `app/graph/node/review_report.py`
- [Review routing](https://github.com/yeeeengyu/incidflow/blob/main/app/graph/routes.py): `app/graph/routes.py`

### Prompt and state

- [Incident state](https://github.com/yeeeengyu/incidflow/blob/main/app/graph/state.py): `app/graph/state.py`
- [Prompt templates](https://github.com/yeeeengyu/incidflow/blob/main/app/prompt.py): `app/prompt.py`
- [Result schemas](https://github.com/yeeeengyu/incidflow/blob/main/app/type.py): `app/type.py`

### Documented extensions

- [Document and history search](https://github.com/yeeeengyu/incidflow/tree/main/app/graph/node): `app/graph/node`
- [Timeline extraction](https://github.com/yeeeengyu/incidflow/tree/main/app/graph/node): `app/graph/node`
- [Root cause analysis](https://github.com/yeeeengyu/incidflow/tree/main/app/graph/node): `app/graph/node`
- [Impact and risk analysis](https://github.com/yeeeengyu/incidflow/tree/main/app/graph/node): `app/graph/node`
- [Action items](https://github.com/yeeeengyu/incidflow/tree/main/app/graph/node): `app/graph/node`
- [Evidence verification](https://github.com/yeeeengyu/incidflow/tree/main/app/graph/node): `app/graph/node`
- [Human approval](https://github.com/yeeeengyu/incidflow/tree/main/app/graph/node): `app/graph/node`
- [Report publishing](https://github.com/yeeeengyu/incidflow/tree/main/app/graph/node): `app/graph/node`

### Runtime service

- **OpenAI model**
- [Health endpoint](https://github.com/yeeeengyu/incidflow/blob/main/app/main.py): `app/main.py`

### Other components

- **Incident reporter**
- **Slack**
- **Notion**

## Connections

- Incident reporter → Collect context: provides incident details (evidence: `readme.md`)
- Graph builder → Collect context: starts graph (evidence: `app/graph/builder.py`)
- Graph builder → Generate report: routes after collection (evidence: `app/graph/builder.py`)
- Graph builder → Review report: routes after drafting (evidence: `app/graph/builder.py`)
- Graph builder → Review routing: configures review routing (evidence: `app/graph/builder.py`)
- Review report → Generate report: revises when rejected (evidence: `app/graph/builder.py`)
- Collect context → Prompt templates: formats input (evidence: `app/graph/node/collect_context.py`)
- Generate report → Prompt templates: builds draft prompt (evidence: `app/graph/node/generate_report.py`)
- Generate report → OpenAI model: invokes (evidence: `app/graph/node/generate_report.py`)
- Collect context → Incident state: reads incident fields (evidence: `app/graph/node/collect_context.py`)
- Generate report → Incident state: reads context (evidence: `app/graph/node/generate_report.py`)
- Review report → Incident state: checks draft (evidence: `app/graph/node/review_report.py`)
- Review routing → Incident state: checks review result (evidence: `app/graph/routes.py`)
- Collect context → Result schemas: returns typed result (evidence: `app/graph/node/collect_context.py`)
- Generate report → Result schemas: returns typed result (evidence: `app/graph/node/generate_report.py`)
- Review report → Result schemas: returns typed result (evidence: `app/graph/node/review_report.py`)
- Document and history search → Root cause analysis: informs analysis (evidence: `readme.md`)
- Root cause analysis → Impact and risk analysis: supports risk assessment (evidence: `readme.md`)
- Report publishing → Slack: publishes report (evidence: `readme.md`)
- Report publishing → Notion: publishes report (evidence: `readme.md`)
