Session Cleaner
v1.0.0Clean up stale OpenClaw session files. Keep the current main session and all group chat sessions; move everything else to a backup directory. Use when perfor...
⭐ 0· 285·4 current·4 all-time
byMadoka@guoqunabc
MIT-0
Download zip
LicenseMIT-0 · Free to use, modify, and redistribute. No attribution required.
Security Scan
OpenClaw
Benign
high confidencePurpose & Capability
Name/description match the behavior. The script operates only on ~/.openclaw/agents/main/sessions and implements the stated keep/move rules (keep current main and group sessions, move others to sessions/backup). No unexpected credentials, binaries, or unrelated resources are required.
Instruction Scope
SKILL.md instructs the agent to run the included shell script (optionally with --dry-run). The script only reads session files in the specified sessions directory and inspects them for sessionKey/to fields to decide retention; it does not call external network endpoints, read unrelated system files, or reference environment variables beyond $HOME. Behavior is narrow and in-scope.
Install Mechanism
No install spec — instruction-only with a bundled script. Nothing is downloaded or written to system locations outside the user's sessions directory. Low install risk.
Credentials
No required environment variables, no credentials, and no config paths beyond the documented ~/.openclaw path. The script uses standard POSIX utilities (grep, stat, mv, mkdir, ls, numfmt) which are reasonable for the task.
Persistence & Privilege
always:false and no mechanism to modify other skills or global agent settings. The script only modifies files under the user's sessions directory (moves to a local backup), so requested persistence/privileges are proportional to the described purpose.
Assessment
This script appears to do exactly what it claims, but review and take these precautions before running: 1) Run with --dry-run first to see which files would be moved. 2) Inspect a few session .jsonl files to confirm the grep patterns ("sessionKey" and "to") match your expected session formats. 3) Ensure you run it as the intended user (don’t run as root if you only mean to clean your personal sessions) because $HOME determines the target directory. 4) Be aware the script relies on standard utilities (numfmt, stat variants); on minimal systems some utilities may be missing. 5) Because moved files are placed under sessions/backup, they are recoverable, but verify backup location matches your retention policy. If any of these points are concerning, do not install or run until you’ve validated them.Like a lobster shell, security has layers — review code before you run it.
latestvk97d8k3qxmdb1jy2n2xbckgk7n82nwxp
License
MIT-0
Free to use, modify, and redistribute. No attribution required.
