# apurvv28/self-healing-os architecture

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

- Interactive diagram: https://gitdiagram.com/apurvv28/self-healing-os
- Repository: https://github.com/apurvv28/self-healing-os

## Overview

AegisOS is a Linux self-healing framework whose main workflow collects telemetry, detects and stores incidents, diagnoses causes, executes policy-guarded remediation, and verifies recovery. The graph also preserves the documented ML training, kernel crash analysis, advanced kernel remediation, and dashboard capabilities. Edges use sampled call sites, SOURCE INDEX references, or README statements; unsampled implementation details are not inferred.

Main entry points: [`verification/loop.py`](https://github.com/apurvv28/self-healing-os/blob/main/verification/loop.py) (Healing cycle), [`rca/engine.py`](https://github.com/apurvv28/self-healing-os/blob/main/rca/engine.py) (Root-cause analysis), [`monitor/daemon.py`](https://github.com/apurvv28/self-healing-os/blob/main/monitor/daemon.py) (Telemetry daemon), [`remediation/engine.py`](https://github.com/apurvv28/self-healing-os/blob/main/remediation/engine.py) (Remediation policy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operations["Monitoring and detection"]
  node_monitor["Telemetry daemon<br/>[daemon.py]"]
  node_service["Service monitor<br/>[service_monitor.py]"]
  node_resources["Resource monitor"]
  node_logs["Log monitor<br/>[log_monitor.py]"]
  node_detect["Failure detection<br/>[engine.py]"]
  node_rules["Detection rules<br/>[rules.py]"]
end

subgraph group_intelligence["Triage and diagnosis"]
  node_classifier["Failure classifier<br/>[classifier.py]"]
  node_dataset["Dataset generation"]
  node_trainer["Model training<br/>[trainer.py]"]
  node_rca["Root-cause analysis<br/>[engine.py]"]
  node_correlator["Event correlator<br/>[correlator.py]"]
  node_scorer["Confidence scoring<br/>[scorer.py]"]
  node_kdump["Crash dump analysis<br/>[analyzer.py]"]
  node_kdmanager["Crash dump manager<br/>[manager.py]"]
end

subgraph group_recovery["Remediation and verification"]
  node_loop["Healing cycle<br/>[loop.py]"]
  node_remediation["Remediation policy<br/>[engine.py]"]
  node_actions["Recovery actions<br/>[actions.py]"]
  node_kernelactions["Kernel actions<br/>[kernel_actions.py]"]
  node_kerneldb[("Kernel policy database<br/>[kernel_db.py]")]
  node_audit[("Remediation audit<br/>[audit.py]")]
  node_verify["Recovery verification<br/>[engine.py]"]
  node_checker["Health checks<br/>[checker.py]"]
  node_metrics["Recovery metrics<br/>[metrics.py]"]
end

subgraph group_interfaces["User interfaces"]
  node_cli["CLI and daemon<br/>[agent.py]"]
  node_dashboard["REST dashboard<br/>[api.py]"]
end

subgraph group_foundation["Shared data and analysis"]
  node_incidents[("Incident store<br/>[storage.py]")]
  node_events["Event and diagnosis models<br/>[events.py]"]
  node_config["Configuration loader<br/>[config_loader.py]"]
end

node_operator(("Operator"))
node_linux["Linux system"]

node_operator -->|"issues commands"| node_cli
node_cli -->|"runs cycle"| node_loop
node_cli -->|"serves dashboard"| node_dashboard
node_loop -->|"collects telemetry"| node_monitor
node_monitor -->|"polls services"| node_service
node_monitor -->|"collects resources"| node_resources
node_monitor -->|"collects logs"| node_logs
node_linux -.->|"provides telemetry"| node_monitor
node_loop -->|"processes snapshot"| node_detect
node_detect -->|"evaluates rules"| node_rules
node_detect -->|"stores incidents"| node_incidents
node_detect -->|"emits events"| node_events
node_loop -->|"diagnoses incidents"| node_rca
node_rca -->|"classifies event"| node_classifier
node_rca -->|"correlates events"| node_correlator
node_rca -->|"scores confidence"| node_scorer
node_rca -->|"produces diagnosis"| node_events
node_trainer -->|"uses generated data"| node_dataset
node_dataset -->|"uses event schema"| node_events
node_loop -->|"executes policy"| node_remediation
node_remediation -->|"dispatches actions"| node_actions
node_remediation -->|"dispatches kernel actions"| node_kernelactions
node_remediation -->|"uses kernel policies"| node_kerneldb
node_remediation -->|"records actions"| node_audit
node_loop -->|"checks recovery"| node_verify
node_verify -->|"runs health checks"| node_checker
node_loop -->|"tracks outcomes"| node_metrics
node_kdmanager -->|"analyzes dumps"| node_kdump
node_linux -.->|"provides crash dumps"| node_kdmanager
node_dashboard -->|"requests telemetry"| node_monitor
node_dashboard -->|"reads incidents"| node_incidents
node_dashboard -->|"reads metrics"| node_metrics
node_dashboard -->|"requests diagnosis"| node_rca
node_cli -->|"loads settings"| node_config
node_loop -->|"loads settings"| node_config

click node_cli "https://github.com/apurvv28/self-healing-os/blob/main/agent.py"
click node_loop "https://github.com/apurvv28/self-healing-os/blob/main/verification/loop.py"
click node_monitor "https://github.com/apurvv28/self-healing-os/blob/main/monitor/daemon.py"
click node_service "https://github.com/apurvv28/self-healing-os/blob/main/monitor/service_monitor.py"
click node_resources "https://github.com/apurvv28/self-healing-os/blob/main/monitor/resource_monitor.py"
click node_logs "https://github.com/apurvv28/self-healing-os/blob/main/monitor/log_monitor.py"
click node_detect "https://github.com/apurvv28/self-healing-os/blob/main/detector/engine.py"
click node_rules "https://github.com/apurvv28/self-healing-os/blob/main/detector/rules.py"
click node_incidents "https://github.com/apurvv28/self-healing-os/blob/main/detector/storage.py"
click node_events "https://github.com/apurvv28/self-healing-os/blob/main/common/events.py"
click node_classifier "https://github.com/apurvv28/self-healing-os/blob/main/ai/classifier.py"
click node_dataset "https://github.com/apurvv28/self-healing-os/blob/main/ai/dataset_generator.py"
click node_trainer "https://github.com/apurvv28/self-healing-os/blob/main/ai/trainer.py"
click node_rca "https://github.com/apurvv28/self-healing-os/blob/main/rca/engine.py"
click node_correlator "https://github.com/apurvv28/self-healing-os/blob/main/rca/correlator.py"
click node_scorer "https://github.com/apurvv28/self-healing-os/blob/main/rca/scorer.py"
click node_remediation "https://github.com/apurvv28/self-healing-os/blob/main/remediation/engine.py"
click node_actions "https://github.com/apurvv28/self-healing-os/blob/main/remediation/actions.py"
click node_kernelactions "https://github.com/apurvv28/self-healing-os/blob/main/remediation/kernel_actions.py"
click node_kerneldb "https://github.com/apurvv28/self-healing-os/blob/main/remediation/kernel_db.py"
click node_audit "https://github.com/apurvv28/self-healing-os/blob/main/remediation/audit.py"
click node_verify "https://github.com/apurvv28/self-healing-os/blob/main/verification/engine.py"
click node_checker "https://github.com/apurvv28/self-healing-os/blob/main/verification/checker.py"
click node_metrics "https://github.com/apurvv28/self-healing-os/blob/main/verification/metrics.py"
click node_kdump "https://github.com/apurvv28/self-healing-os/blob/main/kdump/analyzer.py"
click node_kdmanager "https://github.com/apurvv28/self-healing-os/blob/main/kdump/manager.py"
click node_dashboard "https://github.com/apurvv28/self-healing-os/blob/main/dashboard/api.py"
click node_config "https://github.com/apurvv28/self-healing-os/blob/main/common/config_loader.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_monitor,node_service,node_resources,node_logs,node_detect,node_rules toneBlue
class node_classifier,node_dataset,node_trainer,node_rca,node_correlator,node_scorer,node_kdump,node_kdmanager toneAmber
class node_loop,node_remediation,node_actions,node_kernelactions,node_kerneldb,node_audit,node_verify,node_checker,node_metrics toneMint
class node_cli,node_dashboard toneRose
class node_incidents,node_events,node_config,node_operator,node_linux toneIndigo
```

## Components

### Monitoring and detection

- [Telemetry daemon](https://github.com/apurvv28/self-healing-os/blob/main/monitor/daemon.py): `monitor/daemon.py`
- [Service monitor](https://github.com/apurvv28/self-healing-os/blob/main/monitor/service_monitor.py): `monitor/service_monitor.py`
- [Resource monitor](https://github.com/apurvv28/self-healing-os/blob/main/monitor/resource_monitor.py): `monitor/resource_monitor.py`
- [Log monitor](https://github.com/apurvv28/self-healing-os/blob/main/monitor/log_monitor.py): `monitor/log_monitor.py`
- [Failure detection](https://github.com/apurvv28/self-healing-os/blob/main/detector/engine.py): `detector/engine.py`
- [Detection rules](https://github.com/apurvv28/self-healing-os/blob/main/detector/rules.py): `detector/rules.py`

### Triage and diagnosis

- [Failure classifier](https://github.com/apurvv28/self-healing-os/blob/main/ai/classifier.py): `ai/classifier.py`
- [Dataset generation](https://github.com/apurvv28/self-healing-os/blob/main/ai/dataset_generator.py): `ai/dataset_generator.py`
- [Model training](https://github.com/apurvv28/self-healing-os/blob/main/ai/trainer.py): `ai/trainer.py`
- [Root-cause analysis](https://github.com/apurvv28/self-healing-os/blob/main/rca/engine.py): `rca/engine.py`
- [Event correlator](https://github.com/apurvv28/self-healing-os/blob/main/rca/correlator.py): `rca/correlator.py`
- [Confidence scoring](https://github.com/apurvv28/self-healing-os/blob/main/rca/scorer.py): `rca/scorer.py`
- [Crash dump analysis](https://github.com/apurvv28/self-healing-os/blob/main/kdump/analyzer.py): `kdump/analyzer.py`
- [Crash dump manager](https://github.com/apurvv28/self-healing-os/blob/main/kdump/manager.py): `kdump/manager.py`

### Remediation and verification

- [Healing cycle](https://github.com/apurvv28/self-healing-os/blob/main/verification/loop.py): `verification/loop.py`
- [Remediation policy](https://github.com/apurvv28/self-healing-os/blob/main/remediation/engine.py): `remediation/engine.py`
- [Recovery actions](https://github.com/apurvv28/self-healing-os/blob/main/remediation/actions.py): `remediation/actions.py`
- [Kernel actions](https://github.com/apurvv28/self-healing-os/blob/main/remediation/kernel_actions.py): `remediation/kernel_actions.py`
- [Kernel policy database](https://github.com/apurvv28/self-healing-os/blob/main/remediation/kernel_db.py): `remediation/kernel_db.py`
- [Remediation audit](https://github.com/apurvv28/self-healing-os/blob/main/remediation/audit.py): `remediation/audit.py`
- [Recovery verification](https://github.com/apurvv28/self-healing-os/blob/main/verification/engine.py): `verification/engine.py`
- [Health checks](https://github.com/apurvv28/self-healing-os/blob/main/verification/checker.py): `verification/checker.py`
- [Recovery metrics](https://github.com/apurvv28/self-healing-os/blob/main/verification/metrics.py): `verification/metrics.py`

### User interfaces

- [CLI and daemon](https://github.com/apurvv28/self-healing-os/blob/main/agent.py): `agent.py`
- [REST dashboard](https://github.com/apurvv28/self-healing-os/blob/main/dashboard/api.py): `dashboard/api.py`

### Shared data and analysis

- [Incident store](https://github.com/apurvv28/self-healing-os/blob/main/detector/storage.py): `detector/storage.py`
- [Event and diagnosis models](https://github.com/apurvv28/self-healing-os/blob/main/common/events.py): `common/events.py`
- [Configuration loader](https://github.com/apurvv28/self-healing-os/blob/main/common/config_loader.py): `common/config_loader.py`

### Other components

- **Operator**
- **Linux system**

## Connections

- Operator → CLI and daemon: issues commands (evidence: `README.md`)
- CLI and daemon → Healing cycle: runs cycle (evidence: `agent.py`)
- CLI and daemon → REST dashboard: serves dashboard (evidence: `agent.py`)
- Healing cycle → Telemetry daemon: collects telemetry (evidence: `verification/loop.py`)
- Telemetry daemon → Service monitor: polls services (evidence: `monitor/daemon.py`)
- Telemetry daemon → Resource monitor: collects resources (evidence: `monitor/daemon.py`)
- Telemetry daemon → Log monitor: collects logs (evidence: `monitor/daemon.py`)
- Linux system → Telemetry daemon: provides telemetry (evidence: `README.md`)
- Healing cycle → Failure detection: processes snapshot (evidence: `verification/loop.py`)
- Failure detection → Detection rules: evaluates rules (evidence: `detector/engine.py`)
- Failure detection → Incident store: stores incidents (evidence: `detector/engine.py`)
- Failure detection → Event and diagnosis models: emits events (evidence: `detector/engine.py`)
- Healing cycle → Root-cause analysis: diagnoses incidents (evidence: `verification/loop.py`)
- Root-cause analysis → Failure classifier: classifies event (evidence: `rca/engine.py`)
- Root-cause analysis → Event correlator: correlates events (evidence: `rca/engine.py`)
- Root-cause analysis → Confidence scoring: scores confidence (evidence: `rca/engine.py`)
- Root-cause analysis → Event and diagnosis models: produces diagnosis (evidence: `rca/engine.py`)
- Model training → Dataset generation: uses generated data (evidence: `ai/trainer.py`)
- Dataset generation → Event and diagnosis models: uses event schema (evidence: `ai/dataset_generator.py`)
- Healing cycle → Remediation policy: executes policy (evidence: `verification/loop.py`)
- Remediation policy → Recovery actions: dispatches actions (evidence: `remediation/engine.py`)
- Remediation policy → Kernel actions: dispatches kernel actions (evidence: `remediation/engine.py`)
- Remediation policy → Kernel policy database: uses kernel policies (evidence: `remediation/engine.py`)
- Remediation policy → Remediation audit: records actions (evidence: `remediation/engine.py`)
- Healing cycle → Recovery verification: checks recovery (evidence: `verification/loop.py`)
- Recovery verification → Health checks: runs health checks (evidence: `verification/engine.py`)
- Healing cycle → Recovery metrics: tracks outcomes (evidence: `verification/loop.py`)
- Crash dump manager → Crash dump analysis: analyzes dumps (evidence: `kdump/manager.py`)
- Linux system → Crash dump manager: provides crash dumps (evidence: `README.md`)
- REST dashboard → Telemetry daemon: requests telemetry (evidence: `dashboard/api.py`)
- REST dashboard → Incident store: reads incidents (evidence: `dashboard/api.py`)
- REST dashboard → Recovery metrics: reads metrics (evidence: `dashboard/api.py`)
- REST dashboard → Root-cause analysis: requests diagnosis (evidence: `dashboard/api.py`)
- CLI and daemon → Configuration loader: loads settings (evidence: `agent.py`)
- Healing cycle → Configuration loader: loads settings (evidence: `verification/loop.py`)
