← 返回 Skills 市场
lmqiang-711

Session Memory Extractor

作者 lmqiang-711 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
48
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install session-memory-extractor
功能描述
OpenClaw 版 Claude-Mem:自动扫描旧 Session 文件,AI 提炼决策、偏好、事实,追加写入 memory/;同步清理 .jsonl + .trajectory.jsonl,释放数百 MB 磁盘。提炼比清理先跑,记忆不丢失。 OpenClaw's answer to Claude-Mem (71k GitHub stars): AI-scans old .jsonl/.trajectory.jsonl files, extracts decisions and facts into memory/, then safely deletes raw files. Extract first, cleanup second — context preserved, disk freed.
使用说明 (SKILL.md)

Session Memory Extractor

cn: OpenClaw 版 Claude-Mem:自动扫描旧 Session 文件,AI 提炼决策、偏好、事实,追加写入 memory/;同步清理 .jsonl + .trajectory.jsonl,释放数百 MB 磁盘。提炼比清理先跑,记忆不丢失。

en: OpenClaw's answer to Claude-Mem (71k GitHub stars): AI-scans old .jsonl/.trajectory.jsonl files, extracts decisions and facts into memory/, then safely deletes raw files. Extract first, cleanup second — context preserved, disk freed.


痛点

OpenClaw 的 Session 文件(.jsonl / .trajectory.jsonl)越积越多,用了几个月轻松达到数百 MB。

问题是:

  • 内置 Compaction 只在上下文快满时触发,不清理历史文件
  • 内置 Dreaming 不会从旧 .jsonl 里提取内容
  • 手动删除 .jsonl = 直接丢失所有上下文

解决思路

扫描 session 目录 → AI 提炼关键内容 → 写入 memory/ → 删除原始文件
  • 提炼:用 AI 从原始对话中提取决策、偏好、事实、待办,标注置信度
  • 写入:追加到 memory/YYYY-MM-DD.md,永久保留
  • 删除:同时清理 sessions.json 和磁盘上的 .jsonl / .trajectory.jsonl
  • 通知:完成后发送飞书报告

使用方法

前置条件

  • OpenClaw memory-core 插件已启用
  • MiniMax API Key(用于 AI 提炼)

运行命令

# 完整提取 + 清理
bash session-memory-extractor.sh --agent main

# 预览模式(只提炼,不删除)
bash session-memory-extractor.sh --agent main --dry-run

# 自定义保留天数(默认 7 天)
bash session-memory-extractor.sh --agent main --min-age 14

输出格式

控制台摘要

Sessions processed:   12
Entries extracted:    31
Total bytes freed:   47.3 MB
Memory written:       memory/2026-05-20.md

飞书通知

🧠 Session Memory Extractor | main

✅ 提炼完成

📊 处理摘要:
  • Session: 12 个
  • 提炼: 31 条
  • 释放: 47.3 MB

💾 磁盘变化:
  • .jsonl: 732 → 720 个
  • .trajectory: 193 → 188 个

📝 提炼内容已写入: memory/2026-05-20.md

memory/ 写入格式

## Extracted from session: {session-id}

- **[DECISION]** 用户选择了航天赛道作为主要内容方向
  Confidence: HIGH

- **[PREFERENCE]** 用户喜欢先给结论再展开
  Confidence: HIGH

多 Agent 支持

bash session-memory-extractor.sh --agent main      # ~/.openclaw/workspace/memory/
bash session-memory-extractor.sh --agent space      # ~/.openclaw/agents/space/workspace/memory/
bash session-memory-extractor.sh --agent math-tutor # ~/.openclaw/agents/math-tutor/workspace/memory/

触发调度

Skill 本身不内置定时,由用户自行配置:

\x3C!-- macOS LaunchAgent: 每周一 10:00 -->
\x3Ckey>Label\x3C/key>
\x3Cstring>com.user.session-memory-extractor\x3C/string>
\x3Ckey>ProgramArguments\x3C/key>
\x3Carray>
    \x3Cstring>/bin/bash\x3C/string>
    \x3Cstring>/path/to/session-memory-extractor.sh\x3C/string>
    \x3Cstring>--agent\x3C/string>
    \x3Cstring>main\x3C/string>
\x3C/array>
\x3Ckey>StartCalendarInterval\x3C/key>
\x3Cdict>
    \x3Ckey>Weekday\x3C/key>\x3Cinteger>1\x3C/integer>
    \x3Ckey>Hour\x3C/key>\x3Cinteger>10\x3C/integer>
    \x3Ckey>Minute\x3C/key>\x3Cinteger>0\x3C/integer>
\x3C/dict>

功能对比

功能 内置 Compaction 内置 Dreaming 本 Skill
从 .jsonl 提炼内容
写入 memory/ 仅 compaction 时 仅 light 阶段
提炼后删除原始文件
释放磁盘空间
支持 dry-run 预览

文件结构

session-memory-extractor/
├── SKILL.md                    ← 本文件
├── session-memory-extractor.sh  ← 主入口
├── run_extractor.py            ← Python 处理器
├── extract_session.py          ← AI 提炼
└── feishu_notify.py           ← 飞书通知
安全使用建议
This is an incomplete review: the workspace files were not readable through the available command runner, so the result should not be treated as a completed ClawScan assessment.
能力标签
requires-sensitive-credentials
能力评估
Purpose & Capability
Not assessed from artifacts because workspace command execution failed before files could be read.
Instruction Scope
Not assessed from artifacts because workspace command execution failed before files could be read.
Install Mechanism
Not assessed from artifacts because workspace command execution failed before files could be read.
Credentials
Not assessed from artifacts because workspace command execution failed before files could be read.
Persistence & Privilege
Not assessed from artifacts because workspace command execution failed before files could be read.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install session-memory-extractor
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /session-memory-extractor 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Session Memory Extractor v1.0.0 - Initial release. - Scans and processes old OpenClaw session files, using AI to extract key memories (decisions, preferences, facts, TODOs) with confidence scores. - Appends extracted content to dated memory files, preserving source and context. - Safely deletes original session files after extraction to reclaim disk space. - Includes dry-run mode for extraction preview without deletion. - Provides summary notifications of processed sessions, items extracted, and space freed.
元数据
Slug session-memory-extractor
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Session Memory Extractor 是什么?

OpenClaw 版 Claude-Mem:自动扫描旧 Session 文件,AI 提炼决策、偏好、事实,追加写入 memory/;同步清理 .jsonl + .trajectory.jsonl,释放数百 MB 磁盘。提炼比清理先跑,记忆不丢失。 OpenClaw's answer to Claude-Mem (71k GitHub stars): AI-scans old .jsonl/.trajectory.jsonl files, extracts decisions and facts into memory/, then safely deletes raw files. Extract first, cleanup second — context preserved, disk freed. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 48 次。

如何安装 Session Memory Extractor?

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

Session Memory Extractor 是免费的吗?

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

Session Memory Extractor 支持哪些平台?

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

谁开发了 Session Memory Extractor?

由 lmqiang-711(@lmqiang-711)开发并维护,当前版本 v1.0.0。

💬 留言讨论