Memory Curator
Systematic memory management for agents through daily logging, session preservation, and knowledge extraction.
Quick Start
Log Today's Work
python scripts/daily_log.py \
--workspace ~/.openclaw/workspace \
--entry "Implemented user authentication with JWT" \
--category "Key Activities"
python scripts/daily_log.py --workspace ~/.openclaw/workspace --show
Search Memory
python scripts/search_memory.py \
--workspace ~/.openclaw/workspace \
--query "GraphQL"
python scripts/search_memory.py \
--workspace ~/.openclaw/workspace \
--query "authentication" \
--days 7
python scripts/search_memory.py \
--workspace ~/.openclaw/workspace \
--recent 5
Extract Session Summary
python scripts/extract_session.py \
--session ~/.openclaw/agents/<agent-id>/sessions/<session-id>.jsonl \
--output session-summary.md
Core Workflows
End of Day: Log Activities
When: Before ending work session or switching contexts
Steps:
-
Review what was accomplished:
- Features implemented
- Bugs fixed
- Decisions made
- Learnings discovered
-
Append to daily log:
python scripts/daily_log.py \
--workspace ~/.openclaw/workspace \
--entry "Fixed race condition in payment processing - added mutex lock"
-
Add structured entries for important work:
## Key Activities
- [14:30] Implemented user profile dashboard with GraphQL
- [16:00] Fixed infinite re-render in UserContext - memoized provider value
## Decisions Made
- Chose Apollo Client over React Query - better caching + type generation
- Decided to use JWT in httpOnly cookies instead of localStorage
## Learnings
- Apollo requires `__typename` field for cache normalization
- React.memo doesn't prevent re-renders from context changes
See: patterns.md for what to log in different scenarios
Before Context Switch: Preserve Session
When: Before running /new, /reset, or ending conversation
Steps:
-
Extract session summary:
python scripts/extract_session.py \
--session ~/.openclaw/agents/<agent-id>/sessions/<session-id>.jsonl \
--output ~/session-summary.md
-
Review summary and edit Key Learnings section
-
Save to daily log:
cat ~/session-summary.md >> ~/.openclaw/workspace/memory/$(date +%Y-%m-%d).md
-
Extract critical context to MEMORY.md if needed:
- Non-obvious solutions
- Important decisions
- Patterns worth remembering
Weekly Review: Extract Knowledge
When: End of week (Friday/Sunday) or monthly
Steps:
-
Search for patterns in recent logs:
python scripts/search_memory.py \
--workspace ~/.openclaw/workspace \
--recent 7
-
Look for extraction signals:
- Repeated issues (3+ occurrences)
- High-cost learnings (>1 hour to solve)
- Non-obvious solutions
- Successful patterns worth reusing
-
Extract to MEMORY.md:
- Add new sections or update existing ones
- Use problem-solution format
- Include code examples
- Add context for when to use
-
Clean up MEMORY.md:
- Remove outdated information
- Consolidate duplicate entries
- Update code examples
- Improve organization if needed
See: extraction.md for detailed extraction patterns
Daily: Quick Logging
For rapid context capture during work:
python scripts/daily_log.py \
--workspace ~/.openclaw/workspace \
--entry "TIL: DataLoader batches requests into single query"
python scripts/daily_log.py \
--workspace ~/.openclaw/workspace \
--entry "Using Zustand for client state - simpler than Redux" \
--category "Decisions Made"
python scripts/daily_log.py \
--workspace ~/.openclaw/workspace \
--entry "CORS + cookies: Enable credentials on client + server, Allow-Origin can't be *"
Memory Structure
Daily Logs (memory/YYYY-MM-DD.md)
Purpose: Chronological activity tracking
Content:
- What was done (timestamped)
- Decisions made
- Problems solved
- Learnings discovered
Retention: Keep recent logs accessible, optionally archive logs >90 days
When to use:
- "What did I do on [date]?"
- "When did I implement X?"
- Session history
- Activity tracking
MEMORY.md
Purpose: Curated long-term knowledge
Content:
- Patterns and best practices
- Common solutions
- Mistakes to avoid
- Useful references
Organization: Topic-based, not chronological
When to use:
- "How do I solve X?"
- "What's the pattern for Y?"
- Best practices
- Reusable solutions
See: organization.md for structure patterns
Memory Logging Patterns
What to Log
Always log:
- Key implementation decisions (why approach X over Y)
- Non-obvious solutions
- Root causes of bugs
- Architecture decisions with rationale
- Patterns discovered
- Mistakes and how they were fixed
Don't log:
- Every file changed (git has this)
- Obvious implementation details
- Routine commits
- Project-specific hacks
See: patterns.md for comprehensive logging guidance
When to Log
During work:
- Quick notes with
daily_log.py --entry
- Capture decisions as made
- Log problems when solved
End of day:
- Review what was accomplished
- Structure important entries
- Add context for tomorrow
End of week:
- Extract patterns to MEMORY.md
- Consolidate learnings
- Clean up outdated info
Knowledge Extraction
Extraction Criteria
Extract to MEMORY.md when:
- Pattern appears 3+ times
- Solution took >1 hour to find
- Solution is non-obvious
- Will save significant time in future
- Applies across multiple projects
- Mistake was costly to debug
Don't extract:
- One-off fixes
- Project-specific hacks
- Obvious solutions
- Rapidly changing APIs
Extraction Format
Problem-Solution Structure:
## [Technology/Domain]
### [Problem Title]
**Problem:** [Clear description]
**Cause:** [Root cause]
**Solution:** [How to fix]
**Code:**
```js
// Example implementation
Prevention: [How to avoid]
Context: [When this applies]
**See:** [extraction.md](references/extraction.md) for detailed extraction workflow
## Scripts Reference
### daily_log.py
Create or append to today's daily log.
```bash
# Append entry
python scripts/daily_log.py \
--workspace ~/.openclaw/workspace \
--entry "Your log entry" \
[--category "Section Name"]
# Create from template
python scripts/daily_log.py \
--workspace ~/.openclaw/workspace \
--template
# Show today's log
python scripts/daily_log.py \
--workspace ~/.openclaw/workspace \
--show
extract_session.py
Extract summary from session JSONL.
python scripts/extract_session.py \
--session ~/.openclaw/agents/<id>/sessions/<session>.jsonl \
[--output summary.md]
Outputs:
- User requests summary
- Tools used
- Files touched
- Template for key learnings
search_memory.py
Search across all memory files.
python scripts/search_memory.py \
--workspace ~/.openclaw/workspace \
--query "search term" \
[--days 30]
python scripts/search_memory.py \
--workspace ~/.openclaw/workspace \
--recent 5
Best Practices
Daily Discipline
- Start of day: Review yesterday's log, plan today
- During work: Quick notes for decisions and learnings
- End of day: Structure important entries, add context
- End of week: Extract patterns, clean up MEMORY.md
Context Preservation
Before /new or /reset:
- Extract session summary
- Add to daily log
- Preserve critical context in MEMORY.md
After major work:
- Document what was accomplished
- Note key learnings
- Record next steps
Knowledge Organization
- Topic-based structure - Group by domain, not date
- Problem-first titles - Lead with the problem being solved
- Searchable language - Use specific, findable terms
- Flat hierarchy - Maximum 2 levels deep
- Code examples - Include working examples
See: organization.md for detailed structure guidance
Troubleshooting
Can't find past decision
-
Search daily logs first:
python scripts/search_memory.py --workspace ~/.openclaw/workspace --query "decision keyword"
-
Search MEMORY.md:
grep -i "keyword" ~/.openclaw/workspace/MEMORY.md
-
Search session logs:
rg "keyword" ~/.openclaw/agents/<id>/sessions/*.jsonl
Memory files getting too large
-
Archive old daily logs (>90 days):
mkdir -p memory/archive/2025-Q1
mv memory/2025-01-*.md memory/archive/2025-Q1/
-
Split MEMORY.md by domain if >1000 lines:
memory/domains/
βββ react.md
βββ graphql.md
βββ database.md
-
Link from main MEMORY.md:
## Domain Knowledge
- [React Patterns](memory/domains/react.m