Elite Longterm Memory
Ultimate AI agent memory system for Cursor, Claude, ChatGPT & Copilot. WAL protocol + vector search + git-notes + cloud backup. Never lose context again. Vibe-coding ready.
请从本地咔咔镜像安装 elite-longterm-memory,注册表地址为 http://localhost:13001。安装后先检查 README、清单和权限,再在当前工作区使用。下载说明
--- name: elite-longterm-memory version: 1.2.3 description: "Ultimate AI agent memory system for Cursor, Claude, ChatGPT & Copilot. WAL protocol + vector search + git-notes + cloud backup. Never lose context again. Vibe-coding ready." author: NextFrontierBuilds keywords: [memory, ai-agent, ai-coding, long-term-memory, vector-search, lancedb, git-notes, wal, persistent-context, claude, claude-code, gpt, chatgpt, cursor, copilot, github-copilot, openclaw, moltbot, vibe-coding, agentic, ai-tools, developer-tools, devtools, typescript, llm, automation] metadata: openclaw: emoji: "🧠" requires: env:
plugins:
---
- OPENAI_API_KEY
- memory-lancedb
Elite Longterm Memory 🧠
**The ultimate memory system for AI agents.** Combines 6 proven approaches into one bulletproof architecture.
Never lose context. Never forget decisions. Never repeat mistakes.
Architecture Overview
┌─────────────────────────────────────────────────────────────────┐ │ ELITE LONGTERM MEMORY │ ├─────────────────────────────────────────────────────────────────┤ │ │ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │ │ HOT RAM │ │ WARM STORE │ │ COLD STORE │ │ │ │ │ │ │ │ │ │ │ │ SESSION- │ │ LanceDB │ │ Git-Notes │ │ │ │ STATE.md │ │ Vectors │ │ Knowledge │ │ │ │ │ │ │ │ Graph │ │ │ │ (survives │ │ (semantic │ │ (permanent │ │ │ │ compaction)│ │ search) │ │ decisions) │ │ │ └─────────────┘ └─────────────┘ └─────────────┘ │ │ │ │ │ │ │ └────────────────┼────────────────┘ │ │ ▼ │ │ ┌─────────────┐ │ │ │ MEMORY.md │ ← Curated long-term │ │ │ + daily/ │ (human-readable) │ │ └─────────────┘ │ │ │ │ │ ▼ │ │ ┌─────────────┐ │ │ │ SuperMemory │ ← Cloud backup (optional) │ │ │ API │ │ │ └─────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────┘
The 5 Memory Layers
Layer 1: HOT RAM (SESSION-STATE.md)
**From: bulletproof-memory**
Active working memory that survives compaction. Write-Ahead Log protocol.
markdown# SESSION-STATE.md — Active Working Memory
## Current Task
[What we're working on RIGHT NOW]
## Key Context
- User preference: ...
- Decision made: ...
- Blocker: ...
## Pending Actions
- [ ] ...**Rule:** Write BEFORE responding. Triggered by user input, not agent memory.
Layer 2: WARM STORE (LanceDB Vectors)
**From: lancedb-memory**
Semantic search across all memories. Auto-recall injects relevant context.
bash# Auto-recall (happens automatically)
memory_recall query="project status" limit=5
# Manual store
memory_store text="User prefers dark mode" category="preference" importance=0.9Layer 3: COLD STORE (Git-Notes Knowledge Graph)
**From: git-notes-memory**
Structured decisions, learnings, and context. Branch-aware.
bash# Store a decision (SILENT - never announce)
python3 memory.py -p $DIR remember '{"type":"decision","content":"Use React for frontend"}' -t tech -i h
# Retrieve context
python3 memory.py -p $DIR get "frontend"Layer 4: CURATED ARCHIVE (MEMORY.md + daily/)
**From: OpenClaw native**
Human-readable long-term memory. Daily logs + distilled wisdom.
workspace/ ├── MEMORY.md # Curated long-term (the good stuff) └── memory/ ├── 2026-01-30.md # Daily log ├── 2026-01-29.md └── topics/ # Topic-specific files
Layer 5: CLOUD BACKUP (SuperMemory) — Optional
**From: supermemory**
Cross-device sync. Chat with your knowledge base.
bashexport SUPERMEMORY_API_KEY="your-key"
supermemory add "Important context"
supermemory search "what did we decide about..."Layer 6: AUTO-EXTRACTION (Mem0) — Recommended
**NEW: Automatic fact extraction**
Mem0 automatically extracts facts from conversations. 80% token reduction.
bashnpm install mem0ai
export MEM0_API_KEY="your-key"javascriptconst { MemoryClient } = require('mem0ai');
const client = new MemoryClient({ apiKey: process.env.MEM0_API_KEY });
// Conversations auto-extract facts
await client.add(messages, { user_id: "user123" });
// Retrieve relevant memories
const memories = await client.search(query, { user_id: "user123" });Benefits:
- Auto-extracts preferences, decisions, facts
- Deduplicates and updates existing memories
- 80% reduction in tokens vs raw history
- Works across sessions automatically
Quick Setup
1. Create SESSION-STATE.md (Hot RAM)
bashcat > SESSION-STATE.md << 'EOF'
# SESSION-STATE.md — Active Working Memory
This file is the agent's "RAM" — survives compaction, restarts, distractions.
## Current Task
[None]
## Key Context
[None yet]
## Pending Actions
- [ ] None
## Recent Decisions
[None yet]
---
*Last updated: [timestamp]*
EOF2. Enable LanceDB (Warm Store)
In `~/.openclaw/openclaw.json`:
json{
"memorySearch": {
"enabled": true,
"provider": "openai",
"sources": ["memory"],
"minScore": 0.3,
"maxResults": 10
},
"plugins": {
"entries": {
"memory-lancedb": {
"enabled": true,
"config": {
"autoCapture": false,
"autoRecall": true,
"captureCategories": ["preference", "decision", "fact"],
"minImportance": 0.7
}
}
}
}
}3. Initialize Git-Notes (Cold Store)
bashcd ~/clawd
git init # if not already
python3 skills/git-notes-memory/memory.py -p . sync --start4. Verify MEMORY.md Structure
bash# Ensure you have:
# - MEMORY.md in workspace root
# - memory/ folder for daily logs
mkdir -p memory5. (Optional) Setup SuperMemory
bashexport SUPERMEMORY_API_KEY="your-key"
# Add to ~/.zshrc for persistenceAgent Instructions
On Session Start
1. Read SESSION-STATE.md — this is your hot context 2. Run `memory_search` for relevant prior context 3. Check memory/YYYY-MM-DD.md for recent activity
During Conversation
1. **User gives concrete detail?** → Write to SESSION-STATE.md BEFORE responding 2. **Important decision made?** → Store in Git-Notes (SILENTLY) 3. **Preference expressed?** → `memory_store` with importance=0.9
On Session End
1. Update SESSION-STATE.md with final state 2. Move significant items to MEMORY.md if worth keeping long-term 3. Create/update daily log in memory/YYYY-MM-DD.md
Memory Hygiene (Weekly)
1. Review SESSION-STATE.md — archive completed tasks 2. Check LanceDB for junk: `memory_recall query="*" limit=50` 3. Clear irrelevant vectors: `memory_forget id=<id>` 4. Consolidate daily logs into MEMORY.md
The WAL Protocol (Critical)
**Write-Ahead Log:** Write state BEFORE responding, not after.
| Trigger | Action | |---------|--------| | User states preference | Write to SESSION-STATE.md → then respond | | User makes decision | Write to SESSION-STATE.md → then respond | | User gives deadline | Write to SESSION-STATE.md → then respond | | User corrects you | Write to SESSION-STATE.md → then respond |
**Why?** If you respond first and crash/compact before saving, context is lost. WAL ensures durability.
Example Workflow
User: "Let's use Tailwind for this project, not vanilla CSS"
Agent (internal): 1. Write to SESSION-STATE.md: "Decision: Use Tailwind, not vanilla CSS" 2. Store in Git-Notes: decision about CSS framework 3. memory_store: "User prefers Tailwind over vanilla CSS" importance=0.9 4. THEN respond: "Got it — Tailwind it is..."
Maintenance Commands
bash# Audit vector memory
memory_recall query="*" limit=50
# Clear all vectors (nuclear option)
rm -rf ~/.openclaw/memory/lancedb/
openclaw gateway restart
# Export Git-Notes
python3 memory.py -p . export --format json > memories.json
# Check memory health
du -sh ~/.openclaw/memory/
wc -l MEMORY.md
ls -la memory/Why Memory Fails
Understanding the root causes helps you fix them:
| Failure Mode | Cause | Fix | |--------------|-------|-----| | Forgets everything | `memory_search` disabled | Enable + add OpenAI key | | Files not loaded | Agent skips reading memory | Add to AGENTS.md rules | | Facts not captured | No auto-extraction | Use Mem0 or manual logging | | Sub-agents isolated | Don't inherit context | Pass context in task prompt | | Repeats mistakes | Lessons not logged | Write to memory/lessons.md |
Solutions (Ranked by Effort)
1. Quick Win: Enable memory_search
If you have an OpenAI key, enable semantic search:
bashopenclaw configure --section webThis enables vector search over MEMORY.md + memory/*.md files.
2. Recommended: Mem0 Integration
Auto-extract facts from conversations. 80% token reduction.
bashnpm install mem0aijavascriptconst { MemoryClient } = require('mem0ai');
const client = new MemoryClient({ apiKey: process.env.MEM0_API_KEY });
// Auto-extract and store
await client.add([
{ role: "user", content: "I prefer Tailwind over vanilla CSS" }
], { user_id: "ty" });
// Retrieve relevant memories
const memories = await client.search("CSS preferences", { user_id: "ty" });3. Better File Structure (No Dependencies)
memory/ ├── projects/ │ ├── strykr.md │ └── taska.md ├── people/ │ └── contacts.md ├── decisions/ │ └── 2026-01.md ├── lessons/ │ └── mistakes.md └── preferences.md
Keep MEMORY.md as a summary (<5KB), link to detailed files.
Immediate Fixes Checklist
| Problem | Fix | |---------|-----| | Forgets preferences | Add `## Preferences` section to MEMORY.md | | Repeats mistakes | Log every mistake to `memory/lessons.md` | | Sub-agents lack context | Include key context in spawn task prompt | | Forgets recent work | Strict daily file discipline | | Memory search not working | Check `OPENAI_API_KEY` is set |
Troubleshooting
**Agent keeps forgetting mid-conversation:** → SESSION-STATE.md not being updated. Check WAL protocol.
**Irrelevant memories injected:** → Disable autoCapture, increase minImportance threshold.
**Memory too large, slow recall:** → Run hygiene: clear old vectors, archive daily logs.
**Git-Notes not persisting:** → Run `git notes push` to sync with remote.
**memory_search returns nothing:** → Check OpenAI API key: `echo $OPENAI_API_KEY` → Verify memorySearch enabled in openclaw.json
---
Links
- bulletproof-memory: https://clawdhub.com/skills/bulletproof-memory
- lancedb-memory: https://clawdhub.com/skills/lancedb-memory
- git-notes-memory: https://clawdhub.com/skills/git-notes-memory
- memory-hygiene: https://clawdhub.com/skills/memory-hygiene
- supermemory: https://clawdhub.com/skills/supermemory
---
*Built by [@NextXFrontier](https://x.com/NextXFrontier) — Part of the Next Frontier AI toolkit*
安装解析
{
"artifact": {
"downloadUrl": "/api/v1/download?slug=elite-longterm-memory&version=1.2.3&ownerHandle=nextfrontierbuilds",
"format": "zip",
"generated": true,
"kind": "skillArchive",
"sha256": "bd8c77c886f1d4c3e07814266d1fa4bebf3bbed38068fd6b5b787f634c76618b",
"size": 14501
},
"owner": {
"displayName": "Next Frontier AI",
"handle": "nextfrontierbuilds",
"id": "5c635150-aad3-4425-99ff-e71ad33c3086",
"verified": false
},
"skill": {
"displayName": "Elite Longterm Memory",
"latestVersion": "1.2.3",
"license": "unknown",
"name": "elite-longterm-memory",
"ownerHandle": "nextfrontierbuilds",
"slug": "elite-longterm-memory",
"stats": {
"downloads": 62897,
"installs": 2249,
"stars": 226
},
"summary": "Ultimate AI agent memory system for Cursor, Claude, ChatGPT & Copilot. WAL protocol + vector search + git-notes + cloud backup. Never lose context again. Vibe-coding ready.",
"tags": [
"agents",
"development",
"Chatgpt",
"Cursor",
"Git Notes",
"Vector Search",
"Vibe Coding"
],
"type": "skill",
"updatedAt": "2026-07-06T10:48:52.962Z"
},
"sourceHandoff": null,
"version": {
"checksum": null,
"checksumAlgorithm": null,
"id": "324521f3-d2c5-4025-8670-fccfb2db1304",
"publishedAt": "2026-02-11T08:37:00.241Z",
"size": null,
"version": "1.2.3",
"artifactStorageKey": null,
"changelog": "- Expanded description and keywords for improved discoverability, highlighting ChatGPT, Copilot, Cursor, and developer tooling.\n- Updated version to 1.2.3.\n- Clarified compatibility and marketing text in SKILL.md.\n- No functional or implementation changes to code logic.",
"manifest": {
"clawhub": {
"tags": {
"ai": "0.1.0",
"latest": "1.2.3",
"memory": "0.1.0",
"clawdbot": "0.1.0",
"openclaw": "0.1.0",
"long-term": "0.1.0",
"persistence": "0.1.0"
},
"owner": "nextfrontierbuilds",
"stats": {
"stars": 226,
"comments": 5,
"installs": 2249,
"versions": 4,
"downloads": 62897
},
"topics": [
"Chatgpt",
"Cursor",
"Git Notes",
"Vector Search",
"Vibe Coding"
],
"categories": [
"agents",
"development"
]
},
"install": "openclaw skills install @nextfrontierbuilds/elite-longterm-memory"
},
"readme": "---\nname: elite-longterm-memory\nversion: 1.2.3\ndescription: \"Ultimate AI agent memory system for Cursor, Claude, ChatGPT & Copilot. WAL protocol + vector search + git-notes + cloud backup. Never lose context again. Vibe-coding ready.\"\nauthor: NextFrontierBuilds\nkeywords: [memory, ai-agent, ai-coding, long-term-memory, vector-search, lancedb, git-notes, wal, persistent-context, claude, claude-code, gpt, chatgpt, cursor, copilot, github-copilot, openclaw, moltbot, vibe-coding, agentic, ai-tools, developer-tools, devtools, typescript, llm, automation]\nmetadata:\n openclaw:\n emoji: \"🧠\"\n requires:\n env:\n - OPENAI_API_KEY\n plugins:\n - memory-lancedb\n---\n\n# Elite Longterm Memory 🧠\n\n**The ultimate memory system for AI agents.** Combines 6 proven approaches into one bulletproof architecture.\n\nNever lose context. Never forget decisions. Never repeat mistakes.\n\n## Architecture Overview\n\n```\n┌─────────────────────────────────────────────────────────────────┐\n│ ELITE LONGTERM MEMORY │\n├─────────────────────────────────────────────────────────────────┤\n│ │\n│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │\n│ │ HOT RAM │ │ WARM STORE │ │ COLD STORE │ │\n│ │ │ │ │ │ │ │\n│ │ SESSION- │ │ LanceDB │ │ Git-Notes │ │\n│ │ STATE.md │ │ Vectors │ │ Knowledge │ │\n│ │ │ │ │ │ Graph │ │\n│ │ (survives │ │ (semantic │ │ (permanent │ │\n│ │ compaction)│ │ search) │ │ decisions) │ │\n│ └─────────────┘ └─────────────┘ └─────────────┘ │\n│ │ │ │ │\n│ └────────────────┼────────────────┘ │\n│ ▼ │\n│ ┌─────────────┐ │\n│ │ MEMORY.md │ ← Curated long-term │\n│ │ + daily/ │ (human-readable) │\n│ └─────────────┘ │\n│ │ │\n│ ▼ │\n│ ┌─────────────┐ │\n│ │ SuperMemory │ ← Cloud backup (optional) │\n│ │ API │ │\n│ └─────────────┘ │\n│ │\n└─────────────────────────────────────────────────────────────────┘\n```\n\n## The 5 Memory Layers\n\n### Layer 1: HOT RAM (SESSION-STATE.md)\n**From: bulletproof-memory**\n\nActive working memory that survives compaction. Write-Ahead Log protocol.\n\n```markdown\n# SESSION-STATE.md — Active Working Memory\n\n## Current Task\n[What we're working on RIGHT NOW]\n\n## Key Context\n- User preference: ...\n- Decision made: ...\n- Blocker: ...\n\n## Pending Actions\n- [ ] ...\n```\n\n**Rule:** Write BEFORE responding. Triggered by user input, not agent memory.\n\n### Layer 2: WARM STORE (LanceDB Vectors)\n**From: lancedb-memory**\n\nSemantic search across all memories. Auto-recall injects relevant context.\n\n```bash\n# Auto-recall (happens automatically)\nmemory_recall query=\"project status\" limit=5\n\n# Manual store\nmemory_store text=\"User prefers dark mode\" category=\"preference\" importance=0.9\n```\n\n### Layer 3: COLD STORE (Git-Notes Knowledge Graph)\n**From: git-notes-memory**\n\nStructured decisions, learnings, and context. Branch-aware.\n\n```bash\n# Store a decision (SILENT - never announce)\npython3 memory.py -p $DIR remember '{\"type\":\"decision\",\"content\":\"Use React for frontend\"}' -t tech -i h\n\n# Retrieve context\npython3 memory.py -p $DIR get \"frontend\"\n```\n\n### Layer 4: CURATED ARCHIVE (MEMORY.md + daily/)\n**From: OpenClaw native**\n\nHuman-readable long-term memory. Daily logs + distilled wisdom.\n\n```\nworkspace/\n├── MEMORY.md # Curated long-term (the good stuff)\n└── memory/\n ├── 2026-01-30.md # Daily log\n ├── 2026-01-29.md\n └── topics/ # Topic-specific files\n```\n\n### Layer 5: CLOUD BACKUP (SuperMemory) — Optional\n**From: supermemory**\n\nCross-device sync. Chat with your knowledge base.\n\n```bash\nexport SUPERMEMORY_API_KEY=\"your-key\"\nsupermemory add \"Important context\"\nsupermemory search \"what did we decide about...\"\n```\n\n### Layer 6: AUTO-EXTRACTION (Mem0) — Recommended\n**NEW: Automatic fact extraction**\n\nMem0 automatically extracts facts from conversations. 80% token reduction.\n\n```bash\nnpm install mem0ai\nexport MEM0_API_KEY=\"your-key\"\n```\n\n```javascript\nconst { MemoryClient } = require('mem0ai');\nconst client = new MemoryClient({ apiKey: process.env.MEM0_API_KEY });\n\n// Conversations auto-extract facts\nawait client.add(messages, { user_id: \"user123\" });\n\n// Retrieve relevant memories\nconst memories = await client.search(query, { user_id: \"user123\" });\n```\n\nBenefits:\n- Auto-extracts preferences, decisions, facts\n- Deduplicates and updates existing memories\n- 80% reduction in tokens vs raw history\n- Works across sessions automatically\n\n## Quick Setup\n\n### 1. Create SESSION-STATE.md (Hot RAM)\n\n```bash\ncat > SESSION-STATE.md << 'EOF'\n# SESSION-STATE.md — Active Working Memory\n\nThis file is the agent's \"RAM\" — survives compaction, restarts, distractions.\n\n## Current Task\n[None]\n\n## Key Context\n[None yet]\n\n## Pending Actions\n- [ ] None\n\n## Recent Decisions\n[None yet]\n\n---\n*Last updated: [timestamp]*\nEOF\n```\n\n### 2. Enable LanceDB (Warm Store)\n\nIn `~/.openclaw/openclaw.json`:\n\n```json\n{\n \"memorySearch\": {\n \"enabled\": true,\n \"provider\": \"openai\",\n \"sources\": [\"memory\"],\n \"minScore\": 0.3,\n \"maxResults\": 10\n },\n \"plugins\": {\n \"entries\": {\n \"memory-lancedb\": {\n \"enabled\": true,\n \"config\": {\n \"autoCapture\": false,\n \"autoRecall\": true,\n \"captureCategories\": [\"preference\", \"decision\", \"fact\"],\n \"minImportance\": 0.7\n }\n }\n }\n }\n}\n```\n\n### 3. Initialize Git-Notes (Cold Store)\n\n```bash\ncd ~/clawd\ngit init # if not already\npython3 skills/git-notes-memory/memory.py -p . sync --start\n```\n\n### 4. Verify MEMORY.md Structure\n\n```bash\n# Ensure you have:\n# - MEMORY.md in workspace root\n# - memory/ folder for daily logs\nmkdir -p memory\n```\n\n### 5. (Optional) Setup SuperMemory\n\n```bash\nexport SUPERMEMORY_API_KEY=\"your-key\"\n# Add to ~/.zshrc for persistence\n```\n\n## Agent Instructions\n\n### On Session Start\n1. Read SESSION-STATE.md — this is your hot context\n2. Run `memory_search` for relevant prior context\n3. Check memory/YYYY-MM-DD.md for recent activity\n\n### During Conversation\n1. **User gives concrete detail?** → Write to SESSION-STATE.md BEFORE responding\n2. **Important decision made?** → Store in Git-Notes (SILENTLY)\n3. **Preference expressed?** → `memory_store` with importance=0.9\n\n### On Session End\n1. Update SESSION-STATE.md with final state\n2. Move significant items to MEMORY.md if worth keeping long-term\n3. Create/update daily log in memory/YYYY-MM-DD.md\n\n### Memory Hygiene (Weekly)\n1. Review SESSION-STATE.md — archive completed tasks\n2. Check LanceDB for junk: `memory_recall query=\"*\" limit=50`\n3. Clear irrelevant vectors: `memory_forget id=<id>`\n4. Consolidate daily logs into MEMORY.md\n\n## The WAL Protocol (Critical)\n\n**Write-Ahead Log:** Write state BEFORE responding, not after.\n\n| Trigger | Action |\n|---------|--------|\n| User states preference | Write to SESSION-STATE.md → then respond |\n| User makes decision | Write to SESSION-STATE.md → then respond |\n| User gives deadline | Write to SESSION-STATE.md → then respond |\n| User corrects you | Write to SESSION-STATE.md → then respond |\n\n**Why?** If you respond first and crash/compact before saving, context is lost. WAL ensures durability.\n\n## Example Workflow\n\n```\nUser: \"Let's use Tailwind for this project, not vanilla CSS\"\n\nAgent (internal):\n1. Write to SESSION-STATE.md: \"Decision: Use Tailwind, not vanilla CSS\"\n2. Store in Git-Notes: decision about CSS framework\n3. memory_store: \"User prefers Tailwind over vanilla CSS\" importance=0.9\n4. THEN respond: \"Got it — Tailwind it is...\"\n```\n\n## Maintenance Commands\n\n```bash\n# Audit vector memory\nmemory_recall query=\"*\" limit=50\n\n# Clear all vectors (nuclear option)\nrm -rf ~/.openclaw/memory/lancedb/\nopenclaw gateway restart\n\n# Export Git-Notes\npython3 memory.py -p . export --format json > memories.json\n\n# Check memory health\ndu -sh ~/.openclaw/memory/\nwc -l MEMORY.md\nls -la memory/\n```\n\n## Why Memory Fails\n\nUnderstanding the root causes helps you fix them:\n\n| Failure Mode | Cause | Fix |\n|--------------|-------|-----|\n| Forgets everything | `memory_search` disabled | Enable + add OpenAI key |\n| Files not loaded | Agent skips reading memory | Add to AGENTS.md rules |\n| Facts not captured | No auto-extraction | Use Mem0 or manual logging |\n| Sub-agents isolated | Don't inherit context | Pass context in task prompt |\n| Repeats mistakes | Lessons not logged | Write to memory/lessons.md |\n\n## Solutions (Ranked by Effort)\n\n### 1. Quick Win: Enable memory_search\n\nIf you have an OpenAI key, enable semantic search:\n\n```bash\nopenclaw configure --section web\n```\n\nThis enables vector search over MEMORY.md + memory/*.md files.\n\n### 2. Recommended: Mem0 Integration\n\nAuto-extract facts from conversations. 80% token reduction.\n\n```bash\nnpm install mem0ai\n```\n\n```javascript\nconst { MemoryClient } = require('mem0ai');\n\nconst client = new MemoryClient({ apiKey: process.env.MEM0_API_KEY });\n\n// Auto-extract and store\nawait client.add([\n { role: \"user\", content: \"I prefer Tailwind over vanilla CSS\" }\n], { user_id: \"ty\" });\n\n// Retrieve relevant memories\nconst memories = await client.search(\"CSS preferences\", { user_id: \"ty\" });\n```\n\n### 3. Better File Structure (No Dependencies)\n\n```\nmemory/\n├── projects/\n│ ├── strykr.md\n│ └── taska.md\n├── people/\n│ └── contacts.md\n├── decisions/\n│ └── 2026-01.md\n├── lessons/\n│ └── mistakes.md\n└── preferences.md\n```\n\nKeep MEMORY.md as a summary (<5KB), link to detailed files.\n\n## Immediate Fixes Checklist\n\n| Problem | Fix |\n|---------|-----|\n| Forgets preferences | Add `## Preferences` section to MEMORY.md |\n| Repeats mistakes | Log every mistake to `memory/lessons.md` |\n| Sub-agents lack context | Include key context in spawn task prompt |\n| Forgets recent work | Strict daily file discipline |\n| Memory search not working | Check `OPENAI_API_KEY` is set |\n\n## Troubleshooting\n\n**Agent keeps forgetting mid-conversation:**\n→ SESSION-STATE.md not being updated. Check WAL protocol.\n\n**Irrelevant memories injected:**\n→ Disable autoCapture, increase minImportance threshold.\n\n**Memory too large, slow recall:**\n→ Run hygiene: clear old vectors, archive daily logs.\n\n**Git-Notes not persisting:**\n→ Run `git notes push` to sync with remote.\n\n**memory_search returns nothing:**\n→ Check OpenAI API key: `echo $OPENAI_API_KEY`\n→ Verify memorySearch enabled in openclaw.json\n\n---\n\n## Links\n\n- bulletproof-memory: https://clawdhub.com/skills/bulletproof-memory\n- lancedb-memory: https://clawdhub.com/skills/lancedb-memory\n- git-notes-memory: https://clawdhub.com/skills/git-notes-memory\n- memory-hygiene: https://clawdhub.com/skills/memory-hygiene\n- supermemory: https://clawdhub.com/skills/supermemory\n\n---\n\n*Built by [@NextXFrontier](https://x.com/NextXFrontier) — Part of the Next Frontier AI toolkit*\n"
}
}