OpenClaw Session Cleanup for Openclaw

A maintenance utility designed to optimize OpenClaw by purging accumulated subagent and cron job session data from sessions.json.

lrddrl
v1.0.0
Apr 10, 2026
0
635
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install openclaw-session-cleanup-ruodon

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install openclaw-session-cleanup-ruodon using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is OpenClaw Session Cleanup?

The OpenClaw Session Cleanup skill is a specialized maintenance tool for developers using Openclaw Skills. Over time, every subagent call and cron job execution creates entries in the sessions.json file. This accumulation can lead to significant performance degradation, causing the gateway to slow down when initializing new subagents. This skill provides a safe and automated way to compact your session data, ensuring your environment remains responsive and efficient by focusing on removing transient child sessions while preserving critical main and channel data.

OpenClaw Session Cleanup Use Cases

  • Subagents are taking 10+ seconds to start up.
  • The sessions.json file has grown excessively large and impacts gateway speed.
  • Hundreds of completed child session entries have accumulated after days of operation.
  • General system maintenance is required to keep the OpenClaw environment lean.

How OpenClaw Session Cleanup Works

  1. The user identifies performance lag or session bloat within their Openclaw Skills environment.
  2. The OpenClaw gateway is safely stopped to prevent data corruption.
  3. The cleanup script is executed with optional parameters to analyze or purge session records.
  4. The script identifies and removes specific child session types (cron runs and subagent sessions) while preserving main and channel records.
  5. The gateway is restarted with an optimized, lightweight session index.

OpenClaw Session Cleanup Setup

To begin using this maintenance utility within your Openclaw Skills setup, follow these steps:

  1. Stop the gateway:
openclaw gateway stop
  1. Run the cleanup script (PowerShell):
.\cleanup.ps1
  1. Restart the gateway:
openclaw gateway

OpenClaw Session Cleanup Data Schema & Taxonomy

The skill interacts with the sessions.json file and .jsonl history files. It uses a specific logic to decide which metadata to retain or purge.

Data Type Key Pattern Retention Status
Main Session agent:main:main Preserved
Messaging Channels agent:main:channel:direct:* Preserved
Cron Definitions agent:main:cron:uuid Preserved
Cron Run Records agent:main:cron:uuid:run:uuid Purged
Subagent Sessions agent:main:subagent:uuid Purged
.jsonl Files history logs Preserved (unless -CleanJsonl is used)

OpenClaw Session Cleanup Advanced Features

  • Dry Run Mode: Use -DryRun to preview changes without modifying any data.
  • Safety Preservation: The script defaults to -KeepJsonl to ensure conversation history remains intact.
  • Hard Reset: Use -CleanJsonl for a deep purge that removes both session indices and historical log files.
  • Comprehensive Channel Support: Automatically protects sessions from WhatsApp, Telegram, Signal, iMessage, and other major integrations.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*