Skip to main content

MemCube

Struct MemCube 

Source
pub struct MemCube {
Show 15 fields pub id: String, pub tier: MemoryTier, pub kind: CognitionKind, pub content: String, pub source: String, pub importance: f32, pub confidence: f32, pub decay_rate: f32, pub caused_by: Vec<String>, pub leads_to: Vec<String>, pub evidence_for: Vec<String>, pub created_at: u64, pub last_accessed: u64, pub access_count: u32, pub session_id: Option<String>,
}
Expand description

A MemCube is the fundamental unit of cognitive memory.

Each MemCube carries natural-language content, cognition metadata, importance/confidence scores, causal links, and lifecycle state. MemCubes are storage-agnostic — they can be persisted in Lance, redb, or plain files.

Fields§

§id: String

Unique identifier (typically a ULID).

§tier: MemoryTier

Memory tier classification.

§kind: CognitionKind

Cognition phase that produced this memory.

§content: String

Natural language content of the memory.

§source: String

Source identifier (e.g., “filesystem”, “lance”, “session:XYZ”).

§importance: f32

Importance score (0.0 to 1.0), updated by access patterns.

§confidence: f32

Confidence score (0.0 to 1.0), how certain the information is.

§decay_rate: f32

Decay rate — how fast relevance fades without access.

§caused_by: Vec<String>

IDs of memories that caused this one.

§leads_to: Vec<String>

IDs of memories this one led to.

§evidence_for: Vec<String>

IDs of decisions this memory serves as evidence for.

§created_at: u64

Creation timestamp (microseconds since epoch).

§last_accessed: u64

Last access timestamp (microseconds since epoch).

§access_count: u32

Number of times this memory has been accessed.

§session_id: Option<String>

Session that created this memory (if applicable).

Implementations§

Source§

impl MemCube

Source

pub fn new( tier: MemoryTier, kind: CognitionKind, content: impl Into<String>, source: impl Into<String>, ) -> Self

Create a new MemCube with sensible defaults.

Source

pub fn relevance(&self) -> f32

Compute current relevance factoring importance and time decay.

Returns a value in [0, 1] representing how relevant this memory is right now, combining its importance with exponential time decay.

Source

pub fn touch(&mut self)

Record an access, updating last_accessed and access_count.

Trait Implementations§

Source§

impl Clone for MemCube

Source§

fn clone(&self) -> MemCube

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 MemCube

Source§

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

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

impl<'de> Deserialize<'de> for MemCube

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for MemCube

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,