docs/en/memory/deep-dream.mdx
Deep Dream is the core consolidation mechanism of CowAgent's memory system, responsible for distilling scattered daily memories into refined long-term memory and generating dream diaries.
CowAgent's memory progresses through three stages from short-term to long-term:
Conversation context (short-term) → Daily memory (mid-term) → MEMORY.md (long-term)
When conversation context is trimmed or during the daily scheduled summary, the system uses LLM to summarize conversation content into key events, writing them to the daily memory file memory/YYYY-MM-DD.md.
Triggers:
After the daily summary completes, Deep Dream automatically runs distillation:
MEMORY.md + today's daily memoryMEMORY.md is injected into the system prompt for every conversation, keeping the Agent aware of user preferences, decisions, and key facts. Therefore it must stay concise — Deep Dream targets approximately 30 entries or fewer.
Deep Dream follows these consolidation rules:
| Operation | Description |
|---|---|
| Merge & refine | Combine similar entries into single high-density statements |
| Extract new | Pull preferences, decisions, people, experiences from daily memory |
| Conflict update | When new info contradicts old entries, newer info takes precedence |
| Clean invalid | Remove temporary records, blank entries, formatting artifacts |
| Remove redundancy | Delete old entries already covered by more refined statements |
Each distillation generates a dream diary saved at memory/dreams/YYYY-MM-DD.md, written in a narrative style recording:
Dream diaries can be viewed in the Web console under "Memory → Dream Diary" tab.
<Frame> </Frame>In addition to the automatic daily run, you can manually trigger distillation in chat:
/memory dream [N]
N: Consolidate the last N days of memory (default 3, max 30)| Mechanism | Description |
|---|---|
| Skip on no content | Distillation skipped when no daily memory exists, avoiding empty overwrites |
| Input dedup | In scheduled tasks, automatically skipped when input materials haven't changed |
| Async execution | Distillation runs in a background thread, never blocking conversation |
| Sequential guarantee | In scheduled tasks, daily flush completes before distillation starts |
| No fabrication | Prompt explicitly constrains consolidation to existing materials only |