Why your agent slows to a crawl (and the 30-second fix)
Your OpenClaw agent was blazing fast two weeks ago. Now it takes 30 seconds to respond to simple questions and seems to forget what it was doing mid-conversation.
The culprit isn't your hardware or your prompts. It's session file bloat.
Every interaction your agent has gets logged to .jsonl files in your sessions directory. Every tool call, every response, every piece of context. After a few weeks of heavy use, you're looking at hundreds of megabytes of session data that your agent dutifully loads into memory on every startup.
I saw this exact issue pop up on X yesterday. A user reported their agent went from sub-second responses to 45-second delays. After cleaning their session files, they got a 95% speedup.
Warning: Don't just delete everything. Your agent learns from session history, so you want to be surgical about what you remove.
Here's the fix that actually works:
# Navigate to your OpenClaw directory cd ~/.openclaw/sessions # Check current size du -sh . # Keep last 7 days, remove older sessions find . -name "*.jsonl" -mtime +7 -delete # Or keep only the 50 most recent sessions ls -t *.jsonl | tail -n +51 | xargs rm -f
But here's what most people miss: you also need to clean your cron logs. OpenClaw's automated tasks create their own session files, and these accumulate faster than you'd think.
# Clean cron-specific sessions (usually safe to be more aggressive) find . -name "cron_*.jsonl" -mtime +3 -delete # Clean any error logs while you're at it find . -name "error_*.jsonl" -mtime +1 -delete
The difference is immediate. Your agent stops loading irrelevant context from weeks ago and focuses on recent, relevant interactions. Response times drop back to normal, and memory usage plummets.
To prevent this from happening again, set up a simple cleanup script:
#!/bin/bash # Add to your weekly cron cd ~/.openclaw/sessions find . -name "*.jsonl" -mtime +14 -delete find . -name "cron_*.jsonl" -mtime +7 -delete
Run this weekly, and you'll never hit the bloat wall again.
Pro tip: Before cleaning, check your largest files with ls -lah | sort -k5 -hr. You might find specific sessions that are unusually large due to tool output loops or debug logging.
The best part? This works for any AI agent that logs interactions to disk. The pattern is universal: accumulated session data kills performance, and regular cleanup keeps things snappy.
Your agent should feel fast and responsive, not like it's trudging through years of conversation history every time you ask it to check your email.