Agent memory: persistent key-value state for AI sessions
REMEMBER and RECALL give AI agents a simple key-value memory scoped to a session, backed by Cache-Pot’s hash store with optional TTL.
AI agents need a place to store what they’ve learned during a conversation — the user’s name, their preferences, the last topic discussed — and retrieve it on the next turn without passing the entire history through the context window. Cache-Pot’s REMEMBER and RECALL commands provide session-scoped key-value memory built directly into the store. Because it’s backed by Cache-Pot’s native hash type, you get persistence across restarts, optional TTL-based expiry, and direct hash access — all without any extra infrastructure.
REMEMBER session field value is equivalent to HSET mem:session field value, and RECALL session is equivalent to HGETALL mem:session. You can use hash commands directly on mem:<session> if you need finer control.
Sessions are persistent by default. Use EXPIRE on the underlying mem:<session> key to make a session expire automatically:
REMEMBER user-123 name "Alice"EXPIRE mem:user-123 3600 # entire session expires in 1 hourTTL mem:user-123 # seconds remainingPERSIST mem:user-123 # remove the TTL if you change your mind
Use EXPIRE on a session after every interaction to implement a sliding inactivity timeout — each new REMEMBER call refreshes the window.
Agent memory is also accessible from Cache-Pot’s built-in MCP server. AI frameworks that support the Model Context Protocol can call the remember and recall tools directly — no Redis client required.
MCP Tool
Maps to
Description
remember
REMEMBER session key value
Store a fact in the session namespace.
recall
RECALL session [key]
Retrieve one field or the entire session.
See the MCP integration guide for setup instructions and a full list of available tools.
Use descriptive, collision-resistant session names such as user-<uuid> or conversation-<uuid>. Because all session hashes share the same keyspace under the mem: prefix, a predictable naming scheme prevents one session from accidentally overwriting another.