# jangidbhai2003-commits/sentinelmesh architecture

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

- Interactive diagram: https://gitdiagram.com/jangidbhai2003-commits/sentinelmesh
- Repository: https://github.com/jangidbhai2003-commits/sentinelmesh

## Overview

#### Purpose and Entry Points
SentinelMesh is a Python backend library for incident intelligence. Its primary entry point is the local CLI in `src/sentinelmesh/cli.py`; reusable package APIs are organized beneath `src/sentinelmesh/`. The system converts heterogeneous observability inputs into a shared event model, then supports analysis, rule-driven incident handling, persistence, and report generation.

#### Ingestion and Event Contract
The ingestion boundary accepts Prometheus, Loki, synthetic-check, and PagerDuty-style payloads. `src/sentinelmesh/ingestion/sources.py` identifies/parses source formats, while `src/sentinelmesh/ingestion/normalizer.py` converts them to the common contract defined by `src/sentinelmesh/ingestion/envelope.py`. Schema validation and payload shape definitions reside in `src/sentinelmesh/ingestion/schemas.py`.

This normalized envelope is the principal boundary between external telemetry providers and all downstream domain logic.

#### Rule Evaluation Pipeline
Rules are expressed as policies and compiled into executable evaluation structures via `src/sentinelmesh/rules/policy.py` and `src/sentinelmesh/rules/compiler.py`. `src/sentinelmesh/rules/engine.py` evaluates normalized events and metric-derived values against rule conditions in `src/sentinelmesh/rules/conditions.py`.

The rules subsystem separates declarative policy input from runtime evaluation, allowing ingestion sources and storage implementations to remain independent of alerting logic.

#### Metrics and Reliability Signals
Metric processing is centered on time series, windows, aggregation, and burn-rate calculations: `src/sentinelmesh/metrics/series.py`, `src/sentinelmesh/metrics/windows.py`, and `src/sentinelmesh/metrics/burn_rate.py`. `src/sentinelmesh/metrics/aggregations.py` derives rollups consumed by rules and reporting.

This stage turns stored or incoming telemetry into bounded-window reliability signals, including SLO burn-rate indicators.

#### Incident Domain Lifecycle
Rule matches and related events are grouped into incidents through `src/sentinelmesh/incidents/dedupe.py`. Incident state transitions and escalation-oriented lifecycle behavior are handled in `src/sentinelmesh/incidents/lifecycle.py`; historical event/state records are represented by `src/sentinelmesh/incidents/timeline.py`. Severity classification is isolated in `src/sentinelmesh/incidents/severity.py`.

This keeps incident identity, state, severity, and history distinct from raw-event ingestion and rule definitions.

#### Storage and Query Boundary
Persistence is defined behind repository and query abstractions in `src/sentinelmesh/storage/repository.py` and `src/sentinelmesh/storage/query.py`. The available concrete runtime store is deterministic in-memory storage at `src/sentinelmesh/storage/memory.py`, with snapshot import/export support in `src/sentinelmesh/storage/snapshots.py`.

There is no indicated database, message broker, HTTP server, or cloud service integration; external systems currently enter through payload normalization rather than deployed connectors.

#### Reporting and Operational Output
Reliability summaries are assembled in `src/sentinelmesh/reports/summary.py`, serialized in `src/sentinelmesh/reports/serialization.py`, and sanitized by recursive redaction in `src/sentinelmesh/reports/redaction.py`. CLI workflows expose snapshots and reports through `src/sentinelmesh/cli.py`.

Cross-cutting deterministic primitives—clock access, identifiers, pagination, errors, and result handling—are centralized in `src/sentinelmesh/core/clock.py`, `src/sentinelmesh/core/ids.py`, and `src/sentinelmesh/core/result.py`.

Main entry points: [`src/sentinelmesh/rules/engine.py`](https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/rules/engine.py) (Rule engine), [`src/sentinelmesh/ingestion/envelope.py`](https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/ingestion/envelope.py) (Normalized envelope), [`src/sentinelmesh/ingestion/sources.py`](https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/ingestion/sources.py) (Source parser), [`src/sentinelmesh/storage/repository.py`](https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/storage/repository.py) (Repository & query API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Ingestion"]
  node_telemetry_inputs["Telemetry payloads<br/>external input"]
  node_source_parser["Source parser<br/>ingestion adapter<br/>[sources.py]"]
  node_normalizer["Event normalizer<br/>boundary layer<br/>[normalizer.py]"]
  node_event_envelope["Normalized envelope<br/>event contract<br/>[envelope.py]"]
  node_ingestion_schemas["Payload schemas<br/>validation<br/>[schemas.py]"]
end

subgraph group_rules["Rules"]
  node_policy["Rule policies<br/>declarative rules<br/>[policy.py]"]
  node_compiler["Policy compiler<br/>rule compiler<br/>[compiler.py]"]
  node_rule_engine["Rule engine<br/>evaluator<br/>[engine.py]"]
  node_conditions["Rule conditions<br/>evaluation logic<br/>[conditions.py]"]
end

subgraph group_metrics["Metrics"]
  node_time_series["Time series &amp; windows<br/>metric processing<br/>[series.py]"]
  node_burn_rate["Aggregation &amp; burn rate<br/>reliability signals<br/>[burn_rate.py]"]
end

subgraph group_incidents["Incidents"]
  node_dedupe["Incident deduplication<br/>incident grouping<br/>[dedupe.py]"]
  node_lifecycle["Incident lifecycle<br/>state transitions<br/>[lifecycle.py]"]
  node_timeline["Incident timeline<br/>history records<br/>[timeline.py]"]
end

subgraph group_storage_output["Storage &amp; Output"]
  node_repository["Repository &amp; query API<br/>persistence boundary<br/>[repository.py]"]
  node_memory_store[("In-memory store<br/>concrete storage<br/>[memory.py]")]
  node_snapshots["Snapshot import/export<br/>persistence interchange<br/>[snapshots.py]"]
  node_reports["Reliability reports<br/>operational output<br/>[summary.py]"]
end

node_cli["Local CLI<br/>entry point<br/>[cli.py]"]

node_cli -->|"accepts payloads"| node_source_parser
node_cli -->|"imports/exports"| node_snapshots
node_cli -->|"renders"| node_reports
node_telemetry_inputs -->|"raw payloads"| node_source_parser
node_source_parser -->|"validates"| node_ingestion_schemas
node_source_parser -->|"parsed source data"| node_normalizer
node_normalizer -->|"common event"| node_event_envelope
node_policy -->|"compiled into"| node_compiler
node_compiler -->|"evaluation structures"| node_rule_engine
node_conditions -->|"conditions"| node_rule_engine
node_event_envelope -->|"events"| node_rule_engine
node_event_envelope -->|"telemetry"| node_time_series
node_time_series -->|"bounded windows"| node_burn_rate
node_burn_rate -->|"derived values"| node_rule_engine
node_rule_engine -->|"rule matches"| node_dedupe
node_dedupe -->|"incidents"| node_lifecycle
node_lifecycle -->|"state history"| node_timeline
node_event_envelope -->|"stores events"| node_repository
node_lifecycle -->|"persists incidents"| node_repository
node_repository -->|"implemented by"| node_memory_store
node_snapshots -->|"imports/exports state"| node_memory_store
node_repository -->|"queried data"| node_reports
node_burn_rate -->|"reliability signals"| node_reports

click node_cli "https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/cli.py"
click node_source_parser "https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/ingestion/sources.py"
click node_normalizer "https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/ingestion/normalizer.py"
click node_event_envelope "https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/ingestion/envelope.py"
click node_ingestion_schemas "https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/ingestion/schemas.py"
click node_policy "https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/rules/policy.py"
click node_compiler "https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/rules/compiler.py"
click node_rule_engine "https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/rules/engine.py"
click node_conditions "https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/rules/conditions.py"
click node_time_series "https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/metrics/series.py"
click node_burn_rate "https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/metrics/burn_rate.py"
click node_dedupe "https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/incidents/dedupe.py"
click node_lifecycle "https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/incidents/lifecycle.py"
click node_timeline "https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/incidents/timeline.py"
click node_repository "https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/storage/repository.py"
click node_memory_store "https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/storage/memory.py"
click node_snapshots "https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/storage/snapshots.py"
click node_reports "https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/reports/summary.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_telemetry_inputs,node_source_parser,node_normalizer,node_event_envelope,node_ingestion_schemas toneBlue
class node_policy,node_compiler,node_rule_engine,node_conditions toneAmber
class node_time_series,node_burn_rate toneMint
class node_dedupe,node_lifecycle,node_timeline toneRose
class node_repository,node_memory_store,node_snapshots,node_reports toneIndigo
class node_cli toneNeutral
```

## Components

### Ingestion

External payloads are normalized at this boundary.

- **Telemetry payloads**: external input · Prometheus, Loki, synthetic-check, and PagerDuty-style payloads.
- [Source parser](https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/ingestion/sources.py): ingestion adapter · `src/sentinelmesh/ingestion/sources.py`
- [Event normalizer](https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/ingestion/normalizer.py): boundary layer · `src/sentinelmesh/ingestion/normalizer.py`
- [Normalized envelope](https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/ingestion/envelope.py): event contract · Principal boundary for downstream domain logic. · `src/sentinelmesh/ingestion/envelope.py`
- [Payload schemas](https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/ingestion/schemas.py): validation · `src/sentinelmesh/ingestion/schemas.py`

### Rules

- [Rule policies](https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/rules/policy.py): declarative rules · `src/sentinelmesh/rules/policy.py`
- [Policy compiler](https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/rules/compiler.py): rule compiler · `src/sentinelmesh/rules/compiler.py`
- [Rule engine](https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/rules/engine.py): evaluator · `src/sentinelmesh/rules/engine.py`
- [Rule conditions](https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/rules/conditions.py): evaluation logic · `src/sentinelmesh/rules/conditions.py`

### Metrics

- [Time series & windows](https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/metrics/series.py): metric processing · `src/sentinelmesh/metrics/series.py`
- [Aggregation & burn rate](https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/metrics/burn_rate.py): reliability signals · Derives rollups and SLO burn-rate indicators. · `src/sentinelmesh/metrics/burn_rate.py`

### Incidents

- [Incident deduplication](https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/incidents/dedupe.py): incident grouping · `src/sentinelmesh/incidents/dedupe.py`
- [Incident lifecycle](https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/incidents/lifecycle.py): state transitions · `src/sentinelmesh/incidents/lifecycle.py`
- [Incident timeline](https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/incidents/timeline.py): history records · `src/sentinelmesh/incidents/timeline.py`

### Storage & Output

- [Repository & query API](https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/storage/repository.py): persistence boundary · `src/sentinelmesh/storage/repository.py`
- [In-memory store](https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/storage/memory.py): concrete storage · Deterministic runtime persistence. · `src/sentinelmesh/storage/memory.py`
- [Snapshot import/export](https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/storage/snapshots.py): persistence interchange · `src/sentinelmesh/storage/snapshots.py`
- [Reliability reports](https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/reports/summary.py): operational output · Assembles, serializes, and redacts summaries. · `src/sentinelmesh/reports/summary.py`

### Other components

- [Local CLI](https://github.com/jangidbhai2003-commits/sentinelmesh/blob/main/src/sentinelmesh/cli.py): entry point · Runs ingestion, snapshot, and report workflows. · `src/sentinelmesh/cli.py`

## Connections

- Local CLI → Source parser: accepts payloads
- Local CLI → Snapshot import/export: imports/exports
- Local CLI → Reliability reports: renders
- Telemetry payloads → Source parser: raw payloads
- Source parser → Payload schemas: validates
- Source parser → Event normalizer: parsed source data
- Event normalizer → Normalized envelope: common event
- Rule policies → Policy compiler: compiled into
- Policy compiler → Rule engine: evaluation structures
- Rule conditions → Rule engine: conditions
- Normalized envelope → Rule engine: events
- Normalized envelope → Time series & windows: telemetry
- Time series & windows → Aggregation & burn rate: bounded windows
- Aggregation & burn rate → Rule engine: derived values
- Rule engine → Incident deduplication: rule matches
- Incident deduplication → Incident lifecycle: incidents
- Incident lifecycle → Incident timeline: state history
- Normalized envelope → Repository & query API: stores events
- Incident lifecycle → Repository & query API: persists incidents
- Repository & query API → In-memory store: implemented by
- Snapshot import/export → In-memory store: imports/exports state
- Repository & query API → Reliability reports: queried data
- Aggregation & burn rate → Reliability reports: reliability signals
