A maintenance utility designed to optimize OpenClaw performance by purging accumulated subagent and cron job session records.
The fastest way to install a skill directly from the registry.
npx clawhub@latest install openclaw-subagent-session-cleanup
Copy the skill folder to one of these locations
~/.openclaw/skills/ <project>/skills/ Priority: Workspace > Local > Bundled
Copy this prompt to OpenClaw to install it automatically.
Help me install openclaw-subagent-session-cleanup using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).
Get the raw skill files in a ZIP archive.
The OpenClaw Session Cleanup skill is an essential utility for maintaining the performance and responsiveness of the OpenClaw gateway. Every time a subagent is invoked or a cron job executes, a new entry is recorded in the sessions.json file. Over time, these entries can grow into the hundreds or thousands, significantly increasing the latency of starting new subagents from a few seconds to over ten seconds.
This tool specifically targets and removes transient child sessions, such as completed subagent tasks and cron run records, while carefully preserving critical data like main agent sessions, communication channel histories (WhatsApp, Telegram, etc.), and cron definitions. By compacting the sessions.json index, Openclaw Skills users can ensure their gateway remains lean and efficient.
To use this cleanup utility within your Openclaw Skills environment, follow these steps:
Ensure no sessions are active before running the cleanup.
openclaw gateway stop
Run the PowerShell script with your desired parameters.
# Standard cleanup (keeps .jsonl files)
.\cleanup.ps1
# Preview changes without applying them
.\cleanup.ps1 -DryRun
# Dangerous: Purge index AND delete conversation history files
.\cleanup.ps1 -CleanJsonl
openclaw gateway
The skill manages data according to the following retention policy to protect Openclaw Skills integrity:
| Session Type | Key Pattern | Action |
|---|---|---|
| Main & Channel Sessions | agent:main:main, agent:main:<channel>:* |
Retained |
| Cron Definitions | agent:main:cron:uuid |
Retained |
| Cron Run Records | agent:main:cron:uuid:run:uuid |
Deleted |
| Subagent Sessions | agent:main:subagent:uuid |
Deleted |
| Other Child Sessions | agent:main:<type>:* |
Deleted |
Note on .jsonl Files: By default, the complete conversation history stored in .jsonl format is preserved unless the -CleanJsonl flag is explicitly triggered.
Loading
Lemma is an AI operating system platform that enables business teams to design, provision, and orchestrate complex AI pods and automated workflows.

A powerful integration for AI agents to query Atlas Obscura for curious locations, hidden gems, and worldbuilding inspiration.

A powerful utility for extracting vendor details, line items, and financial totals from digital or scanned PDF invoices into structured formats.

A strategic framework for selecting the optimal scraping tool between API-driven extraction and browser automation to maximize data quality.

A comprehensive flight search and airfare monitoring skill powered by the Travelpayouts and Aviasales API.

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








































