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.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/irideas/session-cleanup-proWhat 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:
- Storage Optimization: Clearing out hundreds of old, unused session logs that consume disk space on local storage.
- System Hygiene: Regularly auditing your
sessions.jsonfile against actual files present on the disk to prevent file system clutter. - 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
- "OpenClaw, can you scan my sessions and tell me if I have any orphan files that are safe to delete?"
- "Run the session-cleanup utility and provide a summary of how much space I can save by removing sessions older than 3 days."
- "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:mainsession. You cannot delete this session, ensuring your primary agent state is always secure. - Read-Only Mode: Always perform a scan using
scan_sessions.sh scanbefore 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
orphanFilesandstaleSessionsbefore thermcommands are executed.
Metadata
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 skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-irideas-session-cleanup-pro": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: file-write, file-read, code-execution
Related Skills
Bobo Context Cleanup
Skill by irideas
Bobo Session Cleanup
Skill by irideas
context-cleanup
Analyze and archive low-value memory notes in OpenClaw workspace to reduce context bloat and improve responsiveness. 适用于上下文冗余、维护整理场景;默认流程为 analyze → plan → confirm → archive,归档优先于删除。