pub struct DeriveContext {
pub source_age_days: f64,
pub atom_derivation: bool,
pub prior_corroboration_count: i64,
pub baseline_per_source: f64,
pub half_life_days: f64,
}Expand description
Context the [derive] engine consults at the moment it computes a
fresh confidence value.
Pulled out of the Memory payload because three of the five signals
require substrate-side queries (prior_corroboration_count is a
COUNT(*) over memory_links, baseline_per_source is a lookup in
the calibration table, half_life_days honours the per-namespace
policy override) and the [derive] surface keeps the caller in
charge of those substrate touches so this module stays pure.
Fields§
§source_age_days: f64How long ago (in days) the cited source body was first observed.
Drives the freshness_factor exponent. The caller computes this
from metadata.observed_at (Form 4) or the row’s created_at
as a fallback. Negative values are clamped to 0.0.
atom_derivation: boolWhether the row is an atom of an existing memory
(atom_of IS NOT NULL). Atom rows inherit a +0.1 confidence
bump because their provenance is anchored to a curator-validated
parent.
prior_corroboration_count: i64Count of memory_links with this row as source_id. More
corroboration → higher confidence; the formula uses
log10(1 + count) to keep the bump sub-linear.
baseline_per_source: f64Per-(namespace, source) baseline from the calibration table.
Pass 0.5 when no calibrated baseline exists yet.
half_life_days: f64Half-life (in days) used in the freshness decay computation.
Defaults to 30 when the operator hasn’t overridden the value
via namespace policy. Capped at f64::EPSILON from below so
the divisor in decay::decayed never goes to zero.
Trait Implementations§
Source§impl Clone for DeriveContext
impl Clone for DeriveContext
Source§fn clone(&self) -> DeriveContext
fn clone(&self) -> DeriveContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DeriveContext
Source§impl Debug for DeriveContext
impl Debug for DeriveContext
Auto Trait Implementations§
impl Freeze for DeriveContext
impl RefUnwindSafe for DeriveContext
impl Send for DeriveContext
impl Sync for DeriveContext
impl Unpin for DeriveContext
impl UnsafeUnpin for DeriveContext
impl UnwindSafe for DeriveContext
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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>
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>
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