Memory Flow
CowAgent’s memory progresses through three stages from short-term to long-term:1. Conversation → Daily Memory
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 filememory/YYYY-MM-DD.md.
Triggers:
- Context trimming — Trimmed content is summarized when turn or token limits are exceeded
- Daily schedule — Automatically triggered at 23:55
- API overflow — Emergency save of current conversation summary
2. Daily Memory → MEMORY.md (Distillation)
After the daily summary completes, Deep Dream automatically runs distillation:- Read materials — Current
MEMORY.md+ today’s daily memory - LLM distillation — Deduplicate, merge, prune, extract new information
- Overwrite MEMORY.md — Output the refined long-term memory
- Generate dream diary — Record discoveries and insights from the consolidation
3. Role of MEMORY.md
MEMORY.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.
Distillation Rules
Deep Dream follows these consolidation rules:Dream Diary
Each distillation generates a dream diary saved atmemory/dreams/YYYY-MM-DD.md, written in a narrative style recording:
- Duplications or contradictions found
- New insights extracted from daily memory
- Cleanups and optimizations performed
- Overall observations

Manual Trigger
In addition to the automatic daily run, you can manually trigger distillation in chat:N: Consolidate the last N days of memory (default 3, max 30)- Runs asynchronously in the background; you’ll be notified in chat when complete
- Web notifications include clickable links to view MEMORY.md and dream diary
- Works without Agent initialization — can be used before the first conversation
Config Toggle
Control the nightly automatic distillation viadeep_dream_enabled in config.json:
Enabled by default to keep existing behavior. When disabled, the nightly distillation no longer runs — useful if you prefer to maintain MEMORY.md manually or want to save an LLM call (daily memory summarization is not affected). The manual
/memory dream command is also unaffected and can still be triggered anytime.
