← Back to Skills Marketplace
8
Downloads
0
Stars
0
Active Installs
3
Versions
Install in OpenClaw
/install session-history-share
Description
Automatically injects compressed summaries of previous session histories into new sessions after daily reset for context continuity.
README (SKILL.md)
Session History Share
跨 Session 对话历史自动共享方案。在每日重置后,自动将旧 Session 的压缩摘要注入新 Session 上下文。
原理
每天 3:30 AM
→ Cron isolated session 获取所有活跃 session
→ 读取 JSONL 尾部,向前查找 compaction 事件
→ 有 compaction → 提取 summary
→ 无 compaction → 提取最近 200 条消息生成简要摘要
→ 写入 .session_history/\x3CsafeKey>/\x3CsafeKey>-YYYY-MM-DD.md
每天 4:00 AM
→ OpenClaw 定时重置 Session
新 Session 每轮
→ agent:bootstrap hook 读取最新存档(带 10 分钟缓存)
→ push BOOTSTRAP.md 到 bootstrapFiles
→ 摘要注入 prompt
安装
# 自动安装(创建 hook + 配置 cron)
node skills/session-history-share/scripts/install.sh
# 或手动安装
# 1. 复制 hook 目录到 ~/.openclaw/hooks/session-history-share/
# 2. 在 openclaw.json 注册 hook
# 3. 创建 cron 定时任务
配置
Hook 注册(openclaw.json)
{
"hooks": {
"internal": {
"enabled": true,
"entries": {
"session-history-share": {
"enabled": true
}
}
}
}
}
定时任务
openclaw cron add \
--name "定时压缩活跃会话" \
--cron "30 3 * * *" \
--tz "Asia/Shanghai" \
--session isolated \
--message "执行以下步骤压缩所有活跃会话:\
\
1. 使用 sessions_list 获取所有活跃 session(排除 cron 和 subagent)\
2. 对每个 session 的 transcriptPath(JSONL 文件),执行以下步骤:\
a. 使用 read 读取 JSONL 文件尾部(用 limit 从 offset 读取,不要读完整文件)\
b. 从最后一条消息向前查找,找到最近的 compaction 事件(type=compaction)\
c. 如果找到 compaction:提取 compaction.summary 字段的纯文本值\
d. 如果没找到 compaction:提取最近 200 条 user/assistant 消息,生成简要摘要\
e. 将摘要内容写入 .session_history/\x3CsafeSessionKey>/\x3CsafeSessionKey>-\x3CYYYY-MM-DD>.md\
- safeSessionKey 是把 sessionKey 中的冒号替换为下划线\
f. 生成的摘要在**不丢失关键内容**的情况下尽可能的**简短**\
1. **文件内容只包含摘要正文纯文本,不要写任何 metadata header(不要 Session Key、Date、分隔线、标题等)**\
2. 每个 sessionKey 只保留最近 3 个存档文件,删除旧的\
3. 完成后回复 NO_REPLY"
技术特点
- 自动压缩:提取 compaction summary 或生成简要摘要
- 每轮注入:通过
agent:bootstraphook 每轮注入 - 内存缓存:同 Session 内 10 分钟缓存过期,之后重新读取
- 存档轮转:每个 Session 保留最近 3 个存档
查看日志
openclaw logs | grep "session-history"
卸载
node skills/session-history-share/scripts/uninstall.sh
文件结构
session-history-share/
├── SKILL.md
├── README.md
├── scripts/
│ ├── install.sh
│ └── uninstall.sh
└── hook/
├── HOOK.md
└── handler.js
版本
- v1.0 - 轻量注入(自动压缩 + bootstrap 注入)
- v1.0.1 - 更新定时任务描述 + README 链接
- v1.0.2 - 添加缓存过期机制(10 分钟 TTL)
Usage Guidance
Install only if you intentionally want prior OpenClaw conversations summarized, stored on disk, and automatically injected into later sessions. Review the cron job and ~/.openclaw/openclaw.json changes, avoid using it with sessions containing secrets or client data unless you accept that carryover, and know how to remove the hook, cron task, and .session_history archives.
Capability Assessment
Purpose & Capability
The core purpose is coherent: preserve prior OpenClaw session context and inject it into future sessions. The concern is that this purpose inherently handles sensitive conversation data and can carry prior instructions or secrets into later prompts.
Instruction Scope
The artifacts disclose automatic extraction, storage, and bootstrap injection, but they do not provide clear opt-in boundaries, per-session exclusion, redaction, review, or consent before prior history is reintroduced.
Install Mechanism
The installer copies a hook, modifies ~/.openclaw/openclaw.json, and creates an OpenClaw cron task by default. These changes are purpose-aligned but persistent and high-trust, with no interactive confirmation or backup flow in the script.
Credentials
Reading active session transcript tails and storing summaries is proportionate to a history-sharing tool, but broad automatic collection of session content is sensitive and under-scoped for users who expect session isolation.
Persistence & Privilege
The skill creates ongoing scheduled processing, stores summaries under ~/.openclaw/workspace/.session_history, keeps recent archives, and injects them into BOOTSTRAP.md on agent bootstrap. An uninstall script exists, which reduces but does not remove the persistence concern.
How to Use
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install session-history-share - After installation, invoke the skill by name or use
/session-history-share - Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.2
添加缓存过期机制(10分钟TTL);更新 SKILL.md/README.md 文档
v1.0.1
更新定时任务描述为完整版本;添加 README.md 含 GitHub 和 ClawHub 链接
v1.0.0
初始版本:跨 Session 历史自动注入(轻量注入)。包含 agent:bootstrap hook + Cron 定时压缩 + 安装/卸载脚本
Metadata
Frequently Asked Questions
What is Session History Share?
Automatically injects compressed summaries of previous session histories into new sessions after daily reset for context continuity. It is an AI Agent Skill for Claude Code / OpenClaw, with 8 downloads so far.
How do I install Session History Share?
Run "/install session-history-share" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Session History Share free?
Yes, Session History Share is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does Session History Share support?
Session History Share is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Session History Share?
It is built and maintained by ouhaitao (@ouhaitao); the current version is v1.0.2.
More Skills