A detailed look into the memory management system for Siya AI agents, covering short-term and long-term memory, compaction, and retrieval mechanisms.
Figure 1: A high-level overview of the memory architecture
Figure 2: Short Term Memory Construction
episode_id
from the episodic memory.tool
messages with the name Read
and caches their content, path, timestamp, and a readCount
.node_modules
, .git
) are excluded.score = timestamp - (readCount * 1000)
) that prioritizes recency and penalizes redundancy.tool
messages.tool
messagesFigure 3: Long Term Memory Structure
Feature | Per-Turn Update (Chosen Approach) | Post-Compaction Update (Alternative) |
---|---|---|
Memory Freshness | High. Long-term memory is always up-to-date, with only seconds of lag. | Low. Significant memory lag exists between compactions, risking data loss. |
Data Durability | High. A session crash results in the potential loss of only a single turn. 👍 | Low. A crash can wipe out the entire conversational history since the last compaction. |
Architectural Design | Decoupled. Knowledge persistence is separate from context management. | Coupled. Creates an unnecessary dependency between two distinct processes. |
System Overhead | Constant & Low. A continuous stream of small background jobs. | Bursty & High. Long periods of idleness followed by intense processing spikes. |
mcp_memory_search
server, which provides a set of tools for accessing the long-term memory graph. The retrieved information is then provided to the LLM as additional context to inform its next response before proceeding with the user’s task.
mcp_memory_search
server has tools that can be used to perform functions such as:
calculate_tax_liability
function we created.”InventoryItem
schema? What would be affected by a change?”