/install hypercho-session-cleanup
Session Cleanup
Automated cleanup of OpenClaw session storage across all registered agents.
What It Cleans
- Tombstone files —
.reset.*,.deleted.*,.bak-*(always safe to remove) - Old cron sessions —
.jsonlfiles +sessions.jsonentries older than 7 days for cron-type sessions - Orphan files —
.jsonlfiles on disk not referenced bysessions.json - Stale entries —
sessions.jsonentries pointing to missing.jsonlfiles (cron sessions only)
Safety Guarantees
- Never touches
.lockfiles or their corresponding active.jsonl - Never deletes
sessions.jsonitself - Backs up
sessions.jsonbefore modifying - Never removes non-cron sessions under 30 days old
- Never removes main session entries
Usage
Run cleanup for all agents
python3 \x3Cskill_dir>/scripts/session_cleanup.py
Dry run (preview only)
python3 \x3Cskill_dir>/scripts/session_cleanup.py --dry-run
Single agent only
python3 \x3Cskill_dir>/scripts/session_cleanup.py --agent main
Agent Discovery
The script automatically discovers all agents by scanning ~/.openclaw/agents/*/sessions/. No hardcoded agent list needed — new agents are picked up automatically.
Cron Integration
Set up as a daily midnight cron job for automatic maintenance:
Schedule: 0 0 * * * (midnight local time)
Model: minimax/MiniMax-M2.7-highspeed
Thinking: low
Timeout: 600s
Cron task message:
Single task only: run session cleanup for all agents.
Command:
bash -lc 'python3 \x3Cskill_dir>/scripts/session_cleanup.py'
Return ONLY the command stdout (no extra commentary).
Output Format
The script prints a summary per agent showing what was cleaned, then a grand total:
Agents discovered: 22
ada: 165 tombstones (21.1 MB), 7 old crons (372 KB)
vera: 924 tombstones (31.6 MB), 4 old crons (252 KB)
✅ Session cleanup complete across 22 agents
Freed: 171.6 MB
Cleaned: ada, vera
Already clean: main, clio, argus
If nothing needs cleaning, it reports "Already clean. Nothing to do."
Retention Policy
| Session Type | Retention | Action |
|---|---|---|
| Tombstones (.reset/.deleted/.bak) | 0 days | Always delete |
| Cron session files | 7 days | Delete after 7 days |
| Non-cron sessions | 30 days | Keep (no auto-delete) |
| Main sessions | Forever | Never touched |
| Active sessions (.lock) | Forever | Never touched |
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install hypercho-session-cleanup - 安装完成后,直接呼叫该 Skill 的名称或使用
/hypercho-session-cleanup触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Session Cleanup (Hypercho) 是什么?
Clean up OpenClaw session storage across all agents. Removes tombstone files (.reset, .deleted, .bak), old cron session .jsonl files, orphan files, and stale... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 140 次。
如何安装 Session Cleanup (Hypercho)?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install hypercho-session-cleanup」即可一键安装,无需额外配置。
Session Cleanup (Hypercho) 是免费的吗?
是的,Session Cleanup (Hypercho) 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Session Cleanup (Hypercho) 支持哪些平台?
Session Cleanup (Hypercho) 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Session Cleanup (Hypercho)?
由 Duola(@duolahypercho)开发并维护,当前版本 v1.1.0。