Session Cleanup (Hypercho)

v1.1.0

Clean up OpenClaw session storage across all agents. Removes tombstone files (.reset, .deleted, .bak), old cron session .jsonl files, orphan files, and stale...

0· 133·0 current·0 all-time

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for duolahypercho/hypercho-session-cleanup.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "Session Cleanup (Hypercho)" (duolahypercho/hypercho-session-cleanup) from ClawHub.
Skill page: https://clawhub.ai/duolahypercho/hypercho-session-cleanup
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install hypercho-session-cleanup

ClawHub CLI

Package manager switcher

npx clawhub@latest install hypercho-session-cleanup
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
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.
Assessment
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.

Like a lobster shell, security has layers — review code before you run it.

latestvk97fzk7gfmeehjca1y8kmzfjy983adra
133downloads
0stars
2versions
Updated 1mo ago
v1.1.0
MIT-0

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 <skill_dir>/scripts/session_cleanup.py

Dry run (preview only)

python3 <skill_dir>/scripts/session_cleanup.py --dry-run

Single agent only

python3 <skill_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 <skill_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 TypeRetentionAction
Tombstones (.reset/.deleted/.bak)0 daysAlways delete
Cron session files7 daysDelete after 7 days
Non-cron sessions30 daysKeep (no auto-delete)
Main sessionsForeverNever touched
Active sessions (.lock)ForeverNever touched

Comments

Loading comments...