ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified file management Safety 4/5

session-cleanup

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

Why use this skill?

Efficiently clean orphan files and stale sessions in OpenClaw. This utility features a secure confirmation flow to safely reclaim storage space while protecting your active agent history.

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/irideas/session-cleanup-pro
Or

What This Skill Does

The session-cleanup skill is an essential maintenance utility for OpenClaw users, designed to proactively manage disk space and keep session directories organized. The tool performs deep introspection on your OpenClaw environment, distinguishing between active, protected, and orphan session data. By automatically identifying .jsonl files that have been orphaned or sessions that have exceeded the 72-hour retention threshold, it helps maintain peak performance for the OpenClaw agent. The process is strictly gated by a multi-step verification loop: users must run a read-only scan, review the generated report, and explicitly confirm deletion before any files are removed from the system. This ensures that critical data, such as your main agent logs, remains untouched while garbage data is purged effectively.

Installation

To install this skill, use the ClawHub command-line interface. Run the following command in your terminal:

clawhub install openclaw/skills/skills/irideas/session-cleanup-pro

Ensure that you have sufficient permissions to modify files within your ~/.openclaw directory, as the cleanup process involves both reading and writing to these session storage paths.

Use Cases

This skill is ideal for:

  1. Storage Optimization: Clearing out hundreds of old, unused session logs that consume disk space on local storage.
  2. System Hygiene: Regularly auditing your sessions.json file against actual files present on the disk to prevent file system clutter.
  3. Post-Dev Cleanup: After a period of heavy testing and model training, use this to prune the resulting clutter while keeping the most recent 72 hours of work intact.

Example Prompts

  1. "OpenClaw, can you scan my sessions and tell me if I have any orphan files that are safe to delete?"
  2. "Run the session-cleanup utility and provide a summary of how much space I can save by removing sessions older than 3 days."
  3. "Execute the session cleanup plan you scanned earlier—I have reviewed the list and confirm that I want to delete those expired files."

Tips & Limitations

  • Safety First: The agent is hard-coded to ignore the agent:main:main session. You cannot delete this session, ensuring your primary agent state is always secure.
  • Read-Only Mode: Always perform a scan using scan_sessions.sh scan before considering any deletion. This provides the JSON-based report required to make an informed decision.
  • Limitations: This skill does not automatically prune files without your input. It requires a human-in-the-loop to confirm the orphanFiles and staleSessions before the rm commands are executed.

Metadata

Author@irideas
Stars2287
Views0
Updated2026-03-09
View Author Profile
AI Skill Finder

Not sure this is the right skill?

Describe what you want to build — we'll match you to the best skill from 16,000+ options.

Find the right skill
Add to Configuration

Paste this into your clawhub.json to enable this plugin.

{
  "plugins": {
    "official-irideas-session-cleanup-pro": {
      "enabled": true,
      "auto_update": true
    }
  }
}

Tags(AI)

#file-management#cleanup#disk-space#maintenance#optimization
Safety Score: 4/5

Flags: file-write, file-read, code-execution