Problem
OpenClaw natively supports and encourages subagent spawning for task parallelism, but session accumulation severely impacts host performance, forcing users to sacrifice data retention for operational stability.
Real-World Metrics (from our deployment)
Before (447 sessions accumulated over ~3 days)
| Metric |
Value |
sessions.list response time |
6.5 seconds |
| Gateway CPU |
100-115% sustained |
| Gateway RAM |
1+ GB |
| Dashboard usability |
Effectively frozen |
| Gateway restart |
Did not help (sessions persist on disk) |
| Host reboot |
Did not help |
After (aggressive manual pruning to 23 sessions)
| Metric |
Value |
sessions.list response time |
760ms |
| Gateway CPU |
1% |
| Gateway RAM |
~400 MB |
| Dashboard usability |
Responsive |
Session Breakdown (typical)
- 2-4 long-lived main/channel sessions (webchat, Slack)
- ~400+ ephemeral sessions (subagents, spawn-dispatch, cron jobs)
With dispatcher running every 10 minutes spawning 2 sessions each cycle, accumulation is ~12 sessions/hour × 24h = ~288 sessions/day.
Root Cause
sessions.list serializes all sessions on every call — O(n) with expensive per-session work
- Control UI/Dashboard polls
sessions.list frequently (~every 7 seconds), even when not viewing Sessions tab
archiveAfterMinutes (default 60) doesn't keep pace with spawn rate
- No pagination, caching, or incremental sync
Current Workaround
We had to:
- Manually archive old
.jsonl transcripts
- Run
openclaw sessions cleanup --enforce --fix-missing
- Set
archiveAfterMinutes: 120 (still aggressive)
- Accept losing troubleshooting history to maintain stability
This is a poor tradeoff — we lose the ability to debug issues from hours ago.
Suggested Improvements
- Pagination for
sessions.list — don't serialize 400+ sessions per request
- Reduce Control UI poll frequency — or skip
sessions.list when not on Sessions view
- Incremental sync — send deltas instead of full list
- Tiered retention config — separate policies for:
- Main/channel sessions (keep days/weeks)
- Subagent sessions (keep hours)
- Hard session count cap with LRU eviction — auto-archive oldest ephemeral sessions when limit reached
- Background proactive cleanup — don't wait for user to hit performance cliff
- Lazy loading — defer full session metadata until requested
Environment
- OpenClaw v2026.3.28
- macOS 15.7.2 (arm64), Apple Silicon
- Workload: Automated dispatcher spawning subagents for issue processing
Impact
This is a significant reliability issue for anyone running automated subagent workflows. The system encourages subagent spawning but doesn't scale session management to match, creating a hidden performance cliff that's hard to diagnose and forces users to choose between history retention and system stability.
Problem
OpenClaw natively supports and encourages subagent spawning for task parallelism, but session accumulation severely impacts host performance, forcing users to sacrifice data retention for operational stability.
Real-World Metrics (from our deployment)
Before (447 sessions accumulated over ~3 days)
sessions.listresponse timeAfter (aggressive manual pruning to 23 sessions)
sessions.listresponse timeSession Breakdown (typical)
With dispatcher running every 10 minutes spawning 2 sessions each cycle, accumulation is ~12 sessions/hour × 24h = ~288 sessions/day.
Root Cause
sessions.listserializes all sessions on every call — O(n) with expensive per-session worksessions.listfrequently (~every 7 seconds), even when not viewing Sessions tabarchiveAfterMinutes(default 60) doesn't keep pace with spawn rateCurrent Workaround
We had to:
.jsonltranscriptsopenclaw sessions cleanup --enforce --fix-missingarchiveAfterMinutes: 120(still aggressive)This is a poor tradeoff — we lose the ability to debug issues from hours ago.
Suggested Improvements
sessions.list— don't serialize 400+ sessions per requestsessions.listwhen not on Sessions viewEnvironment
Impact
This is a significant reliability issue for anyone running automated subagent workflows. The system encourages subagent spawning but doesn't scale session management to match, creating a hidden performance cliff that's hard to diagnose and forces users to choose between history retention and system stability.