← 返回 Skills 市场
szwangw

Long Term Memory

作者 szwangw · GitHub ↗ · v0.2.0 · MIT-0
cross-platform ✓ 安全检测通过
31
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install memory-for-openclaw
功能描述
Persistent, cross-session memory for OpenClaw agents. Automatically captures key facts, decisions, user preferences, and project context. Injects relevant me...
使用说明 (SKILL.md)

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:X tags 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.
安全使用建议
This skill appears acceptable if you want local long-term memory for your agent. Before installing, be comfortable with a local database of remembered facts, avoid saving secrets, periodically prune the memory store, and do not run the test files against your real workspace unless you are prepared to delete the sample entries afterward.
功能分析
Type: OpenClaw Skill Name: memory-for-openclaw Version: 0.2.0 The skill bundle implements a local long-term memory system for OpenClaw agents using SQLite and FTS5 for persistent storage and retrieval. The core logic in `scripts/memory_engine.py` and `scripts/setup.py` is well-implemented, using parameterized SQL queries to prevent injection and keeping all data within the local workspace (~/.openclaw/workspace/). No evidence of data exfiltration, unauthorized network access, or malicious prompt injection was found; the instructions in `SKILL.md` are entirely consistent with the stated goal of providing cross-session context and memory management.
能力评估
Purpose & Capability
The skill’s purpose is coherent: local long-term memory for OpenClaw agents. The sensitive behavior—capturing, storing, searching, and injecting user/project context—is disclosed and central to the skill.
Instruction Scope
The AGENTS.md guidance tells agents to inject memory at session start and save important user-shared facts. This is purpose-aligned, but users should ensure memories are treated as context rather than authoritative instructions.
Install Mechanism
No automatic install mechanism is declared. The setup script is user-directed and appears to create local config/database files rather than fetching or executing remote code.
Credentials
The skill writes a local SQLite database and debug context file under the OpenClaw workspace. This is proportionate for a memory skill, but those files may contain private project or user facts.
Persistence & Privilege
Persistent cross-session state is the main feature. No credentials, elevated privileges, cloud sync, or hidden background persistence are evidenced, but test scripts can write sample memories into the default store if run.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install memory-for-openclaw
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /memory-for-openclaw 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.2.0
**Major update: Persistent, cross-session memory skill for OpenClaw agents** - Adds automated, structured long-term memory using local SQLite with full-text search. - Replaces manual MEMORY.md with auto-capture of key facts, decisions, user preferences, and project context. - Provides scripts for saving, searching, injecting, and summarizing memories across sessions. - Automatic detection and tagging of important information from text. - Designed for privacy: all data stays local, no cloud required. - Integration instructions and workflow for AGENTS.md included.
元数据
Slug memory-for-openclaw
版本 0.2.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Long Term Memory 是什么?

Persistent, cross-session memory for OpenClaw agents. Automatically captures key facts, decisions, user preferences, and project context. Injects relevant me... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 31 次。

如何安装 Long Term Memory?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install memory-for-openclaw」即可一键安装,无需额外配置。

Long Term Memory 是免费的吗?

是的,Long Term Memory 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Long Term Memory 支持哪些平台?

Long Term Memory 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Long Term Memory?

由 szwangw(@szwangw)开发并维护,当前版本 v0.2.0。

💬 留言讨论