pub struct GraphMemory { /* private fields */ }Expand description
High-level graph memory API - the main entry point for AINL memory.
Wraps a GraphStore implementation with a simplified 5-method API.
Implementations§
Source§impl GraphMemory
impl GraphMemory
Sourcepub fn new(db_path: &Path) -> Result<Self, String>
pub fn new(db_path: &Path) -> Result<Self, String>
Create a new graph memory at the given database path.
This will create the database file if it doesn’t exist, and ensure the AINL graph schema is initialized.
Sourcepub fn from_connection(conn: Connection) -> Result<Self, String>
pub fn from_connection(conn: Connection) -> Result<Self, String>
Create from an existing SQLite connection (for integration with existing memory pools)
Sourcepub fn write_episode(
&self,
tool_calls: Vec<String>,
delegation_to: Option<String>,
trace_event: Option<Value>,
) -> Result<Uuid, String>
pub fn write_episode( &self, tool_calls: Vec<String>, delegation_to: Option<String>, trace_event: Option<Value>, ) -> Result<Uuid, String>
Sourcepub fn write_fact(
&self,
fact: String,
confidence: f32,
source_turn_id: Uuid,
) -> Result<Uuid, String>
pub fn write_fact( &self, fact: String, confidence: f32, source_turn_id: Uuid, ) -> Result<Uuid, String>
Sourcepub fn store_pattern(
&self,
pattern_name: String,
compiled_graph: Vec<u8>,
) -> Result<Uuid, String>
pub fn store_pattern( &self, pattern_name: String, compiled_graph: Vec<u8>, ) -> Result<Uuid, String>
Sourcepub fn write_procedural(
&self,
pattern_name: &str,
tool_sequence: Vec<String>,
confidence: f32,
) -> Result<Uuid, String>
pub fn write_procedural( &self, pattern_name: &str, tool_sequence: Vec<String>, confidence: f32, ) -> Result<Uuid, String>
Store a procedural pattern derived from a live tool sequence (heuristic extraction).
Sourcepub fn write_edge(
&self,
source: Uuid,
target: Uuid,
rel: &str,
) -> Result<(), String>
pub fn write_edge( &self, source: Uuid, target: Uuid, rel: &str, ) -> Result<(), String>
Write a graph edge between nodes (e.g. episode timeline follows).
Sourcepub fn recall_recent(
&self,
seconds_ago: i64,
) -> Result<Vec<AinlMemoryNode>, String>
pub fn recall_recent( &self, seconds_ago: i64, ) -> Result<Vec<AinlMemoryNode>, String>
Sourcepub fn recall_by_type(
&self,
kind: AinlNodeKind,
seconds_ago: i64,
) -> Result<Vec<AinlMemoryNode>, String>
pub fn recall_by_type( &self, kind: AinlNodeKind, seconds_ago: i64, ) -> Result<Vec<AinlMemoryNode>, String>
Recall nodes of a specific kind written in the last seconds_ago seconds.
Sourcepub fn write_persona(
&self,
trait_name: &str,
strength: f32,
learned_from: Vec<Uuid>,
) -> Result<Uuid, String>
pub fn write_persona( &self, trait_name: &str, strength: f32, learned_from: Vec<Uuid>, ) -> Result<Uuid, String>
Write a persona trait node.
Sourcepub fn store(&self) -> &dyn GraphStore
pub fn store(&self) -> &dyn GraphStore
Get direct access to the underlying store for advanced queries
Sourcepub fn write_node(&self, node: &AinlMemoryNode) -> Result<(), String>
pub fn write_node(&self, node: &AinlMemoryNode) -> Result<(), String>
Write a fully constructed node (additive API for callers that set extended metadata).