Skip to content

Commit ea8c040

Browse files
update: intelligence_layer.md
1 parent cfc166e commit ea8c040

1 file changed

Lines changed: 205 additions & 52 deletions

File tree

Lines changed: 205 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,277 @@
11
# Intelligence Pipeline
22

3-
This document explains how SentraCore transforms raw system telemetry into actionable, explainable intelligence across its ten processing stages.
3+
This document explains how SentraCore transforms raw system telemetry into structured, explainable system intelligence through a multi-stage processing pipeline.
4+
5+
Rather than relying on isolated system snapshots, SentraCore continuously analyzes behavior over time to detect anomalies, estimate degradation risk, and identify likely causes of system slowdowns.
46

57
---
68

7-
## Overview
9+
# Overview
810

9-
Raw telemetry alone is insufficient for meaningful system monitoring. A CPU reading of 95% could be normal during a scheduled batch job, or it could indicate a runaway process. SentraCore resolves this ambiguity through a sequential intelligence pipeline that layers context, statistics, and forecasting on top of raw data.
11+
Raw telemetry alone rarely provides meaningful context.
1012

11-
```
13+
For example:
14+
- High CPU usage may be expected during compilation or rendering workloads
15+
- Elevated memory usage may indicate either normal caching behavior or sustained resource pressure
16+
- Temporary disk spikes may be harmless, while prolonged saturation may degrade responsiveness
17+
18+
SentraCore addresses this by processing telemetry through multiple intelligence layers that progressively add context, statistical interpretation, behavioral analysis, and forecasting.
19+
20+
---
21+
22+
# Pipeline Flow
23+
24+
```text
1225
SystemCollector
13-
Normalizer (EMA smoothing, spike detection)
14-
→ TimeSeriesBuffer (ring buffers for historical context)
15-
→ BaselineModel (per-segment adaptive learning)
16-
→ TrendAnalyzer (linear regression, slope, volatility)
17-
→ AnomalyDetector (Z-score deviation from baseline)
18-
→ StressEngine (multi-state composite score)
19-
→ PredictionEngine (ETA forecasting, risk scoring)
20-
→ StabilityCalculator (global health index)
21-
→ CorrelationEngine (root cause analysis, triggered on alert)
22-
→ AlertManager (threshold evaluation, RCA attachment)
26+
SignalNormalizer
27+
→ TimeSeriesBuffer
28+
→ BaselineModel
29+
→ TrendAnalyzer
30+
→ AnomalyDetector
31+
→ StressEngine
32+
→ PredictionEngine
33+
→ StabilityCalculator
34+
→ CorrelationEngine
35+
→ AlertManager
2336
```
2437

2538
---
2639

27-
## Stage 1: System Collection
40+
# Stage 1 System Collection
2841

2942
**Module:** `engine/collector/system_collector.py`
3043

31-
The `SystemCollector` samples system telemetry at a configurable interval (default: 2 seconds) using `psutil`. Each sample is a `SystemSnapshot` containing CPU percent, memory usage, disk I/O rates, and a UNIX timestamp.
44+
The `SystemCollector` gathers real-time system telemetry at a configurable interval using `psutil`.
45+
46+
Collected metrics include:
47+
- CPU utilization
48+
- memory usage
49+
- disk activity
50+
- process statistics
51+
- system timestamps
52+
53+
Each cycle produces a structured `SystemSnapshot` used throughout the pipeline.
3254

3355
---
3456

35-
## Stage 2: Normalization
57+
# Stage 2 — Signal Normalization
3658

3759
**Module:** `engine/normalization/normalizer.py`
3860

39-
The `Normalizer` applies an **Exponential Moving Average (EMA)** to each metric, reducing the impact of instantaneous spikes on downstream analysis. It also independently detects spikes by comparing raw values against the rolling average.
61+
Raw system telemetry often contains short-lived spikes and noisy fluctuations.
62+
63+
The `SignalNormalizer` applies smoothing techniques such as:
64+
- Exponential Moving Average (EMA)
65+
- rolling averages
66+
- spike filtering
67+
68+
This improves downstream stability while still preserving meaningful trend changes.
69+
70+
The normalization layer also detects sudden metric spikes separately from sustained behavior changes.
4071

4172
---
4273

43-
## Stage 3: Time-Series Buffering
74+
# Stage 3 Time-Series Buffering
4475

4576
**Module:** `engine/buffer/time_series_buffer.py`
4677

47-
Normalized snapshots are pushed into two ring buffers:
48-
- **Short-window buffer:** Last ~60 seconds, used for trend analysis.
49-
- **Long-window buffer:** Last ~30 minutes, used for baseline learning.
78+
Normalized snapshots are stored in rolling time-series buffers.
79+
80+
SentraCore maintains:
81+
- short-term buffers for real-time analysis
82+
- long-term buffers for behavioral modeling
83+
84+
These buffers provide historical context for:
85+
- trend analysis
86+
- baseline learning
87+
- anomaly detection
88+
- forecasting
5089

5190
---
5291

53-
## Stage 4: Baseline Learning
92+
# Stage 4 Baseline Learning
5493

5594
**Module:** `engine/baseline/baseline_model.py`
5695

57-
The `BaselineModel` learns what is *normal* for the specific machine. It segments the day into four time-of-day windows (Night, Morning, Afternoon, Evening) and maintains a running mean and standard deviation per metric per segment. Static thresholds are never used.
96+
The `BaselineModel` learns what is considered normal for the current machine.
97+
98+
Instead of relying on static thresholds, SentraCore continuously adapts to:
99+
- workload patterns
100+
- hardware capabilities
101+
- time-of-day behavior
102+
- sustained usage characteristics
103+
104+
The baseline model tracks:
105+
- average resource behavior
106+
- deviation ranges
107+
- historical variability
108+
109+
This reduces false positives and improves anomaly accuracy.
58110

59111
---
60112

61-
## Stage 5: Trend Analysis
113+
# Stage 5 Trend Analysis
62114

63115
**Module:** `engine/intelligence/trend_analyzer.py`
64116

65-
The `TrendAnalyzer` performs **linear regression** over the short-window buffer to compute CPU and Memory slope (% change per second) and volatility (short-term standard deviation). A positive, sustained memory slope can indicate a memory leak.
117+
The `TrendAnalyzer` evaluates how system behavior changes over time.
118+
119+
Analysis includes:
120+
- slope calculation
121+
- growth rate estimation
122+
- short-term volatility
123+
- sustained trend direction
124+
125+
Examples:
126+
- continuously rising memory usage
127+
- sustained CPU growth
128+
- increasing disk saturation
129+
130+
Trend analysis provides early indicators of degradation before hard limits are reached.
66131

67132
---
68133

69-
## Stage 6: Anomaly Detection
134+
# Stage 6 Anomaly Detection
70135

71136
**Module:** `engine/intelligence/anomaly_detector.py`
72137

73-
The `AnomalyDetector` calculates a Z-Score for each metric against the active time-of-day baseline:
138+
The `AnomalyDetector` compares current behavior against the learned baseline.
74139

75-
```
76-
Z = (Current Value - Baseline Mean) / Baseline Standard Deviation
77-
```
140+
Detection methods include:
141+
- Z-score deviation analysis
142+
- sustained abnormality detection
143+
- volatility analysis
144+
- multi-metric deviation scoring
145+
146+
SentraCore avoids reacting to isolated spikes by requiring anomalies to persist across multiple cycles before escalation.
78147

79-
Anomalies must be sustained over multiple consecutive cycles before being classified as elevated or severe, preventing transient micro-spikes from generating false alerts.
148+
Anomalies are categorized into severity bands such as:
149+
- normal
150+
- elevated
151+
- high
152+
- severe
80153

81154
---
82155

83-
## Stage 7: Multi-State Stress Engine
156+
# Stage 7 Stress Engine
84157

85158
**Module:** `engine/stress/stress_engine.py`
86159

87-
The `StressEngine` consolidates upstream analysis into a single **Stress Score (0–100)** weighted across three dimensions:
88-
1. Instantaneous resource pressure (CPU, Memory, Disk).
89-
2. Trend modifiers (growing slopes add a forward-looking penalty).
90-
3. Anomaly modifiers (sustained z-score deviations multiply the base pressure).
160+
The `StressEngine` consolidates multiple system signals into a unified stress representation.
161+
162+
Inputs include:
163+
- instantaneous resource pressure
164+
- anomaly severity
165+
- trend acceleration
166+
- sustained instability
167+
168+
The resulting stress score reflects both current pressure and ongoing degradation patterns.
91169

92170
---
93171

94-
## Stage 8: Prediction & Risk Engine
172+
# Stage 8Prediction & Risk Analysis
95173

96174
**Module:** `engine/intelligence/prediction_engine.py`
97175

98-
The `PredictionEngine` uses EMA-smoothed trend slopes to forecast:
99-
- **Time-to-Exhaustion (ETA):** Seconds until Memory hits 98% or CPU hits 95%.
100-
- **Risk Score (0–100%):** Probabilistic assessment of severe degradation within the next 5 minutes.
176+
The `PredictionEngine` estimates future degradation risk using trend-based forecasting.
177+
178+
Forecasting includes:
179+
- memory saturation estimation
180+
- CPU trend projection
181+
- disk pressure forecasting
182+
- time-to-exhaustion (ETA)
183+
184+
The engine also produces a probabilistic degradation risk score representing the likelihood of severe instability within a future time window.
185+
186+
Predictions are probabilistic rather than deterministic.
101187

102188
---
103189

104-
## Stage 9: System Stability Index
190+
# Stage 9System Stability Calculation
105191

106192
**Module:** `engine/intelligence/stability_index.py`
107193

108-
The `StabilityCalculator` synthesises all upstream signals into a **System Stability Index (1–100)**. The index is a weighted composite of:
109-
- **50%** Instantaneous Stress Score
110-
- **30%** Predictive Risk Score
111-
- **20%** Anomaly Score
194+
The `StabilityCalculator` generates the final System Stability Index.
195+
196+
The index combines:
197+
- current stress state
198+
- predictive risk
199+
- anomaly severity
200+
- sustained trend behavior
201+
202+
The resulting score provides a high-level representation of overall system responsiveness and health.
112203

113204
---
114205

115-
## Stage 10: Correlation & Root Cause Analysis
206+
# Stage 10 Correlation & Root Cause Analysis
116207

117208
**Module:** `engine/intelligence/correlation_engine.py`
118209

119-
Invoked lazily only when an alert fires, the `CorrelationEngine` cross-references three data sources:
120-
1. **Bottleneck Identification:** Determines whether CPU, Memory, or Disk is the primary stressor.
121-
2. **Suspect Identification:** Cross-references against the `ProcessTracker` to find the top-impact process.
122-
3. **Trigger Identification:** Cross-references against the `EventLogger` to find the causal system event.
210+
The `CorrelationEngine` attempts to explain why degradation is occurring.
211+
212+
When alerts are triggered, the engine correlates:
213+
- process activity
214+
- resource contention
215+
- event timing
216+
- system pressure changes
217+
218+
The engine identifies:
219+
- likely bottlenecks
220+
- high-impact processes
221+
- correlated system events
222+
223+
Outputs are probability-based explanations rather than absolute causality claims.
224+
225+
---
226+
227+
# Alert Pipeline
228+
229+
**Module:** `engine/alerts/alert_manager.py`
230+
231+
The `AlertManager` evaluates:
232+
- sustained stress conditions
233+
- anomaly escalation
234+
- predictive risk thresholds
235+
236+
When thresholds are exceeded:
237+
- alerts are generated
238+
- root cause summaries are attached
239+
- dashboard notifications are triggered
240+
- events are stored in alert history
241+
242+
---
243+
244+
# Design Principles
245+
246+
The intelligence pipeline is designed around several core principles:
247+
248+
1. Time-Based Understanding
249+
System behavior is analyzed over time rather than through isolated snapshots.
250+
251+
2. Adaptive Modeling
252+
Behavior is evaluated relative to machine-specific baselines.
253+
254+
3. Statistical Interpretation
255+
Signals are interpreted probabilistically rather than through fixed assumptions.
256+
257+
4. Explainability
258+
Outputs prioritize understandable diagnostics instead of opaque scoring.
259+
260+
5. Predictive Awareness
261+
The system estimates future degradation risk before severe instability occurs.
262+
263+
---
264+
265+
# Summary
266+
267+
SentraCore transforms low-level telemetry into layered behavioral intelligence through:
268+
269+
- normalization
270+
- historical modeling
271+
- anomaly detection
272+
- trend analysis
273+
- forecasting
274+
- correlation analysis
275+
- explainable diagnostics
123276

124-
The resulting `RootCauseAnalysis` is attached to the `Alert` and broadcast via WebSocket to the dashboard.
277+
This enables a deeper understanding of system behavior than traditional real-time monitoring alone.

0 commit comments

Comments
 (0)