pub struct PatternDetector { /* private fields */ }Expand description
Pattern detector for triggering memory replay
Monitors incoming memories and detects patterns that should trigger consolidation rather than waiting for fixed intervals.
Implementations§
Source§impl PatternDetector
impl PatternDetector
pub fn new() -> Self
Sourcepub fn register_memory(&mut self, memory: PatternMemory)
pub fn register_memory(&mut self, memory: PatternMemory)
Register a new memory for pattern tracking
Call this when a memory is created to enable pattern detection.
Sourcepub fn detect_patterns(&mut self) -> PatternDetectionResult
pub fn detect_patterns(&mut self) -> PatternDetectionResult
Detect all patterns and return triggers
This is the main entry point for pattern detection. Call periodically (e.g., every 5 minutes) or after significant events.
Sourcepub fn check_salience_spike(
&mut self,
memory: &PatternMemory,
) -> Option<ReplayTrigger>
pub fn check_salience_spike( &mut self, memory: &PatternMemory, ) -> Option<ReplayTrigger>
Check for salience spike (call when storing a new memory)
Returns Some(trigger) if the memory is surprising enough to warrant immediate replay.
Sourcepub fn detect_semantic_clusters(
&mut self,
similarities: &[(String, String, f32)],
) -> Vec<ReplayTrigger>
pub fn detect_semantic_clusters( &mut self, similarities: &[(String, String, f32)], ) -> Vec<ReplayTrigger>
Detect semantic clusters from similarity data
Call this with pre-computed similarity data (from vector search). Returns cluster triggers if dense clusters are found.
Sourcepub fn check_behavioral_change(
&mut self,
new_topic: Option<&str>,
new_project: Option<&str>,
correction_detected: bool,
correction_keywords: &[String],
) -> Option<ReplayTrigger>
pub fn check_behavioral_change( &mut self, new_topic: Option<&str>, new_project: Option<&str>, correction_detected: bool, correction_keywords: &[String], ) -> Option<ReplayTrigger>
Check for behavioral pattern change
Call when user behavior signals are detected (from feedback system).
Sourcepub fn stats(&self) -> PatternDetectorStats
pub fn stats(&self) -> PatternDetectorStats
Get recent pattern detection statistics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PatternDetector
impl RefUnwindSafe for PatternDetector
impl Send for PatternDetector
impl Sync for PatternDetector
impl Unpin for PatternDetector
impl UnsafeUnpin for PatternDetector
impl UnwindSafe for PatternDetector
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more