pub struct ContextOptimizer { /* private fields */ }Expand description
Optimizes context assembly with temporal decay and insights-first priority.
Implements FR-020: decayed importance formula with configurable half-life and reinforcement boost. Context is assembled in priority order:
- Insights (consolidated knowledge from clusters)
- High-importance experiences (after decay)
- Recent experiences (by timestamp)
Implementations§
Source§impl ContextOptimizer
impl ContextOptimizer
Sourcepub fn new(config: ContextOptimizerConfig) -> Self
pub fn new(config: ContextOptimizerConfig) -> Self
Create with the given configuration.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create with default configuration.
Sourcepub fn config(&self) -> &ContextOptimizerConfig
pub fn config(&self) -> &ContextOptimizerConfig
Access the configuration.
Sourcepub fn compute_decayed_importance(
&self,
experience: &Experience,
now: Timestamp,
) -> f32
pub fn compute_decayed_importance( &self, experience: &Experience, now: Timestamp, ) -> f32
Compute decayed importance for an experience.
Formula (FR-020):
importance * 0.5^(elapsed_hours / half_life) * (1 + applications * reinforcement_boost)
Sourcepub fn assemble_prioritized(
&self,
experiences: Vec<Experience>,
insights: Vec<DerivedInsight>,
activities: Vec<Activity>,
budget: &ContextBudget,
now: Timestamp,
) -> Vec<Message>
pub fn assemble_prioritized( &self, experiences: Vec<Experience>, insights: Vec<DerivedInsight>, activities: Vec<Activity>, budget: &ContextBudget, now: Timestamp, ) -> Vec<Message>
Assemble context with insights-first priority ordering.
Priority: insights > high-importance experiences > recent. Packs within the given budget and formats as intrinsic knowledge.
Auto Trait Implementations§
impl Freeze for ContextOptimizer
impl RefUnwindSafe for ContextOptimizer
impl Send for ContextOptimizer
impl Sync for ContextOptimizer
impl Unpin for ContextOptimizer
impl UnsafeUnpin for ContextOptimizer
impl UnwindSafe for ContextOptimizer
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
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>
Converts
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>
Converts
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