Overview
The memory system consists of two components:- Long-term memory (
MEMORY.md) - Persistent facts, preferences, and key information - Daily notes (
YYYYMM/YYYYMMDD.md) - Chronological daily logs organized by date
Directory Structure
Memory files are stored in your workspace:Long-Term Memory
File Location
Purpose
Stores permanent information that should be remembered across all sessions:- User preferences and settings
- Important facts about the user
- Project-specific information
- Frequently used commands or workflows
- Key decisions and rationale
Example MEMORY.md
Check logs
- Memory - When interacting with me if something seems memorable, update ~/.picoclaw/workspace/memory/MEMORY.md
Recent Context
The agent automatically includes recent daily notes (last 3 days) in its context:How the Agent Uses Memory
Reading Memory
At the start of each session, the agent loads:- Long-term memory (
MEMORY.md) - Recent daily notes (last 3 days)
Writing Memory
The agent updates memory when:- You explicitly ask it to remember something
- It encounters important information worth remembering
- You correct or provide new preferences
- Significant tasks are completed
Memory Context Building
TheMemoryStore provides formatted context:
API Reference
MemoryStore Interface
The memory system is implemented inpkg/agent/memory.go:
Methods
ReadLongTerm()
Reads the long-term memory file.MEMORY.md or empty string if file doesn’t exist.
WriteLongTerm(content string)
Writes content to long-term memory.content: Full content to write toMEMORY.md
ReadToday()
Reads today’s daily note.AppendToday(content string)
Appends content to today’s daily note.content: Content to append
- Creates file with date header if it doesn’t exist
- Appends to existing content with newline separator
GetRecentDailyNotes(days int)
Retrieve daily notes from the last N days.days: Number of days to retrieve (default: 3)
GetMemoryContext()
Get formatted memory context for agent prompt.Storage Details
Atomic Writes
All memory writes use atomic file operations:- No partial writes on crash
- Safe for embedded systems with flash storage
- Explicit sync for reliability
File Permissions
- Memory files:
0o600(owner read/write only) - Directories:
0o755(owner full, others read/execute)
Directory Creation
Directories are created automatically:memory/- Created when MemoryStore initializesmemory/YYYYMM/- Created when appending to daily notes
Best Practices
What to Store in Long-term Memory
✅ Do store:- User preferences and settings
- Important personal facts
- Project-specific information
- Common workflows and commands
- Key decisions and rationale
- Temporary information
- Session-specific details (use daily notes)
- Sensitive credentials (use secure storage)
- Large data dumps
What to Store in Daily Notes
✅ Do store:- Session summaries
- Daily progress
- Problems solved
- Tasks completed
- Temporary context
- Permanent preferences (use MEMORY.md)
- Detailed logs (use proper logging)
- Large outputs
Maintenance
- Periodically review and update
MEMORY.md - Archive old daily notes if needed
- Keep long-term memory concise and relevant
- Use markdown formatting for readability
Manual Editing
You can manually edit memory files:Integration with Other Features
Heartbeat Tasks
Heartbeat can append to memory:Session History
Memory complements session history:- Session history: Full conversation context for current session
- Memory: Curated important information across sessions
Skills
Skills can leverage memory:Troubleshooting
Memory Not Loading
- Check file exists:
- Verify permissions:
- Check workspace configuration:
Daily Notes Not Created
- Check memory directory permissions:
- Manually create if needed:
- Test write access:
Related Features
- Session History - Conversation context within a session
- Heartbeat - Automated memory updates via periodic tasks
- Workspace - Understanding workspace structure