Documentation
¶
Overview ¶
Package aimemory contains the ai-memory config node: a shared conversation-memory definition referenced by ai-agent nodes. History is kept in the host's context store (nodebase.ContextStore — persistent when the host wires a durable backend), keyed by a conversation id resolved from a message property. Retention and a context-window cap bound what is loaded; consolidation/long-term memory is explicitly deferred.
Index ¶
Constants ¶
const Type = "ai-memory"
Type is the registered node type id for the memory config entity.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// KeyProperty is the message property holding the conversation
// id: "msg.x" reads metadata, "payload"/"payload.x" reads the
// payload. Empty or unresolved falls back to "default".
KeyProperty string `json:"keyProperty"`
// MaxMessages caps the stored turns loaded into the prompt
// (oldest dropped first); <= 0 uses the default of 40.
MaxMessages int `json:"maxMessages"`
// RetentionSeconds forgets turns older than the bound;
// <= 0 means no time-based eviction.
RetentionSeconds float64 `json:"retentionSeconds"`
}
Config holds the ai-memory configuration.
func ConfigForNode ¶
func ConfigForNode(node nodestore.NodeInterface) (*Config, error)
ConfigForNode decodes the ai-memory config off a stored node definition — the path ai-agent takes after LookupNode.
func (*Config) ConversationKey ¶
func (c *Config) ConversationKey(input nodestore.MessageInterface) string
ConversationKey resolves the conversation id for a message: the configured property ("msg.x" metadata or a payload path), falling back to "default" when unset or unresolvable.
type MemoryNode ¶
MemoryNode is a config entity; its Execute is never invoked (no ports), existing only to satisfy the NodeExecutor contract.
func NewMemoryNode ¶
func NewMemoryNode(node nodestore.NodeInterface, config *Config) *MemoryNode
NewMemoryNode creates a new ai-memory node.
func (*MemoryNode) Execute ¶
func (n *MemoryNode) Execute(ctx context.Context, input nodestore.MessageInterface) (nodestore.MessageInterface, error)
Execute passes the payload through — unreachable in practice since an ai-memory node has no inputs.
func (*MemoryNode) Validate ¶
func (n *MemoryNode) Validate() error
Validate checks the structural config — every field is optional.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the per-conversation history bound to a context store — ai-agent loads it before the first model call and appends the turns the loop produced.
func OpenStore ¶
OpenStore binds the conversation identified by key on the host's resolved context store. store may be nil — the caller treats memory as disabled then (host without a context seam).