Skip to main content

MemoryBinding

Trait MemoryBinding 

Source
pub trait MemoryBinding: Send + Sync {
    // Required methods
    fn install(&self, live: Live, memory: &MemorySpec) -> Live;
    fn remember(&self, note: String);

    // Provided methods
    fn task_memory(
        &self,
        _memory: &MemorySpec,
    ) -> Result<Arc<dyn TaskMemoryService>, String> { ... }
    fn task_tools(&self) -> Vec<Arc<dyn ToolFunction>> { ... }
    fn install_task_lifecycle(&self, live: Live) -> Live { ... }
}
Expand description

The seam through which a memory engine plugs into a spec-driven session.

The spec’s memory section is pure data; the engine that honors it lives above this crate (gemini-memory-rs implements this trait over its MemorySession). apply calls install once to wire tools/ingestion/slots, and routes every EffectSpec::Remember through remember for a root conversation. Skills instead bind owned services through task_memory, contextual tools through task_tools, and one shared task lifecycle.

Required Methods§

Source

fn install(&self, live: Live, memory: &MemorySpec) -> Live

Wire the memory subsystem onto the builder per the spec’s declaration.

Source

fn remember(&self, note: String)

Durably remember a note (fire-and-forget; implementations may commit asynchronously).

Provided Methods§

Source

fn task_memory( &self, _memory: &MemorySpec, ) -> Result<Arc<dyn TaskMemoryService>, String>

Bind task-local projections to this session’s existing memory backend. Implementations must not capture a task’s authoritative state.

Source

fn task_tools(&self) -> Vec<Arc<dyn ToolFunction>>

Existing memory operations, bound to owned task invocation contexts. The task compiler supplies their read/commit policy and ambient admission.

Source

fn install_task_lifecycle(&self, live: Live) -> Live

Install shared session teardown once, without global extractors or tools. Serialize teardown with started effects and reject writes after sealing.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§