1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//! # Changepoint Detection for Pattern Monitoring
//!
//! Implements changepoint detection using the PELT (Pruned Exact Linear Time) algorithm
//! from the augurs-changepoint crate. This module detects significant changes in
//! pattern metrics over time, enabling adaptive pattern learning.
//!
//! ## Example
//!
//! ```
//! use do_memory_core::patterns::changepoint::{ChangepointDetector, ChangepointConfig};
//!
//! // Create detector with default settings (needs to be mutable for detection)
//! let mut detector = ChangepointDetector::new(ChangepointConfig::default());
//!
//! // Simulate pattern success rate time series
//! let metrics = vec![
//! 0.8, 0.82, 0.81, 0.79, 0.83, // Normal variation
//! 0.45, 0.48, 0.42, 0.44, // Drop (changepoint detected)
//! 0.46, 0.47, 0.45, 0.48, // New baseline
//! ];
//!
//! // Detect changepoints
//! let changepoints = detector.detect_changepoints(&metrics).unwrap();
//! println!("Detected {} changepoints", changepoints.len());
//! ```
//!
//! ## Integration with Monitoring
//!
//! The changepoint detector integrates with the agent monitoring system to:
//! - Detect significant changes in pattern success rates
//! - Identify shifts in task execution metrics
//! - Trigger pattern recalibration when drift is detected
pub use ChangepointDetector;
pub use ;