swarm-janitor
Enterprise-grade OpenClaw skill for cleaning up orphaned subagent processes, archiving transcripts to SuperMemory, and freeing disk space without losing work. Features dry-run mode, configurable retention policies, and comprehensive safety checks.
- License 许可
- MIT
- 最近更新
- 2026-08-23
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- swarm-janitor
- tags
- [ "maintenance", "cleanup", "subagents", "memory-management", "enterprise" ]
- author
- OpenClawdad (Redclay)
- homepage
- https://github.com/openclawdad/swarm-janitor
- metadata
- { "clawdbot": { "emoji": "?", "install": [], "requires": { "bins": [ "python3" ] } } }
- description
- Enterprise-grade OpenClaw skill for cleaning up orphaned subagent processes, archiving transcripts to SuperMemory, and freeing disk space without losing work. Features dry-run mode, configurable retention policies, and comprehensive safety checks.
02 资源文件 2
- 参考文档_meta.json283 B
- 参考文档references/config.yaml1.4 KB
03 SKILL.md 正文
Swarm Janitor
Enterprise-grade cleanup tool for OpenClaw subagent management.
What It Does
Automatically identifies and cleans up orphaned subagent sessions while preserving important work through SuperMemory archival.
Core Functions
- Scan: Analyze session directory for orphaned/abandoned subagents
- Archive: Save transcripts to SuperMemory before deletion
- Clean: Safely remove orphaned sessions freeing disk space
- Report: Generate detailed cleanup reports
Safety First
This skill implements multiple safety layers:
- ✅ Never deletes active sessions — checks process status
- ✅ Dry-run mode — preview changes before executing
- ✅ SuperMemory backup — transcripts archived before deletion
- ✅ Configurable retention — customize age thresholds
- ✅ Detailed logging — full audit trail of all actions
Quick Start
# Preview what would be cleaned (dry-run)
python3 scripts/swarm_janitor.py --dry-run
# Archive old sessions to SuperMemory, then clean
python3 scripts/swarm_janitor.py --archive --clean
# Custom retention (7 days instead of default 3)
python3 scripts/swarm_janitor.py --retention-days 7 --clean
Installation
-
Copy this skill to your OpenClaw workspace:
cp -r skills/swarm-janitor ~/.openclaw/workspace/skills/ -
Configure retention policy (optional):
# Edit config to customize nano references/config.yaml -
Run first scan:
python3 ~/.openclaw/workspace/skills/swarm-janitor/scripts/swarm_janitor.py --dry-run
Usage Patterns
Daily Maintenance (Cron)
# Run daily at 3 AM, archive sessions older than 3 days
0 3 * * * python3 ~/.openclaw/workspace/skills/swarm-janitor/scripts/swarm_janitor.py --archive --clean --retention-days 3 >> /var/log/swarm-janitor.log 2>&1
Manual Cleanup
# See what would be deleted
python3 scripts/swarm_janitor.py --dry-run --verbose
# Archive transcripts to SuperMemory
python3 scripts/swarm_janitor.py --archive
# Clean without archiving (not recommended)
python3 scripts/swarm_janitor.py --clean --no-archive
# Full report
python3 scripts/swarm_janitor.py --report --output json
Emergency Cleanup
# Aggressive cleanup with 1-day retention
python3 scripts/swarm_janitor.py --clean --retention-days 1 --force
Configuration
See references/config.yaml for:
- Retention policies
- Archive destinations
- Safety thresholds
- Logging options
How It Works
- Discovery: Scans
~/.openclaw/agents/main/sessions/ - Analysis: Determines session age, activity status, size
- Classification: Identifies orphaned vs active sessions
- Archival: Saves transcripts to SuperMemory (if enabled)
- Cleanup: Safely removes orphaned session files
- Reporting: Generates summary of actions taken
Safety Mechanisms
| Check | Description |
|---|---|
| Process Check | Verifies no active process owns the session |
| Age Verification | Only processes sessions older than threshold |
| Size Limits | Warns on unusually large deletions |
| Dry-Run Default | Preview mode is default — explicit action required |
| Backup First | Archives to SuperMemory before any deletion |
Troubleshooting
Q: It says "permission denied" A: Ensure you have write access to the sessions directory
Q: Sessions not being detected A: Check the path in config.yaml matches your OpenClaw installation
Q: SuperMemory archive failing A: Verify SuperMemory skill is configured with valid API key
Enterprise Features
- Audit Logging: All actions logged with timestamps
- Configurable Policies: YAML-based configuration
- Metrics Export: JSON/CSV output for monitoring
- Dry-Run Mode: Test changes before applying
- Retention Policies: Age-based and count-based rules
License
MIT - Created by OpenClawdad (Redclay) for the OpenClaw community.
04 同仓库更多 Skills
crowd-prompting
A marketplace where AI agents improve prompts, system instructions, tool descriptions, and other text-based content with domain expertise from real-world operations — and earn tokens for valuable contributions.
dilemm-ai
Compete in DilemmAI, the prisoner's dilemma AI arena at dilemm.ai. Use when an OpenClaw agent wants to create an account, design and submit strategy prompts for their bot, enter matchmaking, analyze historical matches and leaderboards, and iterate on bot strategy. Requires headless browser automation (no API available yet).
arxiv-paper-reviews
Interact with arXiv Crawler API to fetch papers, read reviews, and submit comments. Use when working with arXiv papers, fetching paper lists by date/category/interest, viewing paper details with comments, or submitting paper reviews via API at http://150.158.152.82:8000.
arxiv-paper-reviews
Interact with arXiv Crawler API to fetch papers, read reviews, and submit comments. Use when working with arXiv papers, fetching paper lists by date/category/interest, viewing paper details with comments, or submitting paper reviews via API at http://150.158.152.82:8000.
git-summary
Get a quick summary of the current Git repository including status, recent commits, branches, and contributors.
agent-constitution
Interact with AgentConstitution governance contracts on Base Sepolia. Check compliance, read rules, log actions, query governance state.