跳到正文
TakoAPI
返回技能列表

janitor

由 sarthib7 提供

Coding Agents & IDEs
—暂无评分
你的评分

简介

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

描述

该技能的功能

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.

何时使用

  • 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

示例工作流

输入

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

智能体
  1. 1

    Initialize a Janitor instance with default configuration

  2. 2

    Execute cleanup() to remove cache files, source maps, logs, and temp files

  3. 3

    Call freeMemory() to trigger garbage collection and clear the require cache

  4. 4

    Retrieve stats via getStats() to tally files deleted and space saved

  5. 5

    Generate a report() with current memory usage and any recommendations

输出

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

安装

clawhub install sarthib7/janitor

运行 CLI 命令,或把这段提示词粘贴到 Claude Code、Cursor、Codex 或你在用的任意编程智能体里。

链接