| title | OpenClaw Three-Tier Memory System: Keep Cross-Session Context Without Token Bloat | |||||
|---|---|---|---|---|---|---|
| slug | openclaw-three-tier-memory-system | |||||
| summary | A structured three-layer memory pattern for OpenClaw that separates long-term memory, daily logs, and project tracking so agents keep context across sessions with lower retrieval noise. | |||||
| whatItDoes | Organizes agent memory into long-term, daily, and project layers, then uses semantic recall to retrieve the right context quickly. | |||||
| category | automation-integration | |||||
| difficulty | intermediate | |||||
| tags |
|
|||||
| targetUser |
|
|||||
| skillsUsed |
|
|||||
| updatedAt | 2026-03-12 | |||||
| published | true |
- Splits memory into three layers:
MEMORY.md(long-term),memory/YYYY-MM-DD.md(daily), andPROJECTS.md(project state). - Defines migration rules so temporary notes can be promoted into durable memory.
- Uses semantic retrieval (
memory_search+memory_get) to find past decisions faster.
A single large memory file becomes noisy fast: useful facts and temporary notes mix together, retrieval quality drops, and agents lose continuity between sessions.
This pattern keeps memory durable but lightweight. Teams can preserve long-term preferences, keep daily execution logs separate, and maintain project-level next actions without inflating every session context.
- Maintaining personal AI assistants that run continuously over days or weeks.
- Recovering project context after model restarts or session compaction.
- Reducing repeated “what did we decide last time?” questions in agent workflows.
- Create the memory structure in workspace root:
MEMORY.mdPROJECTS.mdmemory/YYYY-MM-DD.md
- Keep layers scoped:
- Durable principles/preferences →
MEMORY.md - Daily events/decisions →
memory/YYYY-MM-DD.md - Goal, blocker, next step →
PROJECTS.md
- Durable principles/preferences →
- Add a session routine:
- Session start: read long-term + today/yesterday daily logs + project state.
- Session end: migrate durable insights from daily logs to
MEMORY.md.
- Enable retrieval by using semantic memory tools (
memory_searchthenmemory_get) for targeted recall.
A representative three-layer file layout from the source:
workspace/
├── MEMORY.md
├── PROJECTS.md
└── memory/
├── 2026-02-19.md
└── heartbeat-state.json
No. The three-tier structure organizes what gets written; vector search improves how those files are retrieved.
No, but using all three layers helps avoid mixing long-term preferences with short-lived execution logs.
When a fact is likely to matter across multiple days (for example stable user preferences or confirmed operating rules).