← 返回 Skills 市场
duolahypercho

Session Cleanup (Hypercho)

作者 Duola · GitHub ↗ · v1.1.0 · MIT-0
cross-platform ✓ 安全检测通过
140
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install hypercho-session-cleanup
功能描述
Clean up OpenClaw session storage across all agents. Removes tombstone files (.reset, .deleted, .bak), old cron session .jsonl files, orphan files, and stale...
使用说明 (SKILL.md)

Session Cleanup

Automated cleanup of OpenClaw session storage across all registered agents.

What It Cleans

  1. Tombstone files.reset.*, .deleted.*, .bak-* (always safe to remove)
  2. Old cron sessions.jsonl files + sessions.json entries older than 7 days for cron-type sessions
  3. Orphan files.jsonl files on disk not referenced by sessions.json
  4. Stale entriessessions.json entries pointing to missing .jsonl files (cron sessions only)

Safety Guarantees

  • Never touches .lock files or their corresponding active .jsonl
  • Never deletes sessions.json itself
  • Backs up sessions.json before 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
安全使用建议
This skill appears to do exactly what it says (clean local OpenClaw session folders) and does not request credentials or network access, but take these precautions before enabling automatic runs: 1) Inspect the script yourself (it backs up sessions.json to sessions.json.json.bak) and confirm the deletion rules match your policies. 2) Always run the dry-run first: python3 <skill_dir>/scripts/session_cleanup.py --dry-run and review output. 3) Verify sessions.json backup behavior and that backups are created where you expect. 4) Test on a single agent (python3 ... --agent <name>) before running across all agents. 5) Be aware the cron recommendation will run unattended; only add it to cron after tests. 6) Note the script classifies cron sessions by substring match ('cron' in key) — if your session keys use different naming, confirm it won't remove needed data. If you want extra safety, run the script under a user/account with limited access or add additional logging/notification before deleting.
功能分析
Type: OpenClaw Skill Name: hypercho-session-cleanup Version: 1.1.0 The skill bundle provides a maintenance utility for cleaning up temporary and expired session files within the OpenClaw environment (~/.openclaw/agents/). The script (session_cleanup.py) implements targeted file deletion of 'tombstone' files and old cron logs, includes safety mechanisms like file backups and retention policies, and lacks any indicators of data exfiltration, unauthorized network access, or malicious execution.
能力评估
Purpose & Capability
Name/description, SKILL.md, and the included Python script all focus on scanning ~/.openclaw/agents/*/sessions/ and deleting tombstones, old cron .jsonl files, orphan .jsonl files, and stale sessions.json entries. There are no unrelated environment variables, binaries, or external services requested.
Instruction Scope
Instructions are scoped to local session storage and provide a dry-run mode and single-agent target. Minor concerns: the SKILL.md includes cron scheduling/model metadata (scheduling the skill to run automatically) and the script uses a simple substring check for cron sessions (is_cron_session returns True if 'cron' appears anywhere in the key), which could misclassify some entries. Otherwise the instructions do not request unrelated files or secrets.
Install Mechanism
No install spec or external downloads; this is an instruction-only skill with a local Python script included. Nothing will be fetched from remote URLs during install.
Credentials
No environment variables, credentials, or external config paths are required. The script reads and writes only within user home ~/.openclaw/agents/*/sessions/ (and writes a local backup .json.bak). That access level is proportionate to a session-cleanup tool, but it does have broad filesystem scope limited to OpenClaw agent folders.
Persistence & Privilege
The skill is not always:true and does not request permanent platform privileges, but SKILL.md explicitly recommends adding a daily cron job for automatic runs. Combined with the ability for the agent to invoke skills autonomously (platform default), this means the script can be scheduled to run unattended — ensure you want automatic deletion across all agents.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install hypercho-session-cleanup
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /hypercho-session-cleanup 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.0
Added setup prompt for easy onboarding — copy-paste into OpenClaw chat to install and configure.
v1.0.0
Initial release: automated OpenClaw session storage cleanup across all agents. Removes tombstones, old cron sessions, orphans, and stale entries. Supports --dry-run, --agent, and auto-discovery.
元数据
Slug hypercho-session-cleanup
版本 1.1.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

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。

💬 留言讨论