pub trait MemoryProvider: Send + Sync {
// Required methods
fn system_prompt_block(
&self,
request: &SystemPromptRequest,
) -> Result<SystemPromptResponse>;
fn prefetch<'life0, 'async_trait>(
&'life0 self,
request: PrefetchRequest,
) -> Pin<Box<dyn Future<Output = Result<PrefetchResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn sync_turn<'life0, 'async_trait>(
&'life0 self,
request: SyncTurnRequest,
) -> Pin<Box<dyn Future<Output = Result<SyncTurnResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn on_session_end<'life0, 'async_trait>(
&'life0 self,
request: SessionEndRequest,
) -> Pin<Box<dyn Future<Output = Result<SessionEndResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Isolation layer between Agent-Diva and any long-memory backend.
Contract rules:
system_prompt_block()is synchronous because prompt assembly inContextBuilder::build_system_prompt()is synchronous today.prefetch(),sync_turn(), andon_session_end()are async because live-turn recall, post-turn persistence, and shutdown rhythm work may require I/O and already sit on async paths in Agent-Diva.- All request/response types are Agent-Diva-owned domain structs; do not leak MCP schemas, CLI arguments, HTTP routes, or backend model types.
Required Methods§
Sourcefn system_prompt_block(
&self,
request: &SystemPromptRequest,
) -> Result<SystemPromptResponse>
fn system_prompt_block( &self, request: &SystemPromptRequest, ) -> Result<SystemPromptResponse>
Build the startup memory block for system prompt assembly.
Sourcefn prefetch<'life0, 'async_trait>(
&'life0 self,
request: PrefetchRequest,
) -> Pin<Box<dyn Future<Output = Result<PrefetchResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn prefetch<'life0, 'async_trait>(
&'life0 self,
request: PrefetchRequest,
) -> Pin<Box<dyn Future<Output = Result<PrefetchResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Perform optional intent-aware prefetch for a live turn.
Sourcefn sync_turn<'life0, 'async_trait>(
&'life0 self,
request: SyncTurnRequest,
) -> Pin<Box<dyn Future<Output = Result<SyncTurnResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn sync_turn<'life0, 'async_trait>(
&'life0 self,
request: SyncTurnRequest,
) -> Pin<Box<dyn Future<Output = Result<SyncTurnResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Persist evidence after a successful turn completes.
Sourcefn on_session_end<'life0, 'async_trait>(
&'life0 self,
request: SessionEndRequest,
) -> Pin<Box<dyn Future<Output = Result<SessionEndResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_session_end<'life0, 'async_trait>(
&'life0 self,
request: SessionEndRequest,
) -> Pin<Box<dyn Future<Output = Result<SessionEndResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Trigger shutdown/session-end rhythm work if needed.