Episodic Memory
Episodic memory in Octopus is the agent's ability to remember what happened in past conversations. Each conversation session is stored as an episode — a structured record of messages, tool calls, and metadata — and can be recalled in future sessions to provide continuity.
Human Cognition Analogy
In human cognitive psychology, episodic memory stores autobiographical events — "what happened to me, when, where." Octopus episodic memory is the direct computational analog: each conversation episode records "what the agent and user discussed, when, in which session."
Compare to other Octopus memory types:
| Memory Type | Human Analogy | Octopus Equivalent |
|---|---|---|
| Episodic | "I remember our conversation last Tuesday" | Stored past conversation sessions — SQL |
| Semantic | "I know that Paris is the capital of France" | Embedded knowledge — vector DB |
| Procedural | "I know how to ride a bike" | Stored skill sequences — SQL |
| Working | "What I'm thinking about right now" | Current LLM context window — in-process |
How Episodic Memory Powers Continuity
Without episodic memory, every new conversation starts from zero. With it, the agent can:
- Recognize that a user has asked about a topic before and provide consistent answers
- Reference decisions made in previous sessions ("As we discussed last week...")
- Track ongoing processes across sessions ("Your vendor onboarding was submitted Monday — here's the status")
- Personalize responses based on historical preferences
IEpisodicMemoryStore Interface
public interface IEpisodicMemoryStore
{
// Store a complete episode at session end
Task StoreAsync(Episode episode, CancellationToken ct = default);
// Recall recent episodes for a user+agent pair
Task<IReadOnlyList<Episode>> RecallRecentAsync(
Guid agentId, Guid userId, int limit = 5,
CancellationToken ct = default);
// Semantic search across episodes for relevant past content
Task<IReadOnlyList<EpisodeSnippet>> SearchAsync(
Guid agentId, Guid userId, string query, int topK = 3,
CancellationToken ct = default);
// Query episodes by session ID
Task<Episode?> GetBySessionAsync(Guid sessionId, string tenantId,
CancellationToken ct = default);
}
Episodic Memory in the Reasoning Loop
Before each LLM call, the MemoryOrchestrator invokes episodic memory search to find relevant past context:
User Sends Message
New user message arrives in the conversation.
Episodic Search
IEpisodicMemoryStore.SearchAsync(agentId, userId, userMessage, topK:3) — find the 3 most relevant past episode snippets.
Inject into Context
Relevant episode snippets are formatted as a [Past Conversation Context] block and injected before the user's message.
LLM Responds with Context
The LLM has access to relevant past episodes and can reference them naturally in its response.
Episodic memory requires the SqlServerStorage plugin (for SQL persistence) or a custom IEpisodicMemoryStore implementation. Without a persistent store, episodes are lost on application restart.