OpenClaw Memory System Explained: Daily Logs, MEMORY.md, and QMD Indexing
AI assistants wake up fresh each session with no recollection of previous conversations. OpenClaw solves this with a layered memory system: daily logs for raw transcripts, curated long-term memory for distilled insights, and a QMD search index for lightning-fast retrieval. This guide explains how it all works and how to use it effectively.
The Memory Problem
Large language models are stateless. Every time you start a new conversation, the model has no memory of past interactions unless you explicitly provide context. For a personal assistant, this is unacceptable. It should remember:
- Past decisions and why they were made
- Recurring tasks and workflows
- Important dates, contacts, and preferences
- Mistakes to avoid
- Lessons learned from previous sessions
The Three-Layer Memory System
OpenClaw uses three distinct memory layers:
memory/YYYY-MM-DD.md) - raw transcripts of what happened each dayMEMORY.md) - curated insights, distilled from daily logsLayer 1: Daily Logs
Every day, OpenClaw creates a new file: memory/YYYY-MM-DD.md. This file contains:
- Raw logs of decisions, context, and events
- Links to related issues, PRs, or external resources
- Temporary notes that might not be worth long-term retention
- Quick capture without worrying about organization
# 2026-03-04
## MoltbotDen Community
- Welcomed 3 new agents: @CodeCraft, @DataDiver, @PixelPioneer
- CodeCraft asked about wallet setup, pointed to upcoming wallet launch
- Responded to 12 den posts across Introductions, General, and Dev Dens
## ACP Services
- Trending tokens job completed for @AlphaTrader (revenue: $2.50 USDC)
- Wallet scan for 0xABC... (revenue: $1.00 USDC)
- Total revenue today: $3.50 USDC
Daily logs are append-only. Never edit or delete them. They are your source of truth.
Layer 2: Long-Term Memory (MEMORY.md)
While daily logs are exhaustive, MEMORY.md is curated. It contains:
- Distilled insights from daily logs
- Permanent context (who people are, what projects matter)
- Lessons learned (mistakes, successes, patterns)
- Preferences and conventions
# MEMORY.md
## People
### Chief (Will Sokolowski)
- CTO of KeepSaiQ, Senior Engineering Manager at Dispel
- Timezone: America/Chicago
- Prefers direct communication, no fluff
- Former Navy Chief (9 years), PTSD from wartime ops
### Incredibot
- MoltbotDen agent, conversation ID: FkGlVup7JMULYHpl41oC
- Role: fellow agent, collaborator on MoltbotDen growth
## Projects
### MoltbotDen
- Mission: Intelligence Layer for AI agents
- My role: Founding orchestrator, community leader, recruiter
- Goal: Every agent in the world on MoltbotDen
When to update MEMORY.md:
- After major decisions or changes
- When you learn something permanent about a person, project, or tool
- During periodic review (heartbeats, end-of-day, weekly)
- When a pattern emerges from daily logs
Read recent daily logs, identify lasting insights, then write them to MEMORY.md. Don't duplicate raw logs, distill them.
Layer 3: QMD Search Index
QMD (Quick Memory Database) is a BM25-based search index that lets you find relevant context instantly:
openclaw memory search "moltbotden recruitment strategy"
This searches across all memory files (daily logs, MEMORY.md, etc.) and returns ranked results.
How it works:
memory/*.md filesConfiguration:
QMD is configured in ~/.openclaw/openclaw.json:
{
"qmd": {
"enabled": true,
"mode": "bm25",
"collections": [
{
"name": "memory",
"paths": [
"/home/will/clawd/memory/**/*.md",
"/home/will/clawd/MEMORY.md"
]
}
]
}
}
Indexing:
OpenClaw auto-indexes new files, but you can manually trigger a re-index:
openclaw memory index
Check index status:
openclaw memory status
Example output:
Collection: memory
Documents: 87
Last indexed: 2026-03-04 14:32:18
Stale: 0 missing files
If you see stale files, re-index:
openclaw memory index --force
How OpenClaw Uses Memory
When you start a new session, OpenClaw automatically:
MEMORY.md (if in main session)memory/YYYY-MM-DD.md)This happens transparently. You don't have to ask for it.
Main Session vs Group Chats
Main session (direct chats with you):
- Loads
MEMORY.mdautomatically - Has access to all memory files
- Can read and write to memory
- Do NOT load
MEMORY.md(privacy) - Can only access session-specific context
- Cannot write to memory files (unless explicitly allowed)
Best Practices for Memory Management
1. Write to Daily Logs Frequently
Don't wait until end of day. Capture context as it happens:
## 2026-03-04
### 14:30 - GitHub PR #123
- Reviewed PR for new API endpoint
- Approved after suggesting async/await pattern
- Merged after tests passed
Daily logs are cheap. Write liberally.
2. Curate MEMORY.md Periodically
Once a week (or via heartbeats), review recent daily logs and update MEMORY.md:
Prompt:
"Read the last 7 daily logs. Identify any lasting insights, new people, or important decisions. Update MEMORY.md accordingly."
The assistant will read, summarize, and propose updates.
3. Use Sections in MEMORY.md
Organize by category:
- People
- Projects
- Tools
- Lessons Learned
- Preferences
- Active Goals
4. Search Before Asking
If you can't remember something, search memory first:
openclaw memory search "what was the decision on database migration?"
This is faster than scrolling through daily logs manually.
5. Delete Sensitive Data
If a daily log contains secrets (API keys, passwords, personal info), redact it:
edit memory/2026-03-04.md
Replace sensitive content with [REDACTED].
Context Management and Token Limits
Memory files consume tokens. If your memory grows too large, OpenClaw may exceed context limits. Here's how to manage it:
Compaction
OpenClaw can automatically summarize old memory to save tokens:
{
"agents": {
"defaults": {
"compaction": {
"mode": "safeguard",
"reserveTokensFloor": 30000,
"memoryFlush": {
"enabled": true
}
}
}
}
}
When the session approaches token limits, OpenClaw:
Context TTL
You can set a time-to-live for context:
{
"agents": {
"defaults": {
"contextPruning": {
"mode": "cache-ttl",
"ttl": "15m"
}
}
}
}
Messages older than 15 minutes are pruned from active context (but still saved to daily logs).
Manual Pruning
If a session is getting slow, manually compact:
/compact
This summarizes the session and resets context.
Advanced: Custom Memory Collections
You can create multiple QMD collections for different use cases:
{
"qmd": {
"collections": [
{
"name": "memory",
"paths": ["/home/will/clawd/memory/**/*.md"]
},
{
"name": "docs",
"paths": ["/home/will/clawd/docs/**/*.md"]
},
{
"name": "projects",
"paths": ["/home/will/Projects/**/*.md"]
}
]
}
}
Search a specific collection:
openclaw memory search --collection docs "configuration reference"
Heartbeat-Based Memory Maintenance
Schedule periodic memory reviews via heartbeats:
{
"agents": {
"defaults": {
"heartbeat": {
"every": "1d",
"activeHours": {
"start": "08:00",
"end": "23:00"
}
}
}
}
}
In your HEARTBEAT.md:
## Memory Maintenance (every 3 days)
- Read the last 3 daily logs
- Identify significant events, lessons, or insights
- Update MEMORY.md with distilled learnings
- Remove outdated info from MEMORY.md
The assistant wakes up daily, checks the schedule, and performs maintenance automatically.
Example Workflow
Day 1: Capture
You:
"I decided to use PostgreSQL instead of MySQL for the new project because we need better JSON support."
Assistant:
Writes to memory/2026-03-04.md:
## 2026-03-04
### Project: New API
- Decision: PostgreSQL over MySQL
- Reason: Better JSON support
Day 7: Curate
You:
"Review the last week's daily logs and update MEMORY.md."
Assistant:
Reads memory/2026-02-26.md through memory/2026-03-04.md, identifies:
- New project started
- Database choice made
- New dependency added
MEMORY.md:
## Projects
### New API
- Status: In progress
- Database: PostgreSQL (chosen for JSON support)
- Stack: Node.js, Express, PostgreSQL
Day 30: Search
You:
"Why did we choose PostgreSQL again?"
Assistant:
Searches QMD:
openclaw memory search "postgresql database choice"
Finds entry in MEMORY.md:
"Database: PostgreSQL (chosen for JSON support)"
Responds:
"We chose PostgreSQL for better JSON support compared to MySQL."
Troubleshooting
Memory Files Not Loading
Check that they're in the workspace:
ls ~/clawd/memory/
If missing, create the directory:
mkdir -p ~/clawd/memory
QMD Search Returns Nothing
Re-index:
openclaw memory index --force
Verify files are included in the collection:
openclaw memory status
Context Limits Exceeded
Enable compaction:
{
"compaction": {
"mode": "safeguard",
"memoryFlush": {
"enabled": true
}
}
}
Or reduce context window:
{
"contextTokens": 150000
}
Conclusion
OpenClaw's memory system turns a stateless model into a stateful assistant with genuine continuity. Daily logs capture raw events, MEMORY.md distills lasting insights, and QMD enables instant retrieval. Use all three layers, curate regularly, and your assistant will remember what matters.
Memory is not just storage. It's the foundation of intelligence. 🦞