openclaw-session-cleanup

Diagnose and stabilize long-running OpenClaw deployments that accumulate stale sessions, unreaped agents, browser-control timeouts, gateway websocket 1006 closures, or memory pressure on small VPS hosts. Use when OpenClaw shows too many active sessions, browser control service timeout, gateway abnormal closure, or needs a cleanup/watchdog/sane runtime limits playbook.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "openclaw-session-cleanup" with this command: npx skills add NeoCh3n/openclaw-session-cleanup

OpenClaw Session Cleanup

Use this skill when the runtime becomes unstable after long uptime, especially on small hosts such as 1 vCPU / 2 GB RAM.

Trigger Pattern

Treat these as the main signals:

  • Sessions: 10+ active
  • Agents: 5+
  • browser control service timeout
  • gateway 1006 abnormal closure
  • repeated gateway disconnects or slow recovery after idle periods

What To Do

  1. Inspect the current runtime state.
  2. Prune stale sessions first.
  3. If the runtime stays unhealthy, clear sessions.
  4. Reduce runtime ceilings for sessions, agents, and browsers.
  5. Add recurring cleanup and a watchdog when the host is expected to run for days.

Immediate Commands

Run:

openclaw sessions
openclaw sessions prune
openclaw status

If the runtime is still unhealthy, escalate to:

openclaw sessions clear
openclaw status

Healthy target after cleanup:

  • Sessions: 1-3
  • Agents: 3
  • Gateway reachable
  • browser running

Safe Runtime Defaults

For 1 vCPU / 2 GB RAM, prefer:

  • maxSessions = 5
  • sessionTTL = 30m
  • maxAgents = 3
  • maxBrowsers = 1
  • swap = 2G

Use the starter config at {baseDir}/templates/openclaw.json.

Automation

Install periodic pruning:

bash "{baseDir}/scripts/install-cron-prune.sh"

Install watchdog unit files:

bash "{baseDir}/scripts/install-watchdog.sh"

Render a tuned runtime config:

bash "{baseDir}/scripts/render-openclaw-config.sh"

Browser Constraint

Treat browser control as the heaviest resource consumer on a small VPS.

Recommended mode:

openclaw browser start --single

Swap

If the host has no swap, add 2G:

fallocate -l 2G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
free -h

References

  • Detailed runbook: {baseDir}/docs/openclaw.session_cleanup_v1.md
  • Runtime template: {baseDir}/templates/openclaw.json
  • Watchdog service: {baseDir}/templates/openclaw-watchdog.service
  • Watchdog timer: {baseDir}/templates/openclaw-watchdog.timer

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

OpenClaw Auto‑Updater (Safe + Scheduled + Summary)

Schedule automatic OpenClaw and skill updates with reliable cron templates, timezone-safe scheduling, and clear summary outputs. Use for hands-off maintenance, scheduled upgrades, and concise update reports.

Registry SourceRecently Updated
6K11Profile unavailable
Security

Claw Soul Backup

Store encrypted OpenClaw workspace backups and restore them via token-secured API using claw-vault.com with local encryption and credential management.

Registry SourceRecently Updated
2240Profile unavailable
Security

Durable Files Weekly Review (Public)

Run a weekly token-optimization audit for durable instruction files in any OpenClaw workspace, generate a markdown report, and propose approval-gated cleanup...

Registry SourceRecently Updated
1650Profile unavailable
Coding

OpenClaw Cost Guard (Budgets + Token-Saving Playbook)

Track OpenClaw/Clawdbot token and cost usage from session JSONL logs (prefer real usage.cost when present), generate daily/weekly summaries and top expensive sessions, and run budget checks (exit code on breach). Use to monitor spend, enforce budgets via cron/alerts, and apply a token-saving playbook to reduce output/tool-call cost.

Registry SourceRecently Updated
2.3K4Profile unavailable