Token导航 LogoToken导航TokenDH.com
研究检索敏感数据clawhub未标认证来源可访问clear审计提醒

liu-longterm-memory刘长期记忆

Agent Skill

liu-longterm-memory 用于查找、检索和筛选相关信息,适合在 OpenClaw 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

2,770

周安装

119

GitHub Stars

公开资料未说明

下载量

971
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:liu-longterm-memory(刘长期记忆)
来源仓库:https://github.com/louiseliu/liu-longterm-memory
安装命令:
openclaw skills install liu-longterm-memory
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install liu-longterm-memory

简介

liu-longterm-memory 用于查找、检索和筛选相关信息,适合在 OpenClaw 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。

  • 适用于 Cursor、Claude、ChatGPT 和 Copilot 的终极 AI 代理记忆系统,支持 WAL 协议和云备份。
  • 通过安装命令 openclaw skills install liu-longterm-memory 集成到 OpenClaw 宿主环境。
  • 使用前需确认权限范围、维护状态及是否涉及联网、命令执行或文件读写。
  • 建议结合来源仓库和原始 README 进一步核验具体用法和功能边界。

SKILL.md

name
liu-longterm-memory
version
1.0.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
🧠

Elite Longterm Memory 🧠

The ultimate memory system for AI agents. Combines 6 layers 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)            │
│                  └─────────────┘                                │
│                          │                                      │
│                          ▼                                      │
│                  ┌─────────────┐                                │
│                  │   Backup    │  ← zip / Git remote (optional) │
│                  │ zip / Gitee │                                │
│                  └─────────────┘                                │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

The 6 Memory Layers

Layer 1: HOT RAM (SESSION-STATE.md)

From: bulletproof-memory

Active working memory that survives compaction. Write-Ahead Log protocol.

# 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.

# Auto-recall (happens automatically)
memory_recall query="project status" limit=5

# Manual store
memory_store text="User prefers dark mode" category="preference" importance=0.9

Layer 3: COLD STORE (Git-Notes Knowledge Graph)

From: git-notes-memory

Structured decisions, learnings, and context. Branch-aware.

# 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: BACKUP (zip / Git Remote) — Optional

Cross-device sync and disaster recovery. Use the CLI commands:

zip Backup (简单快速)

npx liu-longterm-memory backup
# → Creates memory-backup-20260404-153022.zip

npx liu-longterm-memory restore memory-backup-20260404-153022.zip
# → Restores from backup

Git Remote Backup (推荐,支持版本历史)

npx liu-longterm-memory backup --git
# → Commits and pushes memory files to your Git remote

# Tip: Use Gitee for domestic users (国内推荐)
# git remote add origin https://gitee.com/your-username/my-memory

Benefits:

  • Version history: Track how decisions evolved over time
  • Cross-device sync: Pull on any machine
  • Free: GitHub and Gitee both offer free private repos
  • 国内直连: Gitee 无需代理

Layer 6: AUTO-EXTRACTION (LLM-Powered)

Automatic fact extraction from conversations using LLM. Two modes:

Mode A: Agent-Driven Extraction (零依赖,默认)

No external service needed. The agent follows these rules to auto-extract facts:

Detected PatternAuto-Action
User states a preferenceWrite to MEMORY.md ## Preferences + memory_store (importance=0.9)
User makes a decisionWrite to MEMORY.md ## Decisions Log + Git-Notes
User gives a deadline/dateWrite to SESSION-STATE.md ## Key Context
User mentions a tech stackWrite to MEMORY.md ## Projects
User corrects the agentUpdate SESSION-STATE.md + memory/lessons.md
Session endsDistill key facts into memory/YYYY-MM-DD.md

Mode B: LLM Batch Extraction (智谱免费模型,推荐)

Use ZhipuAI's free GLM-4-Flash model to batch-extract facts from conversation history. Zero cost.

Call the GLM-4-Flash chat completions endpoint with a system prompt:

"Extract structured facts from the conversation. Return JSON array: [{type, content, importance}]. Types: preference, decision, fact, deadline, correction."

Then write each extracted fact to the appropriate memory layer.

  • Free: GLM-4-Flash 完全免费,在 https://bigmodel.cn/ 注册获取密钥
  • Automatic: Extracts preferences, decisions, facts, deadlines
  • 国内直连: No proxy needed
  • 80% token reduction vs raw conversation history

Quick Setup

1. Create SESSION-STATE.md (Hot RAM)

cat > 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]*
EOF

2. Enable LanceDB (Warm Store) — Optional

No API key required for core memory. Layers 1/3/4 (SESSION-STATE.md, Git-Notes, MEMORY.md) work without any key. LanceDB vector search is an optional enhancement.

Choose your embedding provider in your config file (~/.openclaw/openclaw.json or ~/.clawdbot/clawdbot.json):

Option A: ZhipuAI (国内推荐,免费额度充足)

{
  "memorySearch": {
    "enabled": true,
    "provider": "openai-compatible",
    "baseURL": "https://open.bigmodel.cn/api/paas/v4",
    "model": "embedding-3",
    "apiKeyEnv": "ZHIPUAI_API_KEY",
    "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
        }
      }
    }
  }
}

Register at https://bigmodel.cn/ to get your free key, then set the ZHIPUAI_API_KEY environment variable.

Option B: Local Ollama (完全免费,离线可用)

{
  "memorySearch": {
    "enabled": true,
    "provider": "openai-compatible",
    "baseURL": "http://localhost:11434/v1",
    "model": "nomic-embed-text",
    "apiKeyEnv": "",
    "sources": ["memory"],
    "minScore": 0.3,
    "maxResults": 10
  }
}
# Install and pull embedding model
ollama pull nomic-embed-text

Option C: Any OpenAI-Compatible API (通用方案)

Works with OpenAI, DeepSeek, Moonshot, 通义千问, or any service with an OpenAI-compatible /v1/embeddings endpoint.

{
  "memorySearch": {
    "enabled": true,
    "provider": "openai-compatible",
    "baseURL": "https://api.openai.com/v1",
    "model": "text-embedding-3-small",
    "apiKeyEnv": "OPENAI_API_KEY",
    "sources": ["memory"],
    "minScore": 0.3,
    "maxResults": 10
  }
}

Set the environment variable matching your apiKeyEnv config (e.g. OPENAI_API_KEY, DEEPSEEK_API_KEY, or DASHSCOPE_API_KEY).

Option D: Disabled (纯文件记忆,无需任何 Key)

{
  "memorySearch": {
    "enabled": false
  }
}

Memory still works via SESSION-STATE.md, MEMORY.md, Git-Notes, and daily logs — just without vector semantic search.

3. Initialize Git-Notes (Cold Store)

cd ~/clawd
git init  # if not already
python3 skills/git-notes-memory/memory.py -p . sync --start

4. Verify MEMORY.md Structure

# Ensure you have:
# - MEMORY.md in workspace root
# - memory/ folder for daily logs
mkdir -p memory

5. (Optional) Setup Backup

# Option 1: zip backup (one command)
npx liu-longterm-memory backup

# Option 2: Git remote backup (推荐,支持版本历史)
npx liu-longterm-memory backup --git

# Restore from backup
npx liu-longterm-memory restore memory-backup-20260404.zip

Agent 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 (Auto-Extraction)

For every user message, scan for extractable facts and act BEFORE responding (WAL):

  1. Preference detected? → Write to SESSION-STATE.md + append to MEMORY.md ## Preferences + memory_store (importance=0.9)
  2. Decision made? → Write to SESSION-STATE.md + append to MEMORY.md ## Decisions Log + Git-Notes (SILENTLY)
  3. Deadline/date given? → Write to SESSION-STATE.md ## Key Context
  4. Tech stack mentioned? → Append to MEMORY.md ## Projects
  5. Correction received? → Update SESSION-STATE.md + log to memory/lessons.md
  6. Other concrete detail? → Write to SESSION-STATE.md ## Key Context
  7. Backup requested? (user says "备份" / "backup" / "save memory") → Run npx liu-longterm-memory backup (zip) or npx liu-longterm-memory backup --git (Git)

On Session End

  1. Update SESSION-STATE.md with final state
  2. Distill session facts into MEMORY.md (if worth keeping long-term)
  3. Create/update daily log in memory/YYYY-MM-DD.md with:

- Tasks completed - Decisions made - Lessons learned - Action items for next session

  1. (Optional) If significant changes were made, suggest: npx liu-longterm-memory backup

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
  5. Run backup: npx liu-longterm-memory backup or npx liu-longterm-memory backup --git

The WAL Protocol (Critical)

Write-Ahead Log: Write state BEFORE responding, not after.

TriggerAction
User states preferenceWrite to SESSION-STATE.md → then respond
User makes decisionWrite to SESSION-STATE.md → then respond
User gives deadlineWrite to SESSION-STATE.md → then respond
User corrects youWrite 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..."

Supported Embedding Providers

Any service with an OpenAI-compatible /v1/embeddings endpoint works. Tested providers:

ProviderbaseURLModelFree Tier
ZhipuAI 智谱https://open.bigmodel.cn/api/paas/v4embedding-32500 万 tokens 免费
Ollama (local)http://localhost:11434/v1nomic-embed-text完全免费离线
OpenAIhttps://api.openai.com/v1text-embedding-3-smallPaid
DeepSeekhttps://api.deepseek.com/v1deepseek-embeddingFree tier available
通义千问https://dashscope.aliyuncs.com/compatible-mode/v1text-embedding-v3Free tier available

Maintenance Commands

# Check memory health
npx liu-longterm-memory status

# Create zip backup
npx liu-longterm-memory backup

# Git backup (commit + push)
npx liu-longterm-memory backup --git

# Restore from backup
npx liu-longterm-memory restore memory-backup-20260404.zip

# Audit vector memory
memory_recall query="*" limit=50

# Clear all vectors (nuclear option)
rm -rf ~/.openclaw/memory/lancedb/   # or ~/.clawdbot/memory/lancedb/
openclaw gateway restart

# Export Git-Notes
python3 memory.py -p . export --format json > memories.json

# Check disk usage
du -sh ~/.openclaw/memory/       # or ~/.clawdbot/memory/
wc -l MEMORY.md
ls -la memory/

Why Memory Fails

Understanding the root causes helps you fix them:

Failure ModeCauseFix
Forgets everythingmemory_search disabledEnable memorySearch + configure embedding provider (see Setup)
Files not loadedAgent skips reading memoryAdd to AGENTS.md rules
Facts not capturedNo auto-extractionEnsure Agent follows Auto-Extraction rules (Layer 6)
Sub-agents isolatedDon't inherit contextPass context in task prompt
Repeats mistakesLessons not loggedWrite to memory/lessons.md

Solutions (Ranked by Effort)

1. Quick Win: Enable memory_search

Enable semantic search with any OpenAI-compatible embedding provider:

openclaw configure --section web

This enables vector search over MEMORY.md + memory/*.md files. See the Enable LanceDB section above for provider configuration (ZhipuAI, Ollama, OpenAI, etc.).

2. LLM-Powered Auto-Extraction (Recommended)

Use the built-in auto-extraction rules (Layer 6) + optional LLM batch extraction with ZhipuAI's free GLM-4-Flash model. The agent scans each message for preferences, decisions, deadlines, and corrections, then writes them to the appropriate memory layer before responding. See Layer 6 for setup details.

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

ProblemFix
Forgets preferencesAdd ## Preferences section to MEMORY.md
Repeats mistakesLog every mistake to memory/lessons.md
Sub-agents lack contextInclude key context in spawn task prompt
Forgets recent workStrict daily file discipline
Memory search not workingCheck your configured env var 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: → Verify your configured env var is set (check apiKeyEnv in config) → Verify memorySearch enabled in openclaw.json (or clawdbot.json) → Verify baseURL and model are correct for your provider


🇨🇳 国内用户指南

安装加速

# 使用 npmmirror 镜像加速安装
npx --registry https://registry.npmmirror.com liu-longterm-memory init

# 或全局设置镜像
npm config set registry https://registry.npmmirror.com

服务可用性

服务国内可用性说明
核心记忆 (SESSION-STATE.md, MEMORY.md, daily logs)✅ 完全可用纯本地文件,无网络依赖
LanceDB + 智谱AI✅ 完全可用智谱国内直连,免费额度充足
LanceDB + Ollama✅ 完全可用本地运行,无需网络
LanceDB + DeepSeek✅ 完全可用DeepSeek API 国内直连
Git-Notes✅ 完全可用本地 git 操作
LLM 事实提取 (GLM-4-Flash)✅ 完全可用智谱免费模型,国内直连
Backup (zip / Gitee)✅ 完全可用zip 本地备份 或 Gitee 远程同步
ClawdHub✅ 有国内镜像使用 mirror-cn.clawhub.com

推荐配置(国内最佳实践)

  1. 使用智谱AIOllama作为 embedding provider(见 Setup 章节)
  2. 使用内置 Auto-Extraction + GLM-4-Flash(免费,国内直连)
  3. 使用 zipGitee 远程仓库备份记忆文件
  4. 通过国内镜像安装 npm 包

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
  • ClawdHub 国内镜像: https://mirror-cn.clawhub.com

*Built by @NextXFrontier — Part of the Next Frontier AI toolkit*

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

76.7%
按下载量换算745

安全审计

VirusTotal

未展示

ClawScan

可疑

Static analysis

可疑

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills