Install
openclaw skills install @chen6896qqwee/agent-memory-archThree-layer storage + four mechanisms + P0-P3 truth hierarchy for AI agent long-term memory. MEMORY.md central index, memory/core/ structured facts, local vector DB semantic search. Engramory curation, WAL protocol, context management. Zero external API, pure local filesystem + SQLite + LanceDB.
openclaw skills install @chen6896qqwee/agent-memory-archThree-layer storage + four mechanisms + P0-P3 truth hierarchy for AI agent memory management.
workspace/
├── MEMORY.md # Central index (hard limit: 200 lines / 25KB)
├── memory/
│ ├── core/ # Structured facts (JSON files)
│ │ ├── identity.json
│ │ ├── lessons.json
│ │ ├── preferences.json
│ │ ├── profile.json
│ │ └── strategies.json
│ ├── sessions/ # Session logs (history, not used in decisions)
│ ├── daily/ # Daily logs
│ ├── learnings/ # Learning notes + error logs
│ └── archive/ # Packaged archives
├── scripts/
│ ├── memory/ # Maintenance scripts
│ └── analysis/ # Analysis scripts
└── state.db # SQLite single source of truth (6 tables)
Trigger on detecting corrections, decisions, preference changes, or value changes. Write to session-state.json before replying. Ensures no data loss on crash.
When context usage > 60%, auto-trigger: write summary to working-buffer.md, record key decisions and context snapshots.
High-value memories (score > 0.8, appears 3+ times, affects decisions, user explicitly asked to remember) auto-promote from daily logs to MEMORY.md.
| Level | Location | Purpose | Update Frequency |
|---|---|---|---|
| P0 Single Source of Truth | state.db | Operational data | Auto after each change |
| P1 Structured Cache | core/*.json | Identity, preferences, lessons | Manual + auto validation |
| P2 Session Logs | sessions/*.md | History records, not for decisions | Every session |
| P3 Learning Notes | learnings/*.md | Lessons learned, for post-mortem | After the fact |
Core rule: Real-time decisions only use P0 (API real data + hardcoded rules). Historical memory only for post-mortem.
| Version | Date | Changes |
|---|---|---|
| v7.1 | 2026-07 | Added profile.json; P0-P3 hierarchy formalized |
| v7.0 | 2026-06 | state.db v4.0; sessions standalone storage |
| v6.0 | 2026-05 | Local vector DB integration |
| v5.0 | 2026-04 | Three-layer storage + four mechanisms finalized |
| v4.0 | 2026-03 | Initial architecture |
Author: Dawn License: MIT