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,
now: DateTime<Utc>,
) -> bool
pub fn is_prunable( &self, entry: &MemoryEntry, threshold: f32, now: DateTime<Utc>, ) -> bool
Check if an entry should be considered for pruning.
An entry is a pruning candidate when:
- its current decay score (recomputed at
now) < threshold - protection is None or Low
- not pinned
- not auto-protected type
The decay is recomputed against now rather than reading the stale
persisted entry.decay_score, so an entry that has crossed the
threshold since the last Dream run is still detected.
Trait Implementations§
Source§impl Clone for DecayEngine
impl Clone for DecayEngine
Source§fn clone(&self) -> DecayEngine
fn clone(&self) -> DecayEngine
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more