← 返回
未分类 中文

Memory Tools

Agent-controlled memory plugin for OpenClaw with confidence scoring, decay, and semantic search. The agent decides WHEN to store/retrieve memories — no auto-...
OpenClaw代理控制记忆插件,具备置信度评分、衰减和语义搜索;代理自行决定何时存取记忆,不自动。
gianni-dalerta
未分类 clawhub v2.0.4 1 版本 99583.6 Key: 无需
★ 4
Stars
📥 3,029
下载
💾 2
安装
1
版本
#latest

概述

Memory Tools v2

Agent-controlled persistent memory for OpenClaw.

What's New in v2

  • File-based storage — Memories stored as readable markdown files
  • No external APIs — No OpenAI dependency, everything runs locally
  • QMD search (optional) — BM25 + vector + reranking via local GGUF models
  • Auto-migration — Seamlessly upgrades from v1 SQLite/LanceDB storage

Why Memory-as-Tools?

Traditional memory systems auto-capture everything, flooding context with irrelevant information. Memory Tools follows the AgeMem approach: the agent decides when to store and retrieve memories.

Features

  • 6 Memory Tools: memory_store, memory_update, memory_forget, memory_search, memory_summarize, memory_list
  • Confidence Scoring: Track how certain you are (1.0 = explicit, 0.5 = inferred)
  • Importance Scoring: Prioritize critical instructions over nice-to-know facts
  • Decay/Expiration: Temporal memories automatically become stale
  • Human-readable storage: Markdown files with YAML frontmatter
  • Conflict Resolution: New info auto-supersedes old (no contradictions)

Installation

Step 1: Install from ClawHub

clawhub install memory-tools

Step 2: Build the plugin

cd skills/memory-tools
npm install
npm run build

Step 3: Activate the plugin

openclaw plugins install --link .
openclaw plugins enable memory-tools

Step 4: Restart the gateway

openclaw gateway restart

Optional: Install QMD for better search

npm install -g @tobilu/qmd

Without QMD, basic filtering works. With QMD, you get semantic search (BM25 + vector + reranking).

Node Compatibility (QMD)

  • QMD may not be compatible with the newest Node ABI immediately.
  • If QMD fails (for example NODE_MODULE_VERSION mismatch), memory-tools falls back to basic mode.
  • To force basic mode: MEMORY_TOOLS_DISABLE_QMD=true.
  • For best QMD stability, use a Node LTS version supported by your installed QMD build.

Security Model

  • No API keys or external credentials are required.
  • Data is stored locally in ~/.openclaw/memories (or configured memoriesPath).
  • The plugin can prepend standing-instruction context at before_agent_start when autoInjectInstructions=true.
  • The plugin can auto-migrate legacy v1 data from ~/.openclaw/memory/tools/memory.db when autoMigrateLegacy=true.
  • Defaults are conservative: both autoInjectInstructions and autoMigrateLegacy are false.

Storage Format

Memories are stored as markdown files in ~/.openclaw/memories/:

~/.openclaw/memories/
├── facts/
│   └── abc123-def4-5678-90ab-cdef12345678.md
├── preferences/
│   └── def456-7890-abcd-ef12-345678901234.md
├── instructions/
│   └── ghi789-0abc-def1-2345-678901234567.md
└── .deleted/
    └── old-memory.md

Each memory file:

---
id: abc123-def4-5678-90ab-cdef12345678
category: preference
confidence: 0.9
importance: 0.7
created_at: 2024-01-15T10:30:00Z
tags: [ui, settings]
---

User prefers dark mode in all applications.

Memory Categories

CategoryUse ForExample
----------------------------
factStatic information"User's dog is named Rex"
preferenceLikes/dislikes"User prefers dark mode"
eventTemporal things"Dentist Tuesday 3pm"
relationshipPeople connections"Sarah is user's wife"
instructionStanding orders"Always respond in Spanish"
decisionChoices made"We decided to use PostgreSQL"
contextSituational info"User is job hunting"
entityNamed things"Project Apollo is their startup"

Tool Reference

memory_store

memory_store({
  content: "User prefers bullet points",
  category: "preference",
  confidence: 0.9,
  importance: 0.7,
  tags: ["formatting", "communication"]
})

memory_search

memory_search({
  query: "formatting preferences",
  category: "preference",
  limit: 10
})

memory_update

memory_update({
  id: "abc123",
  content: "User now prefers numbered lists",
  confidence: 1.0
})

memory_forget

memory_forget({
  query: "bullet points",
  reason: "User corrected preference"
})

memory_summarize

memory_summarize({
  topic: "user's work projects",
  maxMemories: 20
})

memory_list

memory_list({
  category: "instruction",
  sortBy: "importance",
  limit: 20
})

CLI Commands

# Show memory statistics
openclaw memory-tools stats

# List memories
openclaw memory-tools list
openclaw memory-tools list --category fact

# Search memories (requires QMD)
openclaw memory-tools search "dark mode"

# Export all memories as JSON
openclaw memory-tools export

# Force re-index with QMD
openclaw memory-tools reindex

# Show storage path
openclaw memory-tools path

Debugging

Memories are plain markdown files — just read them:

cat ~/.openclaw/memories/facts/*.md
ls ~/.openclaw/memories/

Export all memories:

openclaw memory-tools export > memories.json

Migration from v1

v2 automatically detects v1 databases and migrates them:

  1. On startup, v2 checks for ~/.openclaw/memory/tools/memory.db
  2. If found, exports all memories to markdown files
  3. Original database preserved as backup
  4. No manual action required

To enable auto-migration, set autoMigrateLegacy: true in plugin config.

License

MIT — Purple Horizons

版本历史

共 1 个版本

  • v2.0.4 当前
    2026-05-12 04:18 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-intelligence

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,374 📥 319,825
ai-intelligence

self-improving agent

pskoett
捕获经验教训、错误及修正内容,以实现持续改进。适用于以下场景:(1)命令或操作意外失败;(2)用户纠正Claude(如“不,那不对……”“实际上……”);(3)用户请求的功能不存在;(4)外部API或工具出现故障;(5)Claude发现自身
★ 4,073 📥 805,933
security-compliance

Skill Vetter

spclaudehome
AI智能体技能安全预审工具。安装ClawdHub、GitHub等来源技能前,检查风险信号、权限范围及可疑模式。
★ 1,223 📥 267,422