claw-clean
v2.5.2
Published
Interactive session cleanup tool for OpenClaw — @clack/prompts TUI
Maintainers
Readme
claw-clean
Interactive session cleanup tool for OpenClaw.
Features
- @clack/prompts TUI — clean, robust menus with proper wrapping and cursor handling
- Selectable sessions — each session listed with full UUID + identifier
- Space to toggle, Enter to execute
- Auto-detected trash command — works with
trash,trash-put, orgio trash - Cleans trajectory companions alongside selected sessions
- Stale data cleanup —
.deleted,.bak-*,.reset-*,archive/ - Cleans
sessions.json— removes deleted and orphaned session references - Color-coded status — OPEN (red), active (green), orphaned (yellow), inactive (default)
Installation
npm install -g claw-cleanOr use directly:
npx claw-cleanUsage
claw-clean # interactive menu (choose agent first)
claw-clean --doctor # check environment and dependencies
claw-clean -h # helpInteractive Controls
| Key | Action |
|-----|--------|
| ↑ / ↓ | Navigate options |
| Space | Toggle selection |
| Enter | Submit selection |
| Ctrl+C | Cancel and quit |
After cleaning an agent, the tool loops back to the agent menu. Choose Done to exit.
Audit log
Every deletion is appended to the audit log with an ISO timestamp:
- Default:
$XDG_STATE_HOME/claw-clean/log(falls back to~/.local/state/claw-clean/log)
Safety
- Failed trash operations are retried once before reporting an error.
- Run
claw-clean --doctorto verify Node.js, trash command, and directory permissions.
What It Cleans
Regular sessions:
- The
.jsonlsession file - Its
.trajectory.jsonlcompanion - Its
.trajectory-path.jsoncompanion - Entry removed from
sessions.json
Orphaned sessions (in sessions.json but file missing):
- Entry removed from
sessions.jsononly (no file to trash)
Stale data:
.deleted.*files + their trajectory companions.bak-*backup files.reset.*reset snapshot filesarchive/folder
Whole agent:
- Delete the entire
agents/<agent>/directory
Requirements
- Node.js
>=18.0.0 - One of:
trash(trash-cli),trash-put, orgio trash
License
GPL-3.0
