pub struct BuiltinMemory { /* private fields */ }Implementations§
Source§impl BuiltinMemory
impl BuiltinMemory
Sourcepub fn open(dir: PathBuf, config: MemoryConfig) -> Self
pub fn open(dir: PathBuf, config: MemoryConfig) -> Self
Open (or create) memory storage at the given directory.
Sourcepub fn recall(&self, query: &str) -> String
pub fn recall(&self, query: &str) -> String
Substring search across memory.md, user.md, and facts.toml. Returns matching lines with source labels.
Sourcepub fn write_memory(&self, content: &str) -> String
pub fn write_memory(&self, content: &str) -> String
Append to memory.md, respecting memory_limit.
Sourcepub fn write_user(&self, content: &str) -> String
pub fn write_user(&self, content: &str) -> String
Write to user.md, respecting user_limit. Overwrites existing content.
Sourcepub fn build_prompt(&self) -> String
pub fn build_prompt(&self) -> String
Build XML blocks for system prompt injection.
Sourcepub fn before_run(&self, history: &[Message]) -> Vec<Message>
pub fn before_run(&self, history: &[Message]) -> Vec<Message>
Recall from last user message, return as injected message.
Sourcepub fn after_compact(&self, agent: &str, summary: &str)
pub fn after_compact(&self, agent: &str, summary: &str)
Save a session summary after compaction. Runs synchronously. Spawns facts extraction as a background task.
Sourcepub fn extract_facts(&self, summary: &str)
pub fn extract_facts(&self, summary: &str)
Lightweight facts extraction from a summary string. Looks for “Name: Value”, “Key = Value” patterns and appends to facts.toml.
Auto Trait Implementations§
impl !Freeze for BuiltinMemory
impl RefUnwindSafe for BuiltinMemory
impl Send for BuiltinMemory
impl Sync for BuiltinMemory
impl Unpin for BuiltinMemory
impl UnsafeUnpin for BuiltinMemory
impl UnwindSafe for BuiltinMemory
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