Skip to main content

CoherenceAccumulator

Struct CoherenceAccumulator 

Source
pub struct CoherenceAccumulator {
    pub value: f32,
    pub interaction_count: u32,
    pub last_interaction_tick: u64,
}
Expand description

Per-context coherence accumulator. Grows through repeated positive interaction, decays with disuse, drops on negative events.

Interaction history builds a protected floor so that earned trust cannot be erased by transient negative events.

Patent Claims 2–5.

Fields§

§value: f32

Accumulated coherence for this context [0.0, 1.0].

§interaction_count: u32

Total positive interactions recorded in this context.

§last_interaction_tick: u64

Tick of the most recent interaction (positive or negative).

Implementations§

Source§

impl CoherenceAccumulator

Source

pub fn new() -> Self

Construct a fresh accumulator starting at zero coherence.

Source

pub fn new_with_baseline(curiosity: f32) -> Self

Cold-start constructor: initialise value from personality curiosity_drive.

curiosity: personality curiosity_drive in [0.0, 1.0]. Baseline = 0.15 × curiosity (max 0.15 for curiosity = 1.0).

Source

pub fn earned_floor(&self) -> f32

The minimum coherence that interaction history protects against decay or negative events.

Asymptotically approaches 0.5 with repeated interactions — never fully immune, but increasingly resilient.

floor = 0.5 × (1 − 1 / (1 + count / 20))
  count =  0 → floor ≈ 0.00
  count = 20 → floor ≈ 0.25
  count = 100 → floor ≈ 0.42
  limit  → 0.50
Source

pub fn positive_interaction( &mut self, recovery_speed: f32, tick: u64, alone: bool, )

Record a positive interaction. Coherence grows asymptotically toward 1.0.

  • recovery_speed: personality parameter [0.0, 1.0] — higher = faster growth.
  • tick: current tick for freshness tracking.
  • alone: true if presence is Absent — doubles delta for faster bootstrap.
Source

pub fn negative_interaction(&mut self, startle_sensitivity: f32, tick: u64)

Record a negative interaction (startle, collision, high tension).

The drop is floored at earned_floor() so that accumulated trust cannot be fully erased by a single negative event.

  • startle_sensitivity: personality parameter [0.0, 1.0] — higher = bigger drop.
  • tick: current tick.
Source

pub fn decay(&mut self, elapsed_ticks: u64)

Apply time-based decay. Call once per elapsed period.

Coherence decays toward earned_floor(), not toward zero. More interactions = higher floor = harder to lose earned trust.

Trait Implementations§

Source§

impl Clone for CoherenceAccumulator

Source§

fn clone(&self) -> CoherenceAccumulator

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CoherenceAccumulator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CoherenceAccumulator

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.