Operations 5 min read

Why Is OpenClaw Slowing Down? Clean Up Old Session Files to Boost Performance

The article explains how accumulated cron session files in OpenClaw cause progressive slowdowns, shows a step‑by‑step prompt to identify and delete obsolete .jsonl files, and demonstrates size reductions of up to 77% that instantly restore responsiveness.

Wuming AI
Wuming AI
Wuming AI
Why Is OpenClaw Slowing Down? Clean Up Old Session Files to Boost Performance

Problem

OpenClaw becomes progressively slower after months of use because each message load incorporates thousands of cron‑generated .jsonl session files into the context. The growing sessions.json file forces the engine to parse unnecessary data on every turn, causing latency to increase with each interaction.

Diagnostic Prompt

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.

Procedure

List the files in ~/.openclaw/agents/main/sessions/ and note the count.

Inspect the size of sessions.json (e.g., du -h sessions.json).

If the count is in the thousands, remove every .jsonl file that is not the primary session file:

find ~/.openclaw/agents/main/sessions/ -name "*.jsonl" ! -name "main_session.jsonl" -delete

Regenerate sessions.json so it only contains references to the remaining files. A typical regeneration command is:

python -m openclaw.tools.rebuild_sessions --dir ~/.openclaw/agents/main/sessions/

Restart OpenClaw and verify that response time returns to normal.

Observed Impact

One user reduced sessions.json from 43 MB to 9.7 MB (≈77 % shrinkage).

Another user dropped the file from 41 MB to 2 MB.

A third case shrank a 142 MB file to 18 MB.

These reductions eliminated the latency spike and restored smooth operation.

Reusable Skill

The prompt was packaged as an OpenClaw “Session Cleaner” skill. The skill can be installed, executed, and will either clean obsolete sessions or report that no action is needed. It can also be scheduled for periodic execution.

GitHub repository containing the skill:

https://github.com/chujianyun/skills/tree/main/skills/openclaw-session-cleaner

Usage Recommendations

Before each heavy conversation batch, inspect the sessions directory for an excessive number of old cron files.

Run the cleanup prompt or invoke the installed skill.

Optionally schedule the skill to run weekly (e.g., via a cron job that calls openclaw run skill openclaw-session-cleaner).

Visual Evidence

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

performanceAutomationLinuxcronOpenClawsession cleanup
Wuming AI
Written by

Wuming AI

Practical AI for solving real problems and creating value

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.