Xpersona
G

Good Memory

CLAWHUB · Unverified

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

62
Rank
84
Safety
1.0k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1K downloads reported by the source. Last updated 10/11/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17bybywgzwxze2r4t18kswvd583nxak:good-memory
  1. Install using `clawhub skill install s17bybywgzwxze2r4t18kswvd583nxak:good-memory` in an isolated environment before connecting it to live workloads.
  2. No published capability contract is available yet, so validate auth and request/response behavior manually.
  3. Review the upstream CLAWHUB listing at https://clawhub.ai/acilgit/good-memory before using production credentials.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-acilgit-good-memory/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

74,424 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: good-memory
version: 2.0.1
description: Session 历史记录恢复技能。Session重置后自动恢复对话上下文,解决系统自动重置导致的"失忆"问题。
homepage: https://github.com/openclaw/openclaw
metadata: {"openclaw":{"emoji":"🧠","requires":{"bins":["bash","tail","ls","python3"]}}}
---

# 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"
        ]
      }
    }
  }
}
```

_meta.json

{
  "ownerId": "kn7a8nxq8gtxyj996557bs6fph83mj2n",
  "slug": "good-memory",
  "version": "2.0.1",
  "publishedAt": 1774670149383
}

CHANGELOG.md

# Good-Memory Changelog

## v2.0.1 (2026-03-28)

### 核心修复:自动重置检测失效问题

**问题**:v2.0.0 仅识别显式重置(session 被重命名为 `.reset.` 后缀),但系统自动会话轮换/重启时不会打 reset 标记,导致恢复机制不触发。

**修复内容**:
- ✅ 新增**隐式会话切换检测**:支持系统自动轮换会话的场景,无需 reset 标记也能触发恢复
- ✅ 双重检测逻辑:同时支持显式重置(.reset 后缀)和隐式切换(UUID 变化)
- ✅ 修复潜在的跨用户会话污染问题
- ✅ 恢复记录从30条提升到50条,保留更完整上下文

#### 技术细节
- `maintenance.sh detect` 新增隐式切换识别,当新旧 UUID 不同但无 reset 文件时也标记为重置
- `autorecover.py` 新增额外检查逻辑,确保会话切换时总能找到上一个会话
- 兼容所有重置场景:手动执行 /reset、系统自动重置、后台服务重启

---

## v2.0.0 (2026-03-28)

### 重大更新:去掉中间文件机制
同 v1.3.0 升级,完全移除所有中间文件,直接基于 tracker JSON + session JSONL 工作。

---

## v1.3.0 (2026-03-27)

### 重大架构调整:完全去掉中间文件

**核心变化**:detect 不再写任何中间文件,Agent 直接读 tracker JSON + session JSONL。

#### 主要变化

- **完全移除中间文件机制**:不再写 `.gm-context-*.txt`、`.gm-history-*.txt`、`.gm-ended-*.txt`
- **detect 只更新 tracker**:写入 `last_history.file` + `last_history.ended_at`,不产生任何文件
- **Agent 自己读 tracker JSON**:从 `agents.{agent}.{chat_id}.last_history` 获取旧 session 路径
- **Agent 直接读 session JSONL**:解析最后 20-30 条记录(含 tool 操作),还原完整对话场景
- **恢复消息格式不变**:`已自动恢复 3月27日 16:45 之后说的话 📜 如果想要回忆更早的请对我说`

#### 文件变更

- `maintenance.sh`:移除 `get-history` 命令;detect 移除所有写文件逻辑
- `AGENTS.md`:更新指令流程,agent 自行解析 tracker + JSONL
- `SKILL.md`:重写文档,v1.3.0

#### 设计优势

- **零额外文件**:session JSONL 是唯一的数据源,无缓存、无中间状态
- **完整历史**:直接读取 JSONL,包含所有 tool_calls/tool_results,比摘要更丰富
- **更可靠**:没有中间文件就没有同步问题,tracker 就是唯一的真相来源

---

## v1.2.0 (2026-03-27)

### 重大架构调整

**不再使用中间文件存储上下文**。改为直接读取 session JSONL 文件,获得完整的对话历史(包括 tool_calls 等操作记录)。

#### 主要变化

- **新增 `get-history` 命令**:从 `last_history.file` 直接读取 session JSONL,解析并格式化最后 30 条记录,写入 `.gm-history-{chat_id}.txt`
- **detect 不再写上下文文件**:仅更新 tracker + 写入 `.gm-ended-{chat_id}.txt`(时间戳)
- **恢复消息格式简化**:首条回复改为 `已自动恢复 3月27日 16:45 之后说的话 📜 如果想要回忆更早的请对我说`(只有时间,无详细摘要)
- **读取内容更丰富**:直接解析 session JSONL,包含 user/assistant 消息和 tool 操作,比纯文本更完整

#### 技术细节

- `detect` 输出 `last_history:` + `last_session_created:`
- `get-history` 读取 `last_history.file`,格式化后写入 `.gm-history-{chat_id}.txt` 和 `.gm-ended-{chat_id}.txt`
- Agent 启动时依次执行 detect → get-history → 读取两个生成的文件

#### 文件变更

- `maintenance.sh`:移除 `format_history_jsonl`;新增 `get-history` 命令;detect 移除写上下文文件逻辑
- `AGENTS.md`:更新启动指令流程
- `SKILL.md`:重写文档,移除"context 文件"描述,改为"历史记录文件"

---

## v1.1.3 (2026-03-27)

### Bug 修复
- **Agent 路由错误**:修复 install.sh 中 tracker 的 agent 名称获取逻辑。之前错误地使用 session 文件存储目录(都是 "main"),现在正确从 `sessions.json` 的 `deliveryContext.accountId` 字段获取实际路由目标 Agent

### 技术细节
- 从 `sessions.json` 的 `deliveryContext.accountId` 字段获取实际路由 Agent,而不是用 session 文件的存储目录名
- 确保 tracker 中每个 session 正确映射到对应的 Agent(tuwen/guwen/xiangmu/main)

---

## v1.1.0 (2026-03-27)

### 新增
- **UUID 前缀比对**:tracker 新增 `active_uuid` 字段,verify 时优先比对 UUID 前缀(UUID 全局唯一,更可靠)
- **verify 输出新增 `last_history` 字段**:当检测到重置时,直接输出最近一次被重置的 session 文件路径

### 比对逻辑(双重验证)
1. **UUID 前缀比对**(主要)— UUID 全局唯一,前缀改变 = 一定是新 session
2. **Birth Time 比对**(辅助)— UUID 相同时,用 birth time 辅助确认

### 工作流程
```
每次收到消息:
  maintenance.sh update <agent> <chat_id>

Session 重置后恢复:
  1. maintenance.sh verify <agen

QUICKSTART.md

# Good Memory 快速开始

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

## 安装方式

### 🚀 快速安装(单Agent,推荐普通用户)
```bash
# 下载并解压到skills目录
mkdir -p ~/.openclaw/workspace/skills/good-memory
cd ~/.openclaw/workspace/skills/good-memory
curl -L https://wry-manatee-359.convex.site/api/v1/download?slug=good-memory | unzip -

# 执行单Agent安装(默认main)
INSTALL_MODE=single TARGET_AGENT=main bash scripts/install.sh
```

### 🔧 完整安装(多Agent,管理员使用)
```bash
# 下载并解压到skills目录
mkdir -p ~/.openclaw/workspace/skills/good-memory
cd ~/.openclaw/workspace/skills/good-memory
curl -L https://wry-manatee-359.convex.site/api/v1/download?slug=good-memory | unzip -

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

## 环境变量(可选)
如果你的OpenClaw安装在非默认路径,可以设置:
```bash
export OPENCLAW_BASE="/path/to/your/openclaw"
export TRACKER_FILE="/path/to/your/session-tracker.json"
```

## 使用说明
安装后无需额外操作,每次session启动时会自动:
1. 检测是否发生了重置
2. 如果检测到重置,自动恢复上一段对话的最后20-30条记录
3. 首条回复会提示:`已自动恢复 X月X日 XX:XX 之后说的话 📜 如果想要回忆更早的请对我说`

## 手动恢复
如果需要手动恢复更早的历史:
```bash
# 查看某Agent的所有重置历史
bash ~/.openclaw/workspace/skills/good-memory/scripts/recovery.sh list main

# 读取最新重置的100条记录
bash ~/.openclaw/workspace/skills/good-memory/scripts/recovery.sh read main --lines 100
```

## 支持平台
- ✅ 飞书
- ✅ Discord
- ✅ Telegram
- ✅ Signal
- ✅ 所有OpenClaw支持的聊天平台

skill-card.md

## Description:

Good Memory restores recent OpenClaw session history after a reset or session rotation so an agent can continue with prior conversation context.

This skill is ready for commercial/non-commercial use.

## Publisher:

[acilgit](https://clawhub.ai/user/acilgit)

### License/Terms of Use:

MIT-0

## Use Case:

External users and developers of OpenClaw use this skill to restore recent conversation context after a session reset or rotation. It is intended for OpenClaw environments where automatic session-start recovery is acceptable.

### Deployment Geography for Use:

Global

## Known Risks and Mitigations:

Risk: Automatic recovery can replay prior chat content into later sessions.

Mitigation: Enable automatic recovery only with informed user or administrator approval, and limit restored history to the minimum context needed.

Risk: The advertised one-line installer and persistence changes can modify local agent startup behavior.

Mitigation: Install only from a pinned, locally reviewed archive with a verified hash, review AGENTS.md changes before use, and keep a clear uninstall or rollback path.

Risk: Trackers and logs may expose session paths or recovered conversation context.

Mitigation: Restrict permissions on tracker and log files, and review storage locations before deployment.

## Reference(s):

- [Good Memory on ClawHub](https://clawhub.ai/acilgit/skills/good-memory)

## Skill Output:

**Output Type(s):** [text, shell commands, configuration, guidance]

**Output Format:** [Plain text recovery context with Markdown documentation and shell command examples]

**Output Parameters:** [1D]

**Other Properties Related to Output:** [Restores recent prior-session records when recovery is enabled; exact restored history depends on local OpenClaw session files and configuration.]

## Skill Version(s):

2.0.1 (source: SKILL.md frontmatter, release evidence, CHANGELOG released 2026-03-28)

## Ethical Considerations:

Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.

Sponsored

Ads related to Good Memory and adjacent AI workflows.