Skip to main content

DreamStore

Trait DreamStore 

Source
pub trait DreamStore: Send + Sync {
    // Required methods
    fn load_sessions<'life0, 'life1, 'async_trait>(
        &'life0 self,
        agent_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<SessionData>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn load_memories<'life0, 'life1, 'async_trait>(
        &'life0 self,
        agent_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn commit<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        agent_id: &'life1 str,
        result: CurationResult,
        existing: &'life2 [MemoryEntry],
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn search<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        agent_id: &'life1 str,
        query: &'life2 str,
        top_k: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn save_session<'life0, 'async_trait>(
        &'life0 self,
        data: SessionData,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Backing store for the idle dreaming pipeline.

Implementors bridge the kernel’s pure-computation delta to whatever durable storage the application uses (Postgres, SQLite, a vector DB, etc.).

§Contract

commit is always called with the CurationResult produced from the existing slice returned by load_memories in the same cycle. The to_remove_indices inside CurationResult index into that slice, so the implementor must correlate them itself.

Required Methods§

Source

fn load_sessions<'life0, 'life1, 'async_trait>( &'life0 self, agent_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<SessionData>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Load recent sessions for the given agent. The kernel caps processing at IdlePolicy::max_sessions_per_run; returning more is fine.

Source

fn load_memories<'life0, 'life1, 'async_trait>( &'life0 self, agent_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Load all current long-term memory entries for the agent.

Source

fn commit<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, agent_id: &'life1 str, result: CurationResult, existing: &'life2 [MemoryEntry], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Apply the curation delta — add new entries, remove stale ones.

existing is the same slice returned by load_memories in this cycle; it is needed to resolve result.to_remove_indices back to concrete entries.

Source

fn search<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, agent_id: &'life1 str, query: &'life2 str, top_k: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Semantic search over the agent’s long-term memories. Called on demand during a session when the LLM invokes the memory meta-tool.

Source

fn save_session<'life0, 'async_trait>( &'life0 self, data: SessionData, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Persist a completed session for future consolidation via Agent::dream().

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§