LaunchKit · 2026
Back to Skills

**Janitor** is an intelligent cleanup and session management skill for OpenClaw AI agents.

0
0 downloads
by @sarthib7

Setup & Installation

openclaw skills install @sarthib7/janitor

Or with the ClawHub CLI, for registry-managed skill folders outside a full OpenClaw workspace:

npx clawhub install janitor

What This Skill Does

Janitor manages cache cleanup, memory optimization, and session pruning for Node.js-based AI agents. It monitors context token usage in real-time and triggers automated cleanup or emergency recovery based on configurable thresholds. Cleanup statistics and recommendations are reported after each run.

It runs with no external dependencies and hooks directly into agent task lifecycles, eliminating the need for separate cleanup scripts or system-level cron jobs.

When to use it

  • Clearing build artifacts and cache files after a git push
  • Scheduling hourly cache cleanup during long-running agent sessions
  • Triggering emergency memory recovery when context nears its limit
  • Tracking heap usage over time to catch memory leaks
  • Automating post-task workspace cleanup in multi-agent pipelines

Example Workflow

Here's how your AI assistant might use this skill in practice.

INPUT

User asks: "Run cleanup after my agent finishes its task"

AGENT
  1. 1Initialize a Janitor instance with default configuration
  2. 2Execute cleanup() to remove cache files, source maps, logs, and temp files
  3. 3Call freeMemory() to trigger garbage collection and clear the require cache
  4. 4Retrieve stats via getStats() to tally files deleted and space saved
  5. 5Generate a report() with current memory usage and any recommendations
OUTPUT

Cleanup result showing files deleted, space saved, duration, and memory freed, plus a health status report with recommendations