About openclaw-session-cleaner
OpenClaw Session Cleaner is a skill for maintaining OpenClaw's main agent session files. It checks file counts and index size, preserves the main session, removes old cron files, and rebuilds the index to reference files still present.
Key features
- 01Check session file count
- 02Check sessions.json size
- 03Keep the main session while removing old cron files
- 04Rebuild the index from existing sessions
- 05Report before-and-after counts
Use cases
- 01Remove accumulated old cron session files
- 02Reduce sessions.json and rebuild its index
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ chujianyun/ skills --skill openclaw-session-cleanerAfter installing, type/openclaw-session-cleanerin Claude Code to confirm it loaded.
Details
From the project READMEOpenClaw Session Cleaner
当用户要求清理 OpenClaw session、删除旧的 cron session 文件、缩小 sessions.json、或重建 session 索引时,执行下面这段操作:
Check how many session files are in ~/.openclaw/agents/main/sessions/ and how big sessions.json is. If there are thousands of old cron session files bloating it, delete all the old .jsonl files except the main session, then rebuild sessions.json to only reference sessions that still exist on disk.
使用要求
- 默认操作目标是
~/.openclaw/agents/main/sessions/ - 在执行前先检查当前 session 文件数量和
sessions.json大小 - 由 OpenClaw 自行判断哪些属于应清理的旧 cron session
- 保留 main session,不要误删主会话
- 清理完成后,确保
sessions.json只引用磁盘上仍然存在的 session 文件 - 向用户汇报清理前后的数量变化,以及是否已完成重建
Comments
Markdown supported