# ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders architecture

> Architecture diagram of the GitHub repository ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders
- Repository: https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders

## Overview

CHA-BAGAN OPS AI is an incident-analysis and guarded-remediation application. An operator submits or selects an incident; the API loads telemetry and evidence, evaluates customer-visible SLO impact, attributes a cause, checks safety, and presents a plan. Where authorized, actions pass through an idempotent outbox to a worker and simulated cluster; recovery is observed and audited. The graph includes the implemented analysis, safety, agent, persistence, and remediation layers. Several README capabilities are explicitly planned, so they are not represented as implemented components; unsampled relationships are omitted unless documented or indexed.

Main entry points: [`app/api/main.py`](https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/api/main.py) (Incident API), [`app/core/model.py`](https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/core/model.py) (Domain records), [`app/core/attribution/attribute.py`](https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/core/attribution/attribute.py) (Causal attribution), [`app/core/slo/compute.py`](https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/core/slo/compute.py) (SLO evaluation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Incident interface"]
  node_web_ui["Incident UI<br/>[index.html]"]
  node_runner_ui["Run view<br/>[run.html]"]
  node_api["Incident API<br/>[main.py]"]
end

subgraph group_analysis["Incident analysis"]
  node_domain["Domain records<br/>[model.py]"]
  node_ports["Core ports<br/>[ports.py]"]
  node_slo["SLO evaluation<br/>[compute.py]"]
  node_attribution["Causal attribution<br/>[attribute.py]"]
  node_proposal_guard["Proposal guard<br/>[guard.py]"]
  node_blast["Blast radius<br/>[radius.py]"]
  node_safety["Safety chain<br/>[chain.py]"]
  node_lifecycle["Incident lifecycle<br/>[lifecycle.py]"]
  node_agent["Bounded agent<br/>[loop.py]"]
end

subgraph group_adapters["Ports and adapters"]
  node_fixture_loader["Fixture loader<br/>[fixture.py]"]
  node_incident_generator["Incident generator<br/>[generate.py]"]
  node_config["Policy config<br/>[config.py]"]
  node_clock["Scenario clock<br/>[clock.py]"]
  node_reasoner["Reasoning adapter<br/>[llm.py]"]
  node_sqlite[("SQLite store<br/>[sqlite.py]")]
end

subgraph group_execution["Guarded execution"]
  node_sim_cluster["Simulated cluster<br/>[sim_cluster.py]"]
  node_worker["Outbox worker<br/>[runner.py]"]
end

node_operator(("Operator"))
node_model_service["NVIDIA model API"]

node_operator -->|"uses"| node_web_ui
node_operator -->|"uses"| node_runner_ui
node_web_ui -.->|"requests"| node_api
node_runner_ui -.->|"requests"| node_api
node_api -->|"loads fixtures"| node_fixture_loader
node_api -->|"generates incidents"| node_incident_generator
node_api -->|"reads and writes"| node_sqlite
node_api -->|"gets time"| node_clock
node_api -->|"loads policies"| node_config
node_api -->|"evaluates SLO"| node_slo
node_api -->|"attributes cause"| node_attribution
node_api -->|"checks proposal"| node_proposal_guard
node_api -->|"requests proposal"| node_reasoner
node_api -->|"computes impact"| node_blast
node_api -->|"checks actions"| node_safety
node_api -->|"advances incident"| node_lifecycle
node_api -->|"runs agent"| node_agent
node_api -->|"configures remediation"| node_sim_cluster
node_reasoner -->|"requests completion"| node_model_service
node_attribution -->|"uses records"| node_domain
node_attribution -->|"uses mechanisms"| node_slo
node_proposal_guard -->|"reconciles cause"| node_attribution
node_slo -->|"evaluates records"| node_domain
node_blast -->|"uses SLO results"| node_slo
node_safety -->|"checks policy"| node_domain
node_agent -.->|"requests next step"| node_reasoner
node_worker -->|"claims and records jobs"| node_sqlite
node_worker -->|"applies action"| node_sim_cluster
node_sim_cluster -->|"reads and updates state"| node_sqlite
node_api -->|"uses interfaces"| node_ports
node_sqlite -->|"persists records"| node_domain
node_fixture_loader -->|"builds records"| node_domain
node_incident_generator -->|"creates evidence"| node_domain

click node_web_ui "https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/web/index.html"
click node_runner_ui "https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/web/run.html"
click node_api "https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/api/main.py"
click node_domain "https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/core/model.py"
click node_ports "https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/core/ports.py"
click node_slo "https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/core/slo/compute.py"
click node_attribution "https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/core/attribution/attribute.py"
click node_proposal_guard "https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/core/attribution/guard.py"
click node_blast "https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/core/blast/radius.py"
click node_safety "https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/core/safety/chain.py"
click node_lifecycle "https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/core/lifecycle.py"
click node_agent "https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/core/agent/loop.py"
click node_fixture_loader "https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/adapters/telemetry/fixture.py"
click node_incident_generator "https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/adapters/telemetry/generate.py"
click node_config "https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/adapters/config.py"
click node_clock "https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/adapters/clock.py"
click node_reasoner "https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/adapters/reasoning/llm.py"
click node_sqlite "https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/adapters/store/sqlite.py"
click node_sim_cluster "https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/adapters/remediation/sim_cluster.py"
click node_worker "https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/worker/runner.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_web_ui,node_runner_ui,node_api toneBlue
class node_domain,node_ports,node_slo,node_attribution,node_proposal_guard,node_blast,node_safety,node_lifecycle,node_agent toneAmber
class node_fixture_loader,node_incident_generator,node_config,node_clock,node_reasoner,node_sqlite,node_model_service toneMint
class node_sim_cluster,node_worker toneRose
class node_operator toneIndigo
```

## Components

### Incident interface

- [Incident UI](https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/web/index.html): `web/index.html`
- [Run view](https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/web/run.html): `web/run.html`
- [Incident API](https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/api/main.py): `app/api/main.py`

### Incident analysis

- [Domain records](https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/core/model.py): `app/core/model.py`
- [Core ports](https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/core/ports.py): `app/core/ports.py`
- [SLO evaluation](https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/core/slo/compute.py): `app/core/slo/compute.py`
- [Causal attribution](https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/core/attribution/attribute.py): `app/core/attribution/attribute.py`
- [Proposal guard](https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/core/attribution/guard.py): `app/core/attribution/guard.py`
- [Blast radius](https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/core/blast/radius.py): `app/core/blast/radius.py`
- [Safety chain](https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/core/safety/chain.py): `app/core/safety/chain.py`
- [Incident lifecycle](https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/core/lifecycle.py): `app/core/lifecycle.py`
- [Bounded agent](https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/core/agent/loop.py): `app/core/agent/loop.py`

### Ports and adapters

- [Fixture loader](https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/adapters/telemetry/fixture.py): `app/adapters/telemetry/fixture.py`
- [Incident generator](https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/adapters/telemetry/generate.py): `app/adapters/telemetry/generate.py`
- [Policy config](https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/adapters/config.py): `app/adapters/config.py`
- [Scenario clock](https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/adapters/clock.py): `app/adapters/clock.py`
- [Reasoning adapter](https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/adapters/reasoning/llm.py): `app/adapters/reasoning/llm.py`
- [SQLite store](https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/adapters/store/sqlite.py): `app/adapters/store/sqlite.py`

### Guarded execution

- [Simulated cluster](https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/adapters/remediation/sim_cluster.py): `app/adapters/remediation/sim_cluster.py`
- [Outbox worker](https://github.com/ttahsin124-wq/cha-bagan-mu-hackathon-team-nexus-builders/blob/main/app/worker/runner.py): `app/worker/runner.py`

### Other components

- **Operator**
- **NVIDIA model API**

## Connections

- Operator → Incident UI: uses (evidence: `README.md`)
- Operator → Run view: uses (evidence: `README.md`)
- Incident UI → Incident API: requests
- Run view → Incident API: requests
- Incident API → Fixture loader: loads fixtures (evidence: `app/api/main.py`)
- Incident API → Incident generator: generates incidents (evidence: `app/api/main.py`)
- Incident API → SQLite store: reads and writes (evidence: `app/api/main.py`)
- Incident API → Scenario clock: gets time (evidence: `app/api/main.py`)
- Incident API → Policy config: loads policies (evidence: `app/api/main.py`)
- Incident API → SLO evaluation: evaluates SLO (evidence: `app/api/main.py`)
- Incident API → Causal attribution: attributes cause (evidence: `app/api/main.py`)
- Incident API → Proposal guard: checks proposal (evidence: `app/api/main.py`)
- Incident API → Reasoning adapter: requests proposal (evidence: `app/api/main.py`)
- Incident API → Blast radius: computes impact (evidence: `app/api/main.py`)
- Incident API → Safety chain: checks actions (evidence: `app/api/main.py`)
- Incident API → Incident lifecycle: advances incident (evidence: `app/api/main.py`)
- Incident API → Bounded agent: runs agent (evidence: `app/api/main.py`)
- Incident API → Simulated cluster: configures remediation (evidence: `app/api/main.py`)
- Reasoning adapter → NVIDIA model API: requests completion (evidence: `app/adapters/reasoning/llm.py`)
- Causal attribution → Domain records: uses records (evidence: `app/core/attribution/attribute.py`)
- Causal attribution → SLO evaluation: uses mechanisms (evidence: `app/core/attribution/attribute.py`)
- Proposal guard → Causal attribution: reconciles cause (evidence: `app/core/attribution/guard.py`)
- SLO evaluation → Domain records: evaluates records (evidence: `app/core/slo/compute.py`)
- Blast radius → SLO evaluation: uses SLO results (evidence: `app/core/blast/radius.py`)
- Safety chain → Domain records: checks policy (evidence: `app/core/safety/chain.py`)
- Bounded agent → Reasoning adapter: requests next step
- Outbox worker → SQLite store: claims and records jobs (evidence: `app/worker/runner.py`)
- Outbox worker → Simulated cluster: applies action (evidence: `app/worker/runner.py`)
- Simulated cluster → SQLite store: reads and updates state (evidence: `app/adapters/remediation/sim_cluster.py`)
- Incident API → Core ports: uses interfaces (evidence: `app/api/main.py`)
- SQLite store → Domain records: persists records (evidence: `app/adapters/store/sqlite.py`)
- Fixture loader → Domain records: builds records (evidence: `app/adapters/telemetry/fixture.py`)
- Incident generator → Domain records: creates evidence (evidence: `app/adapters/telemetry/generate.py`)
