good-memory

Session 历史记录恢复技能。Session重置后自动恢复对话上下文,解决系统自动重置导致的"失忆"问题。

3,891 stars

Best use case

good-memory is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Session 历史记录恢复技能。Session重置后自动恢复对话上下文,解决系统自动重置导致的"失忆"问题。

Teams using good-memory should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/good-memory/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/acilgit/good-memory/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/good-memory/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How good-memory Compares

Feature / Agentgood-memoryStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Session 历史记录恢复技能。Session重置后自动恢复对话上下文,解决系统自动重置导致的"失忆"问题。

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Good-Memory v2.0.0

帮助 Agent 在 session 重置后快速恢复对话上下文。通过检测 `.reset.` 后缀的 session 文件实现,**安装后自动运行,无需手动操作**。

## 核心特性
- ✅ **全平台支持**:支持飞书、Discord、Telegram、Signal等所有OpenClaw平台
- ✅ **零配置**:安装后自动生效,不需要修改配置
- ✅ **轻量高效**:仅基于文件名匹配,不需要解析文件内容,速度快
- ✅ **低侵入性**:默认只修改main的AGENTS.md,不影响其他Agent
- ✅ **自动清理**:历史记录最多保留10条,自动清理过期文件

## 工作原理
1. **重置检测**:每次session启动时自动检测两种重置类型:
   - ✅ **显式重置**:session 文件被系统添加 `.reset.` 后缀(系统自动重置 /new /reset 命令触发)
   - ✅ **隐式切换**:新 session UUID 生成但旧 session 未打 reset 标记(系统自动会话轮换/后台重启触发)
2. **历史恢复**:如果检测到重置/切换,自动读取上一个会话文件的最后50条对话
3. **自动提示**:首条回复会告知用户已恢复历史记录

## 安装

### 🚀 一键安装(推荐)
```bash
# 下载并安装
curl -sSL https://wry-manatee-359.convex.site/api/v1/download?slug=good-memory | bash -s install
```

### 手动安装
```bash
# 1. 创建目录
mkdir -p ~/.openclaw/workspace/skills/good-memory
cd ~/.openclaw/workspace/skills/good-memory

# 2. 下载解压
curl -L https://wry-manatee-359.convex.site/api/v1/download?slug=good-memory | unzip -

# 3. 执行安装
bash scripts/install.sh
```

## 环境变量(可选)
如果你的OpenClaw安装在非默认路径,可以设置:
```bash
export OPENCLAW_BASE="/path/to/your/openclaw"  # 默认:/root/.openclaw
export SESSIONS_DIR="/path/to/sessions"        # 默认:$OPENCLAW_BASE/agents/main/sessions
export AGENTS_MD="/path/to/AGENTS.md"          # 默认:$OPENCLAW_BASE/workspace/AGENTS.md
```

## 手动使用
```bash
# 查看最新的reset文件
bash ~/.openclaw/workspace/skills/good-memory/scripts/recovery.sh latest

# 读取最新reset的50条记录
bash ~/.openclaw/workspace/skills/good-memory/scripts/recovery.sh read --lines 50

# 列出所有reset文件
bash ~/.openclaw/workspace/skills/good-memory/scripts/recovery.sh list
```

## 数据结构
`session-tracker.json` 格式(简化版):
```json
{
  "description": "Session tracker - maps agent+chat to session files",
  "last_updated": "2026-03-27T15:00:00Z",
  "agents": {
    "main": {
      "ou_123456": {
        "session_key": "",
        "active": "/path/to/current.jsonl",
        "active_uuid": "abc123",
        "last_history": "/path/to/old.jsonl.reset.2026-03-27T15:00:00Z",
        "history": [
          "/path/to/old.jsonl.reset.2026-03-27T15:00:00Z",
          "/path/to/older.jsonl.reset.2026-03-26T10:00:00Z"
        ]
      }
    }
  }
}
```

Related Skills

Agent Memory Architecture

3891
from openclaw/skills

Complete zero-dependency memory system for AI agents — file-based architecture, daily notes, long-term curation, context management, heartbeat integration, and memory hygiene. No APIs, no databases, no external tools. Works with any agent framework.

memory-cache

3891
from openclaw/skills

High-performance temporary storage system using Redis. Supports namespaced keys (mema:*), TTL management, and session context caching. Use for: (1) Saving agent state, (2) Caching API results, (3) Sharing data between sub-agents.

General Utilities

Memory

3891
from openclaw/skills

Infinite organized memory that complements your agent's built-in memory with unlimited categorized storage.

Memory Management

auto-memory

3891
from openclaw/skills

Indestructible agent memory — permanently stored, never lost. Save decisions, identity, and context as a memory chain on the Autonomys Network. Rebuild your full history from a single CID, even after total state loss.

AI Persistence & Memory

Triple-Layer Memory System

3880
from openclaw/skills

三层记忆系统 - 解决 AI Agent 长对话记忆丢失和上下文管理问题

Memory & Context Management

agent-memory-setup

3891
from openclaw/skills

Set up the full OpenClaw agent memory system with 3-tier memory (HOT/WARM/COLD), daily logs, semantic search (QMD), and lossless context management (Lossless Claw). Use when onboarding a new agent, setting up memory for a fresh OpenClaw instance, or when asked to install the memory system on a new agent. Triggers on "set up memory", "install memory system", "onboard new agent memory", "memory setup", "agent onboarding", "configure agent memory", "add memory to my agent", "how do I set up memory", "initialize memory", "memory system for OpenClaw".

agent-memory-setup-v2

3891
from openclaw/skills

Create a 3-tier memory directory structure (HOT/WARM/COLD) for OpenClaw agents and configure the built-in memory-core plugin to use Google Gemini Embeddings 2 (gemini-embedding-2-preview) for semantic memory search. Creates memory/ directories and stub files only — no code execution or external API calls from the setup script. After setup, the agent's memory_search tool uses Gemini's cloud embedding API to index memory files. Requires a free Google Gemini API key. Use when setting up a new agent's memory system or asked about semantic memory search. Triggers on "set up memory", "memory setup", "agent memory", "gemini memory", "semantic search memory", "onboard new agent".

feishu-memory-recall

3891
from openclaw/skills

Cross-group memory, search, and event sharing for OpenClaw Feishu agents

Cortex — Graph Memory Skill

3891
from openclaw/skills

You have access to **Cortex**, a self-organizing knowledge graph for persistent memory. Use it to remember facts, decisions, goals, patterns, and observations across sessions. Knowledge is stored as nodes in a graph that auto-links, decays stale information, detects contradictions, and computes trust from topology.

openclaw-memory

3891
from openclaw/skills

No description provided.

maasv Memory

3891
from openclaw/skills

Structured long-term memory for OpenClaw agents, powered by [maasv](https://github.com/ascottbell/maasv).

QMD Memory Skill for OpenClaw

3891
from openclaw/skills

## Local Hybrid Search — Save $50-300/month in API Costs