MemoryNode API Reference
TheMemoryNode is the fundamental unit of storage in EngramDB. This document provides a detailed reference for the MemoryNode API.
Creating a Memory Node
MemoryNode::new(embeddings)
Creates a new memory node with the given embeddings.
Parameters:
embeddings:Vec<f32>- Vector representation of the memory content
- A new
MemoryNodewith a generated UUID and initialized fields
Basic Properties
id()
Returns the unique identifier of this memory node.
Returns:
Uuid- The unique identifier
embeddings()
Returns a reference to the vector embeddings.
Returns:
&[f32]- Reference to the embeddings vector
set_embeddings(embeddings)
Sets the embeddings to a new value.
Parameters:
embeddings:Vec<f32>- New vector embeddings
creation_timestamp()
Returns the creation timestamp.
Returns:
u64- Unix timestamp when the memory was created
Working with Attributes
attributes()
Returns a reference to all attributes.
Returns:
&HashMap<String, AttributeValue>- Reference to the attributes map
get_attribute(key)
Gets the value of a specific attribute.
Parameters:
key:&str- The attribute key to retrieve
Option<&AttributeValue>- The attribute value, or None if not found
set_attribute(key, value)
Sets an attribute.
Parameters:
key:String- The attribute keyvalue:AttributeValue- The attribute value
Working with Connections
connections()
Returns a reference to all connections.
Returns:
&Vec<Connection>- Reference to the connections vector
add_connection(connection)
Adds a connection to another memory node.
Parameters:
connection:Connection- The connection to add
remove_connection(target_id)
Removes a connection to the specified target.
Parameters:
target_id:Uuid- The ID of the target memory node
bool- True if a connection was removed, false otherwise
Working with Temporal Layers
temporal_layers()
Returns a reference to all temporal layers.
Returns:
&Vec<TemporalLayer>- Reference to the temporal layers vector
add_temporal_layer(layer)
Adds a temporal layer to track changes to this memory.
Parameters:
layer:TemporalLayer- The temporal layer to add
Access Patterns
access_patterns()
Returns a reference to the access patterns.
Returns:
&AccessHistory- Reference to the access history
record_access()
Records an access to this memory node.
Example:
AttributeValue Types
TheAttributeValue enum represents different types of values that can be stored as attributes:

