Episodic Memory π‘ BETA
Episodic memory summarises older turns into a stored episode when the conversation passes a configured message threshold, keeping recent history intact.
Overview
EpisodicMemoryManager::from_config reads a set of episodic-memory-* keys. should_summarize returns true when memory is enabled, auto-summarisation is on, and the message count has reached the threshold.
Parameter Reference
| Key | Default in code | Effect |
|---|---|---|
episodic-memory-enabled |
true |
Master switch. |
episodic-memory-threshold |
4 |
Message count that triggers a summary. |
episodic-memory-history |
2 |
Recent messages kept in context. |
episodic-memory-model |
fast |
Model selector for the summary call. |
episodic-memory-max-episodes |
100 |
Stored episode ceiling. |
episodic-memory-retention-days |
365 |
Retention window for episodes. |
episodic-memory-auto-summarize |
true |
Enables automatic summarisation. |
How It Works
| Step | Code |
|---|---|
| 1. Count messages in the conversation | should_summarize |
| 2. Build a summary prompt from role/time-stamped lines | generate_summary_prompt |
| 3. Ask the configured LLM for JSON only | summary call |
| 4. Parse summary, topics, decisions, actions, sentiment, resolution | parse_summary_response |
5. Store an Episode with message ids and time bounds |
episode store |
The JSON contract asks for summary, key_topics, decisions, action_items, sentiment and resolution. A malformed response falls back through extract_json to the first brace-delimited object.
Interaction with Caching
Caching and episodic memory are independent: the cache reuses answers, episodic memory compacts history. See Semantic Caching.
Limits
- Summarisation needs a configured LLM; without one the episode cannot be generated.
- Defaults above are code defaults, not a promise that every deployment uses them.
- Parse failures degrade to a default summary ("Conversation summary unavailable") and neutral sentiment.
- Retention is a time window, not a guarantee of immediate deletion.
Related
- Chapter overview - Index of this chapter.
See Also
- Semantic Caching - Response caching system
- Configuration Parameters - Full parameter reference
- LLM Configuration - Model settings