首页龙虾技能列表 › Session Cleanup Pro — 技能工具

🧹 Session Cleanup Pro — 技能工具

v0.3.0

Clean orphan .jsonl files and stale sessions in OpenClaw session storage with safe confirmation flow. 适用于会话列表杂乱、历史会话堆积、需要释放存储空间场景;默认保护 72 小时内会话,删除前必须用户确认。

0· 360·0 当前·0 累计
by @irideas·MIT-0
下载技能包
License
MIT-0
最后更新
2026/3/6
安全扫描
VirusTotal
无害
查看报告
OpenClaw
安全
high confidence
The skill's code and instructions match its stated purpose (scanning and guiding safe cleanup of OpenClaw session files); it requests only bash/node, performs only local filesystem scanning, and requires explicit user confirmation before destructive actions.
评估建议
This skill appears to do what it says: scan the OpenClaw session directory and propose deletions. Before running any cleanup: 1) Run the scan only (./skills/session-cleanup/scripts/scan_sessions.sh scan) and carefully inspect the JSON output. 2) Back up sessions.json and any .jsonl files you might want to keep (or archive them to a different directory) rather than immediate rm. 3) Be mindful of OPENCLAW_STATE_DIR and OPENCLAW_AGENT_ID environment overrides — if they are set, the script will oper...
详细分析 ▾
用途与能力
Name/description, included script (scripts/scan_sessions.sh), and SKILL.md are consistent: the skill scans sessions.json and the sessions directory for orphan .jsonl and stale sessions. Required binaries (bash, node) are appropriate for the provided scripts. No unrelated credentials, config paths, or third-party services are requested.
指令范围
SKILL.md enforces a scan → confirm → apply flow and documents destructive commands (rm) to remove orphan .jsonl and update sessions.json. The provided script only performs a read-only scan and outputs JSON; deletion instructions are explicit in SKILL.md but not implemented as an automated delete in scripts. This is coherent, but the instructions do include direct rm commands (destructive) so operator confirmation and backups are essential.
安装机制
No install spec (instruction-only + one local script). Nothing is downloaded or extracted from external URLs; code is included in the package. This is low-risk from an install perspective.
凭证需求
The skill does not require credentials or config paths. The script honors optional environment overrides OPENCLAW_STATE_DIR and OPENCLAW_AGENT_ID (with safe defaults). Those are proportional and relevant to locating session files.
持久化与权限
always is false and the skill is user-invocable. It does not attempt to modify other skills or agent-wide settings. It does not persist credentials or try to enable itself automatically.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv0.3.02026/3/6
● 无害

安装命令 点击复制

官方npx clawhub@latest install session-cleanup-pro
镜像加速npx clawhub@latest install session-cleanup-pro --registry https://cn.clawhub-mirror.com

技能文档

清理 OpenClaw 会话目录中的孤儿文件与过期会话,优先安全、可审计。

使用方式

先扫描,再确认,再执行:

  • 扫描(只读)
  • 生成清理计划
  • 用户确认
  • 执行清理并回报结果

关键文件

  • 扫描脚本:scripts/scan_sessions.sh
  • 清理策略:references/policy.md

扫描命令(必做)

./skills/session-cleanup/scripts/scan_sessions.sh scan

返回 JSON 包含:

  • orphanFiles:磁盘存在但 sessions.json 未登记的 .jsonl
  • staleSessions:超过 72 小时且非受保护会话
  • protectedSessions:当前会话 + 72 小时保护窗口内会话

执行规则

  • 必须先扫描并展示摘要
  • 必须询问用户确认后才清理
  • 默认不删除受保护会话
  • 永不删除 agent:main:main

清理建议

A. 先处理孤儿文件(优先)

在用户确认后删除孤儿文件:

rm ~/.openclaw/agents/main/sessions/.jsonl

B. 再处理过期会话(谨慎)

仅在用户明确确认后执行,删除对应 .jsonl,并更新 sessions.json 去除条目。

输出模板

🧹 会话清理扫描完成

  • 注册会话:X
  • 磁盘 jsonl:Y
  • 孤儿文件:A
  • 过期会话:B
  • 受保护会话:C

预计可释放:N MB

是否按上述计划执行清理?

发布前自检

# 1) 脚本可执行
./skills/session-cleanup/scripts/scan_sessions.sh scan >/tmp/session-cleanup-report.json

# 2) 输出为有效 JSON node -e "JSON.parse(require('fs').readFileSync('/tmp/session-cleanup-report.json','utf8')); console.log('OK')"

数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务