pub struct Drawer {Show 14 fields
pub id: String,
pub content: String,
pub wing: String,
pub room: String,
pub source_file: String,
pub chunk_index: u32,
pub filed_at: DateTime<Utc>,
pub confidence: f32,
pub access_count: u32,
pub accessed_at: Option<DateTime<Utc>>,
pub linked_ids: Vec<String>,
pub superseded_by: Option<String>,
pub reinforcements: Vec<Reinforcement>,
pub active: bool,
}Expand description
A verbatim chunk of content stored in the palace. Enhanced with confidence scoring, graph links, and supersession tracking.
Fields§
§id: String§content: String§wing: String§room: String§source_file: String§chunk_index: u32§filed_at: DateTime<Utc>§confidence: f32Base confidence (0.0 - 1.0). Defaults to 0.7.
access_count: u32Number of times this drawer was accessed/retrieved.
accessed_at: Option<DateTime<Utc>>Last time this drawer was accessed.
linked_ids: Vec<String>Linked drawer IDs (graph edges).
superseded_by: Option<String>If superseded by a newer drawer, this points to it.
reinforcements: Vec<Reinforcement>Reinforcement history.
active: boolWhether this drawer is still active (not superseded).
Implementations§
Source§impl Drawer
impl Drawer
Sourcepub fn new(
id: String,
content: String,
wing: String,
room: String,
source_file: String,
chunk_index: u32,
) -> Self
pub fn new( id: String, content: String, wing: String, room: String, source_file: String, chunk_index: u32, ) -> Self
Create a new drawer with default v2 fields.
Sourcepub fn effective_confidence(&self) -> f32
pub fn effective_confidence(&self) -> f32
Compute effective confidence based on access history, age, and reinforcements.
Formula: effective = base_confidence + access_boost (ln(access_count) * 0.05) - age_decay (min(age_days/365, 0.3)) + reinforcement_adjustment clamped to [0.0, 1.0]
Sourcepub fn reinforce(&mut self, score: f32, context: impl Into<String>)
pub fn reinforce(&mut self, score: f32, context: impl Into<String>)
Record a reinforcement event (positive or negative).
Sourcepub fn decay_confidence(&mut self, amount: f32)
pub fn decay_confidence(&mut self, amount: f32)
Decrement base confidence.