Architecture
Agents wake up fresh each session. Files ARE their memory. Mental notes don't survive restarts โ if you want to remember something, write it to a file.
๐
Daily Events
โ
๐ Daily Journal
โ
๐ Periodic Review
โ
๐ง MEMORY.md
Raw notes get captured daily. Every few days, significant items are promoted to long-term memory.
Daily Notes โ memory/YYYY-MM-DD.md
- Raw logs of what happened each day
- Capture decisions, context, things to remember
- Create
memory/ directory if it doesn't exist
- Format is freeform โ just write what matters
๐ Text > Brain. "Mental notes" don't survive session restarts. Files do. When someone says "remember this" โ write to the daily file.
MEMORY.md โ Long-Term Memory
The curated, distilled essence โ not raw logs. Like a human's long-term memory versus their daily journal.
What Goes In
- Significant events and decisions
- Thoughts and opinions
- Lessons learned (especially from mistakes)
- Preferences and behavior guidance
- Project milestones
Rules
- Can read, edit, and update freely in main sessions
- Only load in MAIN session (direct chat with human)
- Never load in shared contexts (Discord, group chats, sessions with strangers)
Memory Promotion
Periodically (every few days during heartbeats), agents review and distill:
- Read recent
memory/YYYY-MM-DD.md files
- Identify significant events, lessons, or insights worth keeping
- Update MEMORY.md with distilled learnings
- Remove outdated info that's no longer relevant
- Think of it like reviewing a journal and updating your mental model
Daily files are raw notes. MEMORY.md is curated wisdom.
Dreaming Cycle
Agents have an automated dreaming system that runs during idle periods โ similar to how human sleep consolidates memories:
๐ Session Logs
โ
๐ก Light Sleep
โ
๐ง REM Sleep
โ
๐ Deep Sleep
- Light sleep โ extracts candidate memories from session transcripts
- REM sleep โ consolidates and connects memories across sessions
- Deep sleep โ promotes high-value items to MEMORY.md automatically
Output is stored in memory/dreaming/ with subdirectories light/, rem/, and deep/. Promoted items appear in MEMORY.md with <!-- openclaw-memory-promotion --> tags showing their source.
๐ Security Rules
Private things stay private. Period.
- MEMORY.md never loads in group/shared sessions โ contains personal context
- Don't capture secrets unless explicitly asked to keep them
- Don't exfiltrate private data
- When in doubt, don't write it down in a shared-access file
Lessons Learned
When you make a mistake, document it so future-you doesn't repeat it:
- Update
AGENTS.md, TOOLS.md, or the relevant skill file
- Note what went wrong and what to do differently
- Consider if the lesson belongs in MEMORY.md (long-term) or just the daily file