pub struct DecayEngine {
pub multiplier: f32,
}Expand description
Decay engine — computes current retention scores for memory entries.
Uses an Ebbinghaus-inspired forgetting curve with adjustments for:
- Memory type (UserProfile decays slower than Conversation)
- Protection level (Higher protection = slower decay)
- Access frequency (Frequently accessed = slower decay)
- Global multiplier (user-configurable)
Fields§
§multiplier: f32Global decay multiplier. 1.0 = default speed.
Implementations§
Source§impl DecayEngine
impl DecayEngine
Sourcepub fn default_engine() -> Self
pub fn default_engine() -> Self
Create with default multiplier (1.0).
Sourcepub fn compute_decay(&self, entry: &MemoryEntry, now: DateTime<Utc>) -> f32
pub fn compute_decay(&self, entry: &MemoryEntry, now: DateTime<Utc>) -> f32
Compute current decay score for an entry.
Returns a value between 0.0 (fully decayed) and 1.0 (fresh). Permanent protection always returns 1.0.
Sourcepub fn effective_importance(entry: &MemoryEntry) -> f32
pub fn effective_importance(entry: &MemoryEntry) -> f32
Compute effective importance of a memory entry.
Effective importance = base_importance × (1 + ln(1 + access_count)) × decay_score.
Sourcepub fn is_prunable(&self, entry: &MemoryEntry, threshold: f32) -> bool
pub fn is_prunable(&self, entry: &MemoryEntry, threshold: f32) -> bool
Check if an entry should be considered for pruning.
An entry is a pruning candidate when:
- decay_score < threshold
- protection is None or Low
- not pinned
- not auto-protected type
Trait Implementations§
Source§impl Clone for DecayEngine
impl Clone for DecayEngine
Source§fn clone(&self) -> DecayEngine
fn clone(&self) -> DecayEngine
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DecayEngine
impl RefUnwindSafe for DecayEngine
impl Send for DecayEngine
impl Sync for DecayEngine
impl Unpin for DecayEngine
impl UnsafeUnpin for DecayEngine
impl UnwindSafe for DecayEngine
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
Mutably borrows from an owned value. Read more