Claude Memory
by @kaiji-z
Structured memory system for OpenClaw agents. Provides a 4-type classification (user/feedback/project/reference), layered architecture (MEMORY.md + topics/ +...
clawhub install claude-memoryð About This Skill
name: claude-memory description: Structured memory system for OpenClaw agents. Provides a 4-type classification (user/feedback/project/reference), layered architecture (MEMORY.md + topics/ + feedback/ + daily notes), write rules, and heartbeat maintenance. Use when setting up a new agent's memory, improving an existing agent's memory system, or answering questions about memory management best practices. Triggers on phrases like "memory system", "memory setup", "čŪ°åŋįģŧįŧ", "čŪ°åŋįŪĄį", "setup memory", "improve memory", "memory architecture".
Claude Memory
A structured, layered memory architecture for OpenClaw agents. Uses a 4-type classification (user/feedback/project/reference) for organized memory, combined with semantic search and progressive disclosure for token-efficient retrieval.
Architecture
MEMORY.md (âĪ10KB, injected every turn via system prompt)
âââ High-frequency info directly readable (inline)
âââ Pointers to details in topics/
âââ 4 sections: user | feedback â feedback.md | project | referencememory/
âââ feedback.md # Corrections AND confirmations from human (MOST IMPORTANT)
âââ YYYY-MM-DD.md # Daily raw notes
âââ topics/ # Low-frequency large content
âââ agent-ids.md
âââ known-issues.md
âââ ... (domain-specific)
4-Type Classification
| Type | Purpose | Examples | |------|---------|---------| | user | Human's personal info, preferences, relationships | IDs, timezone, family, privacy rules | | feedback | Corrections AND confirmations from human | "Check docs first", "That approach was right" | | project | Work items, tasks, known issues | Active bugs, cron jobs, cleanup history | | reference | Technical resources, environment | Runtime config, connected services, security events |
Setup
Run the init script to create the directory structure and template files:
python scripts/init_memory.py
This creates:
MEMORY.md with empty section templatesmemory/feedback.md with format guidememory/topics/ directoryAfter running, edit MEMORY.md sections with actual content and update AGENTS.md to include the memory rules from references/agents-rules.md.
Write Rules
1. Feedback immediately â When human corrects you, write to memory/feedback.md NOW. Not later, not "I'll remember", NOW.
2. Record confirmations too â When human validates a non-obvious approach ("yes exactly", "keep doing that"), record it. If you only save corrections, you'll avoid past mistakes but drift away from approaches the human has already approved, becoming overly cautious.
3. MEMORY.md âĪ 10KB â Hybrid format: inline high-frequency info for direct readability, pointers to topics/ for depth. If it exceeds 10KB, move lower-frequency content to topics/ â the content is preserved, just relocated.
4. Read before answer â When MEMORY.md says "see topics/X.md", read that file first. Never answer from a one-line summary.
5. Absolute dates only â Convert relative dates ("yesterday", "last week") to absolute dates (e.g., "2026-04-01") when writing. Memories should remain interpretable months later.
6. Don't memorize what tools can look up â File paths, git history, code structure, current weather, live data.
7. Don't memorize ephemeral state â In-progress work, temporary conversation context, things that resolve themselves.
What NOT to Save
git log is authoritativeVerification Rules
Memories are long-term assets, not consumables. They don't expire. But some memories need verification before use:
Feedback Format
Each feedback entry follows this structure. Two types: correction (don't do X) and confirmation (keep doing X).
### F###: Rule description (date)
Why: Root cause or context
How to apply: Concrete scenarios F###: Confirmed approach description (įĄŪčŪĪ date)
Context: What was being worked on
Why: What made this approach noteworthy or validated
Heartbeat Maintenance
Memory is an asset, not a consumable. Memories should not be deleted because they're old.
> â ïļ Setup requirement: This 4-phase routine MUST be written into HEARTBEAT.md, NOT AGENTS.md. HEARTBEAT.md is injected only during heartbeat polls (token-efficient), while AGENTS.md is loaded every session (wastes token on every message). Write memory write rules in AGENTS.md, write this maintenance routine in HEARTBEAT.md.
During heartbeat polls, follow this 4-phase care routine:
Phase 1 â Catch-up (čĄĨæž)
memory/feedback.md?Phase 2 â Consolidate (æīå)
MEMORY.md or topics/.Phase 3 â Verify (æ ĄéŠ)
MEMORY.md and spot-check if they're still accurate.Phase 4 â Tidy (æīį)
MEMORY.md exceeds 10KB, relocate lower-frequency content to topics/. The content is preserved, just moved to a more appropriate home.> Created: YYYY-MM-DD | Updated: YYYY-MM-DDDesign Decisions
topics/. Not a pure index â an agent's memory should feel like a person's, not a database.topics/ to keep MEMORY.md lean.Advanced
For detailed AGENTS.md rules, see references/agents-rules.md.
For troubleshooting, see references/encoding-notes.md.
âïļ Configuration
Run the init script to create the directory structure and template files:
python scripts/init_memory.py
This creates:
MEMORY.md with empty section templatesmemory/feedback.md with format guidememory/topics/ directoryAfter running, edit MEMORY.md sections with actual content and update AGENTS.md to include the memory rules from references/agents-rules.md.