/install memory-for-openclaw
Long-Term Memory
Overview
This skill gives OpenClaw agents long-term memory that persists across sessions. It replaces the manual MEMORY.md approach with automated capture + structured storage.
Everything runs locally — no cloud, no data leaves your machine.
Core Workflow
Session Start → 1. inject_context() → get relevant history
Session Run → 2. remember() / auto_capture() → save important info
Session End → 3. summarize() → compress session into memory
Scripts
scripts/memory_engine.py — Core engine
# Save a memory
python3 scripts/memory_engine.py remember "决定: 使用FastAPI框架" --tags decision,tech --importance 8 --project saas
# Search memories
python3 scripts/memory_engine.py search "技术方案" --tags tech --min-imp 5
# Get context for prompt injection
python3 scripts/memory_engine.py inject "当前任务描述..."
# Auto-capture from text (scans for decisions, facts, preferences)
python3 scripts/memory_engine.py auto "我们决定采用SQLite作为数据库,技术栈为FastAPI..."
# Session management
python3 scripts/memory_engine.py session-start # returns session_id + context
python3 scripts/memory_engine.py session-end \x3Csession_id> --summary "..."
# Stats
python3 scripts/memory_engine.py stats
scripts/setup.py — One-time workspace setup
python3 scripts/setup.py
Memory Structure
- Storage: SQLite + FTS5 full-text search
- Fields: content, tags[], importance(1-10), source, session, project, timestamps
- Tags: Tag memories for filtering (e.g.,
decision,tech,user,project:X) - Importance: 1-10 scale. 8+ = key fact, 6-7 = useful context, 1-5 = normal
Auto-Capture
The engine automatically detects important content from text:
| Trigger Keywords | Tag | Default Importance |
|---|---|---|
| 决定, 选择, 采用, 改为, 升级, 弃用 | decision |
7 |
| 项目名, 产品名, 公司, 版本, 价格 | fact |
6 |
| 喜欢, 偏好, 习惯, 不要, 推荐 | preference |
6 |
| 技术栈, 框架, 语言, 数据库, API, 部署 | tech |
5 |
| 问题, bug, 报错, 异常, 失败 | problem |
5 |
AGENTS.md Integration
Add to your AGENTS.md (or the relevant agent's config):
## Long-Term Memory Rules
1. On session start: Run `python3 scripts/memory_engine.py inject "current task"` and use the output as context
2. When user shares important info: Use `remember()` to save it
3. Track decisions: Save key decisions with `--importance 8` and tag `decision`
4. Before answering "remember" or "previous" questions: Search memory first
5. On session end: Summarize key outcomes for next session
Data Storage
~/.openclaw/workspace/long-term-memory/
├── memory.db # SQLite database
├── config.json # Configuration
└── current_context.md # Last built context (for debugging)
Tips
- Be selective: Not everything needs remembering. Save decisions, preferences, problems.
- Use tags:
project:Xtags make cross-project memory searchable. - Importance matters: 8+ for permanent facts, 5-7 for useful context, 3-4 for temporary.
- Search before answering: If user asks "do you remember X?", search memory first.
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install memory-for-openclaw - After installation, invoke the skill by name or use
/memory-for-openclaw - Provide required inputs per the skill's parameter spec and get structured output
What is Long Term Memory?
Persistent, cross-session memory for OpenClaw agents. Automatically captures key facts, decisions, user preferences, and project context. Injects relevant me... It is an AI Agent Skill for Claude Code / OpenClaw, with 31 downloads so far.
How do I install Long Term Memory?
Run "/install memory-for-openclaw" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Long Term Memory free?
Yes, Long Term Memory is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does Long Term Memory support?
Long Term Memory is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Long Term Memory?
It is built and maintained by szwangw (@szwangw); the current version is v0.2.0.