pub struct MemoryManager { /* private fields */ }Implementations§
Source§impl MemoryManager
impl MemoryManager
Sourcepub fn new(config: &MemoryConfig) -> Result<Self>
pub fn new(config: &MemoryConfig) -> Result<Self>
Create a new MemoryManager with the default agent ID (“main”)
Sourcepub fn new_with_agent(config: &MemoryConfig, agent_id: &str) -> Result<Self>
pub fn new_with_agent(config: &MemoryConfig, agent_id: &str) -> Result<Self>
Create a new MemoryManager for a specific agent ID (OpenClaw-compatible)
Sourcepub fn new_with_full_config(
memory_config: &MemoryConfig,
app_config: Option<&Config>,
agent_id: &str,
) -> Result<Self>
pub fn new_with_full_config( memory_config: &MemoryConfig, app_config: Option<&Config>, agent_id: &str, ) -> Result<Self>
Create a new MemoryManager with full config (for OpenAI embedding provider)
Sourcepub fn with_embedding_provider(
self,
provider: Arc<dyn EmbeddingProvider>,
) -> Self
pub fn with_embedding_provider( self, provider: Arc<dyn EmbeddingProvider>, ) -> Self
Set embedding provider for semantic search (requires OpenAI API key)
Sourcepub fn has_embeddings(&self) -> bool
pub fn has_embeddings(&self) -> bool
Check if semantic search is available
pub fn workspace(&self) -> &PathBuf
Sourcepub fn db_path(&self) -> &PathBuf
pub fn db_path(&self) -> &PathBuf
Get the path to the SQLite database used by this memory manager.
Sourcepub fn backend(&self) -> &dyn MemoryBackend
pub fn backend(&self) -> &dyn MemoryBackend
Get a reference to the active memory backend.
Sourcepub fn read_memory_file(&self) -> Result<String>
pub fn read_memory_file(&self) -> Result<String>
Read the main MEMORY.md file
Sourcepub fn read_heartbeat_file(&self) -> Result<String>
pub fn read_heartbeat_file(&self) -> Result<String>
Read the HEARTBEAT.md file
Sourcepub fn read_soul_file(&self) -> Result<String>
pub fn read_soul_file(&self) -> Result<String>
Read the SOUL.md file (persona/tone guidance)
Sourcepub fn read_user_file(&self) -> Result<String>
pub fn read_user_file(&self) -> Result<String>
Read the USER.md file (OpenClaw-compatible: user info)
Sourcepub fn read_identity_file(&self) -> Result<String>
pub fn read_identity_file(&self) -> Result<String>
Read the IDENTITY.md file (OpenClaw-compatible: agent identity context)
Sourcepub fn read_agents_file(&self) -> Result<String>
pub fn read_agents_file(&self) -> Result<String>
Read the AGENTS.md file (OpenClaw-compatible: list of agents)
Sourcepub fn is_brand_new(&self) -> bool
pub fn is_brand_new(&self) -> bool
Check if this is a brand new workspace (first run)
Sourcepub fn read_tools_file(&self) -> Result<String>
pub fn read_tools_file(&self) -> Result<String>
Read the TOOLS.md file (OpenClaw-compatible: local tool notes)
Sourcepub fn read_recent_daily_logs(&self, days: usize) -> Result<String>
pub fn read_recent_daily_logs(&self, days: usize) -> Result<String>
Read recent daily log files
Sourcepub fn search(&self, query: &str, limit: usize) -> Result<Vec<MemoryChunk>>
pub fn search(&self, query: &str, limit: usize) -> Result<Vec<MemoryChunk>>
Search memory using hybrid search (FTS + semantic if available)
Sourcepub fn search_fts(&self, query: &str, limit: usize) -> Result<Vec<MemoryChunk>>
pub fn search_fts(&self, query: &str, limit: usize) -> Result<Vec<MemoryChunk>>
Search memory using FTS only (faster, no API calls)
Sourcepub fn chunk_count(&self) -> Result<usize>
pub fn chunk_count(&self) -> Result<usize>
Get total chunk count
Sourcepub fn reindex(&self, force: bool) -> Result<ReindexStats>
pub fn reindex(&self, force: bool) -> Result<ReindexStats>
Reindex all memory files
Sourcepub fn stats(&self) -> Result<MemoryStats>
pub fn stats(&self) -> Result<MemoryStats>
Get memory statistics
Sourcepub fn recent_entries(&self, count: usize) -> Result<Vec<RecentEntry>>
pub fn recent_entries(&self, count: usize) -> Result<Vec<RecentEntry>>
Get recent memory entries
Sourcepub fn start_watcher(&self) -> Result<MemoryWatcher>
pub fn start_watcher(&self) -> Result<MemoryWatcher>
Start file watcher for automatic reindexing.
The file watcher is only supported with the SQLite backend because
it creates its own MemoryIndex connection for the background thread.
Sourcepub async fn generate_embeddings(
&self,
batch_size: usize,
) -> Result<(usize, usize)>
pub async fn generate_embeddings( &self, batch_size: usize, ) -> Result<(usize, usize)>
Generate embeddings for chunks that don’t have them Returns (chunks_processed, chunks_embedded) Uses embedding cache to avoid regenerating identical content
Sourcepub fn embedded_chunk_count(&self) -> Result<usize>
pub fn embedded_chunk_count(&self) -> Result<usize>
Get count of chunks with embeddings
Trait Implementations§
Source§impl Clone for MemoryManager
impl Clone for MemoryManager
Source§fn clone(&self) -> MemoryManager
fn clone(&self) -> MemoryManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for MemoryManager
impl !RefUnwindSafe for MemoryManager
impl Send for MemoryManager
impl Sync for MemoryManager
impl Unpin for MemoryManager
impl UnsafeUnpin for MemoryManager
impl !UnwindSafe for MemoryManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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