Comprehensive tutorial series for OpenClaw AI agent gateway
The key to effective long-term memory: agent-suggested, human-curated workflows.
Without curation, memory systems fail in predictable ways:
Too much noise:
MEMORY.md grows to 50,000 lines
↓
Every search returns marginally relevant results
↓
Agent context gets polluted
↓
Responses become unfocused
Too little signal:
User forgets to add important context
↓
Agent keeps asking same questions
↓
Frustration on both sides
↓
Memory system abandoned
The solution: Combine agent awareness with human judgment.
Daily Activity
↓
Daily Log (memory/YYYY-MM-DD.md)
↓ (automatic)
Agent reviews during heartbeats/check-ins
↓
Suggests memory candidates
↓
Human reviews suggestions
↓ (approve/reject/edit)
Promoted to MEMORY.md
↓
Periodic reconciliation
This workflow ensures:
Ensure your agent writes to daily logs:
// ~/.openclaw/openclaw.json
{
agents: {
defaults: {
workspace: "~/.openclaw/workspace",
memory: {
// Daily logs auto-created in memory/ subfolder
dailyLogs: {
enabled: true,
path: "memory", // Relative to workspace
format: "YYYY-MM-DD.md", // Date format
},
},
},
},
}
Daily log structure:
# 2024-01-15
## Conversations
- Discussed project Alpha deadline (moved to Jan 20)
- Reviewed PR #142 — approved with minor changes
## Decisions
- Will use PostgreSQL instead of MongoDB for analytics
## Tasks Completed
- Fixed authentication bug (issue #89)
- Updated deployment docs
## Open Questions
- Should we migrate legacy users this quarter?
Ensure recent context is always available:
{
agents: {
defaults: {
memory: {
dailyLogs: { enabled: true },
// Auto-load recent logs
autoLoad: {
// Always load today and yesterday
recentDays: 2,
// Only load MEMORY.md in private sessions
curatedInPrivateOnly: true,
},
},
},
},
}
Initialize your curated memory file:
# Long-Term Memory
## About Me
- Name: [Your name]
- Working on: [Current projects]
- Preferences: [Communication style, tools, etc.]
## Key Context
[Important background the agent should always know]
## Active Projects
### Project Alpha
- Started: 2024-01-01
- Goal: [Description]
- Status: In progress
## Decisions Log
| Date | Decision | Context |
|------|----------|---------|
| 2024-01-10 | Use PostgreSQL | Analytics need complex queries |
## Patterns to Remember
- I prefer direct feedback over sugar-coating
- Morning is my most productive time
- When I say "later" I usually mean "remind me tomorrow"
Configure your agent to review daily logs during heartbeats:
<!-- In your agent's HEARTBEAT.md -->
## During Each Heartbeat
1. Check today's daily log
2. Look for entries worth promoting to MEMORY.md:
- Important decisions
- New project information
- Preference revelations
- Recurring patterns
3. If found, suggest to human for approval
## Memory Candidate Format
When suggesting, use:
📝 Memory Candidate:
For more sophisticated curation, create a dedicated skill:
<!-- skills/curator/SKILL.md -->
# Memory Curator Skill
## Purpose
Review daily logs and suggest memory candidates for human approval.
## Workflow
### 1. Scan Daily Logs
```bash
# Find logs from last 7 days
ls -la memory/*.md | head -7
Look for:
## Memory Candidates (2024-01-15)
### Candidate 1: Project deadline change
**Source:** memory/2024-01-15.md
**Content:** "Project Alpha deadline moved from Jan 15 to Jan 20 per client request"
**Suggested section:** Active Projects > Project Alpha
**Action:** [ ] Approve [ ] Reject [ ] Edit
### Candidate 2: Technical preference
**Source:** memory/2024-01-14.md
**Content:** "Prefer TypeScript over JavaScript for new projects"
**Suggested section:** Patterns to Remember
**Action:** [ ] Approve [ ] Reject [ ] Edit
Do not auto-promote. Always wait for explicit approval.
## Human Review Interface
### CLI-Based Review
```bash
# View pending suggestions
openclaw memory suggestions
# Approve a suggestion
openclaw memory approve 1
# Reject a suggestion
openclaw memory reject 2
# Edit before approving
openclaw memory edit 3
Configure your agent to present suggestions conversationally:
Agent: I noticed some things worth remembering from today:
1. 📝 You decided to use PostgreSQL for analytics (you mentioned
complex query requirements)
2. 📝 Project Alpha deadline moved to Jan 20
Should I add these to your long-term memory?
- "yes" or "1,2" to approve
- "no" or "skip" to dismiss
- "edit 1: [new text]" to modify
For a more sophisticated interface, build a curation dashboard:
┌─────────────────────────────────────────────────────┐
│ Memory Curation Dashboard │
├─────────────────────────────────────────────────────┤
│ │
│ 📥 INBOX (3 pending) │
│ ┌─────────────────────────────────────────────┐ │
│ │ "Use PostgreSQL for analytics" │ │
│ │ Source: 2024-01-15 • Suggested: Decisions │ │
│ │ [✓ Approve] [✗ Reject] [✎ Edit] │ │
│ └─────────────────────────────────────────────┘ │
│ ┌─────────────────────────────────────────────┐ │
│ │ "Project Alpha deadline: Jan 20" │ │
│ │ Source: 2024-01-15 • Suggested: Projects │ │
│ │ [✓ Approve] [✗ Reject] [✎ Edit] │ │
│ └─────────────────────────────────────────────┘ │
│ │
│ 📊 STATS │
│ • MEMORY.md: 127 entries │
│ • This week: 12 approved, 3 rejected │
│ • Last reconciliation: 5 days ago │
│ │
└─────────────────────────────────────────────────────┘
Here’s how an ADHD-aware coaching system implements memory curation:
Coach System
├── coach_db.py # CLI interface to SQLite
├── coach_db_core.py # Database operations
└── workspace-coach/
└── frontend/ # Next.js curation app
├── app/
│ ├── inbox/ # Pending candidates
│ ├── goals/ # Goal management
│ ├── tasks/ # Task tracking
│ └── projects/ # Project organization
1. Agent generates candidates during heartbeats:
# During scheduled check-in
python3 coach_db.py thought create \
--content "User mentioned preferring morning work sessions" \
--source telegram \
--type memory_candidate
2. Candidates appear in web dashboard:
// frontend/app/inbox/page.tsx
export default function InboxPage() {
const { data: candidates } = useQuery({
queryKey: ['memory-candidates'],
queryFn: () => fetch('/api/candidates').then(r => r.json()),
});
return (
<div className="inbox">
{candidates.map(c => (
<CandidateCard
key={c.id}
candidate={c}
onApprove={() => promoteTmemory(c.id)}
onReject={() => dismiss(c.id)}
/>
))}
</div>
);
}
3. Human reviews in GTD-style workflow:
4. CLI reflects changes:
# Check what was approved
python3 coach_db.py report approved --since yesterday
# View current memory state
python3 coach_db.py memory list
Over time, MEMORY.md accumulates outdated entries. Schedule periodic reviews:
## Memory Reconciliation Checklist
### 1. Remove Outdated Entries
- [ ] Completed projects → Archive or delete
- [ ] Changed preferences → Update or remove old
- [ ] Resolved decisions → Keep if instructive, else remove
### 2. Consolidate Duplicates
- [ ] Similar entries → Merge into one
- [ ] Redundant context → Trim to essentials
### 3. Update Active Sections
- [ ] Current projects → Accurate status?
- [ ] People context → Still relevant?
- [ ] Patterns → Still true?
### 4. Check Signal-to-Noise
- [ ] Read MEMORY.md end-to-end
- [ ] Would a new agent session be well-informed?
- [ ] Any sections feel like clutter?
Configure your agent to prompt reconciliation:
{
agents: {
defaults: {
memory: {
reconciliation: {
// Prompt every 30 days
intervalDays: 30,
// Message to send
prompt: "It's been a month since we reviewed MEMORY.md. Want to do a quick reconciliation?",
},
},
},
},
}
When running multiple agents, coordinate memory curation:
~/.openclaw/
├── workspace/ # Shared workspace
│ ├── MEMORY.md # Shared long-term memory
│ └── memory/ # Shared daily logs
│
├── workspace-coder/ # Coder-specific
│ ├── MEMORY.md # Coder's technical memory
│ └── memory/
│
└── workspace-researcher/ # Researcher-specific
├── MEMORY.md # Research findings
└── memory/
<!-- In researcher's daily log -->
## Research Finding (2024-01-15)
Discovered that competitor X launched feature Y.
→ PROMOTE TO: shared MEMORY.md (relevant to all agents)
→ NOTIFY: @conductor (strategic decision needed)
{
agents: {
researcher: {
memory: {
curation: {
// Researcher suggests, conductor approves
suggestTo: "conductor",
// Certain patterns auto-route to shared memory
autoPromote: {
patterns: ["PROMOTE TO: shared"],
destination: "~/.openclaw/workspace/MEMORY.md",
},
},
},
},
},
}
Always promote:
Consider promoting:
Avoid promoting:
✅ MEMORY.md under 500 lines ✅ Every entry has clear purpose ✅ Agent responses feel informed ✅ Rarely re-explaining same context ✅ Weekly curation takes < 5 minutes
❌ MEMORY.md over 2000 lines ❌ Entries from 6+ months ago unchanged ❌ Agent keeps asking same questions ❌ Search returns irrelevant results ❌ Curation backlog growing
curatedInPrivateOnly setting// Full memory curation setup
{
agents: {
defaults: {
workspace: "~/.openclaw/workspace",
memory: {
// Daily logging
dailyLogs: {
enabled: true,
path: "memory",
format: "YYYY-MM-DD.md",
},
// Auto-loading
autoLoad: {
recentDays: 2,
curatedInPrivateOnly: true,
},
// Curation settings
curation: {
// Where suggestions queue
inbox: "~/.openclaw/workspace/memory/inbox.json",
// Suggestion behavior
suggest: {
enabled: true,
during: ["heartbeat", "session-end"],
maxPerDay: 10,
},
// Approval routing
approvalRequired: true,
notifyChannel: "telegram",
},
// Reconciliation reminders
reconciliation: {
intervalDays: 30,
prompt: "Time for monthly memory review. Want to reconcile MEMORY.md?",
},
},
// Search configuration
memorySearch: {
enabled: true,
provider: "gemini",
hybrid: { enabled: true },
},
},
},
}
You now have curated memory. For experimental conversation-level memory, see Session Memory →