pub struct MemoryEntry {Show 16 fields
pub id: String,
pub content: String,
pub category: MemoryCategory,
pub confidence: f32,
pub active: bool,
pub tags: Vec<String>,
pub source: String,
pub trust: TrustLevel,
pub linked_ids: Vec<String>,
pub superseded_by: Option<String>,
pub created_at: DateTime<Utc>,
pub accessed_at: DateTime<Utc>,
pub access_count: u32,
pub reinforcement_history: Vec<Reinforcement>,
pub expires_at: Option<DateTime<Utc>>,
pub key: Option<String>,
}Expand description
A scored memory record with confidence, trust, and graph links.
Fields§
§id: String§content: String§category: MemoryCategory§confidence: f32§active: bool§source: String§trust: TrustLevel§linked_ids: Vec<String>§superseded_by: Option<String>§created_at: DateTime<Utc>§accessed_at: DateTime<Utc>§access_count: u32§reinforcement_history: Vec<Reinforcement>§expires_at: Option<DateTime<Utc>>Optional hard expiry. None = never expires. Backward-compatible:
pre-existing stored entries deserialize to None.
key: Option<String>Optional subject key (e.g. pref:reply_language) for deterministic
latest-wins: writing a new entry with the same key supersedes older
active ones. None = unkeyed (no auto-supersession). Backward-compatible.
Implementations§
Source§impl MemoryEntry
impl MemoryEntry
Sourcepub fn new(
id: impl Into<String>,
content: impl Into<String>,
category: MemoryCategory,
source: impl Into<String>,
) -> Self
pub fn new( id: impl Into<String>, content: impl Into<String>, category: MemoryCategory, source: impl Into<String>, ) -> Self
Create a new memory entry with default confidence (0.8) and user trust.
Sourcepub fn with_key(self, key: impl Into<String>) -> Self
pub fn with_key(self, key: impl Into<String>) -> Self
Builder: set the subject key for deterministic latest-wins supersession.
Sourcepub fn with_category(self, category: MemoryCategory) -> Self
pub fn with_category(self, category: MemoryCategory) -> Self
Builder: set the memory category (schema kind).
Sourcepub fn with_trust(self, trust: TrustLevel) -> Self
pub fn with_trust(self, trust: TrustLevel) -> Self
Builder: set the trust level (e.g. User for explicitly pinned memories).
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Whether this entry has passed its hard expiry (if any).
Sourcepub fn effective_confidence(&self) -> f32
pub fn effective_confidence(&self) -> f32
Compute effective confidence with access bonus and age decay.
Sourcepub fn reinforce(&mut self, score: f32, context: &str)
pub fn reinforce(&mut self, score: f32, context: &str)
Append a reinforcement event and adjust base confidence.
Sourcepub fn decay_confidence(&mut self, amount: f32)
pub fn decay_confidence(&mut self, amount: f32)
Decrement base confidence; deactivates the entry if it drops below 0.1.
Trait Implementations§
Source§impl Clone for MemoryEntry
impl Clone for MemoryEntry
Source§fn clone(&self) -> MemoryEntry
fn clone(&self) -> MemoryEntry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more