pub struct CortexdbMemory { /* private fields */ }Expand description
A Memory backed by CortexDB’s MCP memory_save / memory_search tools.
Implementations§
Source§impl CortexdbMemory
impl CortexdbMemory
Sourcepub async fn connect_stdio(program: &str, args: &[&str]) -> Result<Self>
pub async fn connect_stdio(program: &str, args: &[&str]) -> Result<Self>
Spawn program args... as CortexDB’s MCP stdio server and adapt it.
(e.g. connect_stdio("cortexdb-mcp-stdio", &[]).)
Sourcepub fn from_client(client: McpClient) -> Result<Self>
pub fn from_client(client: McpClient) -> Result<Self>
Adapt an already-connected CortexDB MCP client.
Sourcepub fn with_scope(self, scope: impl Into<String>) -> Self
pub fn with_scope(self, scope: impl Into<String>) -> Self
CortexDB memory scope: global (default, shared), user, or session.
Sourcepub fn with_namespace(self, ns: impl Into<String>) -> Self
pub fn with_namespace(self, ns: impl Into<String>) -> Self
CortexDB namespace (default harness). Isolates this app’s memories.
Sourcepub fn with_user_id(self, user: impl Into<String>) -> Self
pub fn with_user_id(self, user: impl Into<String>) -> Self
Scope memories to a user id (for scope = user).
Trait Implementations§
Source§impl Memory for CortexdbMemory
impl Memory for CortexdbMemory
Source§fn write<'life0, 'async_trait>(
&'life0 self,
entry: MemoryEntry,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn write<'life0, 'async_trait>(
&'life0 self,
entry: MemoryEntry,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Persist
entry. The backend assigns the id field; callers may
leave it empty. Implementations must be safe to call concurrently
from multiple tasks.Source§fn recall<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn recall<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Return up to
k entries most relevant to query, ordered by
descending relevance. The query is typically the current task
description; backends choose how to score (keyword, embedding, BM25…).
Returning an empty Vec is fine and must not be treated as an error.Auto Trait Implementations§
impl !Freeze for CortexdbMemory
impl !RefUnwindSafe for CortexdbMemory
impl !UnwindSafe for CortexdbMemory
impl Send for CortexdbMemory
impl Sync for CortexdbMemory
impl Unpin for CortexdbMemory
impl UnsafeUnpin for CortexdbMemory
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