Skip to main content

CerememoryEngine

Struct CerememoryEngine 

Source
pub struct CerememoryEngine { /* private fields */ }
Expand description

The main Cerememory engine — orchestrates all CMP operations.

Implementations§

Source§

impl CerememoryEngine

Source

pub fn new(config: EngineConfig) -> Result<Self, CerememoryError>

Create a new engine. Uses in-memory stores when paths are None.

Source

pub fn in_memory() -> Result<Self, CerememoryError>

Create an engine with all in-memory stores (for testing).

Source

pub fn start_background_decay(self: &Arc<Self>)

Start the background decay task. Requires the engine to be wrapped in Arc. No-op if already running or if background_decay_interval_secs is None.

Source

pub async fn stop_background_decay(&self)

Stop the background decay task and wait for it to finish.

Source

pub async fn is_background_decay_enabled(&self) -> bool

Check if background decay is running.

Source

pub fn start_background_dream(self: &Arc<Self>)

Start the background dream task. Requires the engine to be wrapped in Arc. No-op if already running or if background_dream_interval_secs is None.

Source

pub async fn stop_background_dream(&self)

Stop the background dream task and wait for it to finish.

Source

pub async fn is_background_dream_enabled(&self) -> bool

Check if background dream processing is running.

Source

pub async fn rebuild_coordinator(&self) -> Result<(), CerememoryError>

Rebuild the hippocampal coordinator and all indexes from persistent stores. Must be called after construction when opening existing stores.

Source

pub async fn append_raw_journal( &self, record: RawJournalRecord, ) -> Result<Uuid, CerememoryError>

Append a verbatim preserved record to the raw journal.

Source

pub async fn get_raw_journal_record( &self, id: &Uuid, ) -> Result<Option<RawJournalRecord>, CerememoryError>

Retrieve a raw journal record by id.

Source

pub async fn query_raw_journal_by_session( &self, session_id: &str, ) -> Result<Vec<RawJournalRecord>, CerememoryError>

Retrieve all raw journal records for a session in chronological order.

Source

pub async fn query_raw_journal_session_range( &self, session_id: &str, start: DateTime<Utc>, end: DateTime<Utc>, ) -> Result<Vec<RawJournalRecord>, CerememoryError>

Retrieve raw journal records for a session within a time range.

Source

pub async fn raw_journal_count(&self) -> Result<usize, CerememoryError>

Return the number of raw journal records.

Source

pub async fn encode_store_raw( &self, req: EncodeStoreRawRequest, ) -> Result<EncodeStoreRawResponse, CerememoryError>

encode.store_raw — append a raw journal record to the preservation plane.

Source

pub async fn encode_batch_store_raw( &self, req: EncodeBatchStoreRawRequest, ) -> Result<EncodeBatchStoreRawResponse, CerememoryError>

encode.batch_raw — append multiple raw journal records.

Source

pub async fn recall_raw_query( &self, req: RecallRawQueryRequest, ) -> Result<RecallRawQueryResponse, CerememoryError>

recall.raw_query — explicit retrieval from the raw journal.

Source

pub async fn encode_store( &self, req: EncodeStoreRequest, ) -> Result<EncodeStoreResponse, CerememoryError>

encode.store — Store a new memory record (CMP Spec §3.1).

Source

pub async fn encode_batch( &self, req: EncodeBatchRequest, ) -> Result<EncodeBatchResponse, CerememoryError>

encode.batch — Store multiple records (CMP Spec §3.2).

Source

pub async fn encode_update( &self, req: EncodeUpdateRequest, ) -> Result<(), CerememoryError>

encode.update — Update an existing record (CMP Spec §3.3).

Source

pub async fn recall_query( &self, req: RecallQueryRequest, ) -> Result<RecallQueryResponse, CerememoryError>

recall.query — Retrieve memories (CMP Spec §4.1).

Phase 2 recall pipeline:

  1. Text search via Tantivy (if cue.text present)
  2. Vector similarity search (if cue.embedding present)
  3. Hybrid score merging
  4. Temporal range filter
  5. Spreading activation
  6. Reconsolidation + human noise rendering
Source

pub async fn recall_associate( &self, req: RecallAssociateRequest, ) -> Result<RecallAssociateResponse, CerememoryError>

recall.associate — Get associated memories (CMP Spec §4.2).

Source

pub async fn recall_timeline( &self, req: RecallTimelineRequest, ) -> Result<RecallTimelineResponse, CerememoryError>

recall.timeline — Temporal bucketed recall (CMP Spec §4.3, OPTIONAL).

Source

pub async fn recall_graph( &self, req: RecallGraphRequest, ) -> Result<RecallGraphResponse, CerememoryError>

recall.graph — Local graph extraction (CMP Spec §4.4, OPTIONAL).

Source

pub async fn lifecycle_dream_tick( &self, req: DreamTickRequest, ) -> Result<DreamTickResponse, CerememoryError>

lifecycle.dream_tick — summarize unprocessed raw journal entries into episodic summaries.

Source

pub async fn lifecycle_consolidate( &self, req: ConsolidateRequest, ) -> Result<ConsolidateResponse, CerememoryError>

lifecycle.consolidate — Smart Consolidation (CMP Spec §5.1).

Phase 4 enhancements:

  • Duplicate detection: Vector similarity > 0.92 identifies near-duplicates. Higher-fidelity record is kept; associations are merged.
  • LLM summarization: When a provider is configured, related episodic records are summarized into a single semantic node (otherwise, truncation fallback).
  • Relation extraction: LLM extracts semantic relations, stored as associations.
Source

pub async fn lifecycle_decay_tick( &self, req: DecayTickRequest, ) -> Result<DecayTickResponse, CerememoryError>

lifecycle.decay_tick — Advance decay (CMP Spec §5.2).

Source

pub async fn lifecycle_set_mode( &self, req: SetModeRequest, ) -> Result<(), CerememoryError>

lifecycle.set_mode (CMP Spec §5.3).

Source

pub async fn lifecycle_forget( &self, req: ForgetRequest, ) -> Result<u32, CerememoryError>

lifecycle.forget — Delete memory records (CMP Spec §5.4).

Source

pub async fn lifecycle_export( &self, req: ExportRequest, ) -> Result<(Vec<u8>, ExportResponse), CerememoryError>

lifecycle.export — Export records to a CMA archive with optional store filtering and encryption.

Source

pub async fn lifecycle_import( &self, req: ImportRequest, ) -> Result<u32, CerememoryError>

lifecycle.import — Import records from a CMA archive with optional decryption and conflict resolution.

Source

pub async fn import_records(&self, data: &[u8]) -> Result<u32, CerememoryError>

Import records from a serialized CMA archive (convenience method).

Uses KeepExisting conflict resolution (skips duplicates).

Source

pub async fn collect_all_records( &self, ) -> Result<Vec<MemoryRecord>, CerememoryError>

Collect all records for export (used by archive module).

Source

pub async fn collect_records_for_stores( &self, stores: Option<&[StoreType]>, ) -> Result<Vec<MemoryRecord>, CerememoryError>

Collect records from specified stores, or all stores if None.

Source

pub async fn introspect_stats(&self) -> Result<StatsResponse, CerememoryError>

introspect.stats (CMP Spec §6.1).

Source

pub async fn introspect_record( &self, req: RecordIntrospectRequest, ) -> Result<MemoryRecord, CerememoryError>

introspect.record (CMP Spec §6.2).

Source

pub async fn introspect_decay_forecast( &self, req: DecayForecastRequest, ) -> Result<DecayForecastResponse, CerememoryError>

introspect.decay_forecast — Forward-calculate fidelity (CMP Spec §6.3, OPTIONAL).

Source

pub async fn introspect_evolution( &self, ) -> Result<EvolutionMetrics, CerememoryError>

introspect.evolution — Return evolution engine metrics (CMP Spec §6.4, OPTIONAL).

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Sync + Send>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> Fruit for T
where T: Send + Downcast,