pub struct Memory { /* private fields */ }Implementations§
Source§impl Memory
impl Memory
Sourcepub fn open(
dir: PathBuf,
config: MemoryConfig,
storage: Box<dyn Storage>,
) -> Self
pub fn open( dir: PathBuf, config: MemoryConfig, storage: Box<dyn Storage>, ) -> Self
Open (or create) memory storage at the given directory.
config_dir is the parent config directory where Walrus.md lives.
dir is the memory-specific subdirectory ({config_dir}/memory/).
Sourcepub fn remember(
&self,
name: String,
description: String,
content: String,
) -> String
pub fn remember( &self, name: String, description: String, content: String, ) -> String
Create or update a memory entry.
Sourcepub fn write_index(&self, content: &str) -> String
pub fn write_index(&self, content: &str) -> String
Overwrite MEMORY.md (the curated overview).
Sourcepub fn write_soul(&self, content: &str) -> String
pub fn write_soul(&self, content: &str) -> String
Overwrite Walrus.md (the soul/identity file). Gated by soul_editable.
Sourcepub fn build_soul(&self) -> String
pub fn build_soul(&self) -> String
Return the soul content for system prompt injection.
Sourcepub fn build_prompt(&self) -> String
pub fn build_prompt(&self) -> String
Build system prompt block from MEMORY.md content.
Sourcepub fn before_run(&self, history: &[Message]) -> Vec<Message>
pub fn before_run(&self, history: &[Message]) -> Vec<Message>
Auto-recall from last user message, injected before each turn.
Sourcepub fn after_compact(&self, agent: &str, summary: &str)
pub fn after_compact(&self, agent: &str, summary: &str)
Save a session summary after compaction.
Auto Trait Implementations§
impl !Freeze for Memory
impl !RefUnwindSafe for Memory
impl Send for Memory
impl Sync for Memory
impl Unpin for Memory
impl UnsafeUnpin for Memory
impl !UnwindSafe for Memory
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
Mutably borrows from an owned value. Read more