memory
Complete memory system for OpenClaw agents. Combines behavioral protocol (when to save) + auto-capture (heartbeat-enforced) + keyword search (recall) + maintenance (consolidation). Use for persistent memory, context recovery, answering "what did we discuss about X", and surviving context compaction. Includes SESSION-STATE.md pattern for hot context and RECENT_CONTEXT.md for auto-updated highlights.
- License 许可
- MIT
- 最近更新
- 2026-04-05
- Stars
- ★ 7
- Forks
- 1
01 前言 Front Matter
- name
- memory
- description
- Complete memory system for OpenClaw agents. Combines behavioral protocol (when to save) + auto-capture (heartbeat-enforced) + keyword search (recall) + maintenance (consolidation). Use for persistent memory, context recovery, answering "what did we discuss about X", and surviving context compaction. Includes SESSION-STATE.md pattern for hot context and RECENT_CONTEXT.md for auto-updated highlights.
02 资源文件 7
- 参考文档_meta.json285 B
- 参考文档README.md1.4 KB
- 参考文档references/RECENT_CONTEXT.md453 B
- 参考文档references/SESSION-STATE.md640 B
- 脚本scripts/capture.py4.8 KB
- 脚本scripts/consolidate.py8.0 KB
- 脚本scripts/recall.py7.6 KB
03 SKILL.md 正文
Memory Skill
A complete memory system that actually works. Not just tools — a full protocol.
The Problem
Agents forget. Context compresses. You wake up fresh each session.
Most memory solutions give you tools but no protocol for WHEN to use them. You forget to remember.
The Solution
The Flow:
User message → auto-capture (heartbeat) → relevant memories loaded (recall) → respond with context
Three layers:
- Protocol — WHEN to save (on user input, not agent memory)
- Capture — HOW to extract (automatic, timer-enforced)
- Recall — HOW to find (keyword search with time decay)
- Maintenance — HOW to prune (consolidation)
Quick Setup
1. Copy templates to your workspace
cp skills/memory/references/SESSION-STATE.md ./
cp skills/memory/references/RECENT_CONTEXT.md ./
2. Add protocol to your AGENTS.md
Add this to your agent instructions:
### ? MEMORY PROTOCOL (MANDATORY)
**Before Responding to Context Questions:**
When user asks about past discussions, decisions, or preferences:
1. FIRST run: `python3 skills/memory/scripts/recall.py "user's question"`
2. READ the results (they're now in your context)
3. THEN respond using that context
**After Substantive Conversations:**
Run: `python3 skills/memory/scripts/capture.py --facts "fact1" "fact2"`
**Write-Ahead Log Rule:**
If user provides concrete detail (name, correction, decision), update SESSION-STATE.md BEFORE responding.
3. Add auto-capture to HEARTBEAT.md
## Memory Auto-Capture (EVERY HEARTBEAT)
1. If meaningful conversation since last capture:
- Run: `python3 skills/memory/scripts/capture.py --facts "fact1" "fact2"`
- Update RECENT_CONTEXT.md with highlights
- Update SESSION-STATE.md if task changed
Commands
Capture
Store facts from conversations:
# Specific facts (recommended)
python3 scripts/capture.py --facts "Bill prefers X" "Decided to use Y" "TODO: implement Z"
# Raw text (auto-extracts)
python3 scripts/capture.py "conversation text here"
# From file
python3 scripts/capture.py --file /path/to/conversation.txt
Recall
Search memory for relevant context:
python3 scripts/recall.py "what did we decide about the database"
python3 scripts/recall.py --recent 7 "Bill's preferences" # last 7 days only
Returns snippets with timestamps and relevance scores. Recent memories score higher.
Consolidate
Run periodic maintenance:
python3 scripts/consolidate.py # full consolidation
python3 scripts/consolidate.py --stats # just show statistics
python3 scripts/consolidate.py --dry-run # preview without changes
Finds duplicates, identifies stale memories, suggests MEMORY.md updates.
File Structure
your-workspace/
├── SESSION-STATE.md # Hot context (active task "RAM")
├── RECENT_CONTEXT.md # Auto-updated recent highlights
├── MEMORY.md # Curated long-term memory
└── memory/
├── 2026-01-30.md # Daily log
├── 2026-01-29.md # Daily log
└── topics/ # (optional) Category files
SESSION-STATE.md Pattern
This is your "RAM" — the active task context that survives compaction.
# SESSION-STATE.md — Active Working Memory
## Current Task
[What you're working on RIGHT NOW]
## Immediate Context
[Key details, decisions, corrections from this session]
## Key Files
[Paths to relevant files]
## Last Updated
[Timestamp]
Read it FIRST at every session start. Update it when task context changes.
Fact Categories
Capture extracts facts with categories:
[decision]— choices made[preference]— user likes/dislikes[todo]— action items[insight]— learnings[important]— flagged as critical[note]— general notes
Limitations
- Keyword search — not semantic (LanceDB integration planned)
- Behavioral component — you still need to follow the protocol
- No auto-injection — recall results require you to call the script
What Makes This Different
| Other Skills | Memory Skill |
|---|---|
| Tools only | Protocol + tools |
| Manual trigger | Heartbeat auto-capture |
| No templates | SESSION-STATE.md pattern |
| Just storage | Storage + search + maintenance |
Roadmap
- [ ] LanceDB semantic search (local, no API)
- [ ] Auto-injection into context (OpenClaw integration)
- [ ] Contradiction detection
- [ ] Memory analytics
Built by g1itchbot. Dogfooded on myself first.
04 同仓库更多 Skills
zyfai
Earn yield on any Ethereum wallet on Base, Arbitrum, and Plasma. Use when a user wants passive DeFi yield on their funds. Deploys a non-custodial subaccount (Safe) linked to their EOA, enables automated yield optimization, and lets them deposit/withdraw anytime.
zerion-api
暂无简介
zerion-api-skill
暂无简介
zerion-api-mcp
暂无简介
yahoo-finance-forex
Fetches real-time FOREX news and market data from Yahoo Finance for major currency pairs (EUR/USD, GBP/USD, USD/JPY, etc.). Analyzes sentiment and provides trading context.
yahoo-finance
This skill should be used when the user asks to "get stock prices", "check stock quotes", "look up earnings", "get financial data", "find trending stocks", or needs stock market data from Yahoo Finance.