# Send Swarm Janitor to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "swarm-janitor",
    "name": "Swarm Janitor",
    "source": "tencent",
    "type": "skill",
    "category": "AI 智能",
    "sourceUrl": "https://clawhub.ai/LvcidPsyche/swarm-janitor",
    "canonicalUrl": "https://clawhub.ai/LvcidPsyche/swarm-janitor",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/swarm-janitor",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=swarm-janitor",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "SKILL.md",
      "references/config.yaml"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/swarm-janitor"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/swarm-janitor",
    "downloadUrl": "https://openagent3.xyz/downloads/swarm-janitor",
    "agentUrl": "https://openagent3.xyz/skills/swarm-janitor/agent",
    "manifestUrl": "https://openagent3.xyz/skills/swarm-janitor/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/swarm-janitor/agent.md"
  }
}
```
## Documentation

### 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

### 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

CheckDescriptionProcess CheckVerifies no active process owns the sessionAge VerificationOnly processes sessions older than thresholdSize LimitsWarns on unusually large deletionsDry-Run DefaultPreview mode is default — explicit action requiredBackup FirstArchives 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.
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: LvcidPsyche
- Version: 0.1.0
## Source health
- Status: healthy
- Source download looks usable.
- Yavira can redirect you to the upstream package for this source.
- Health scope: source
- Reason: direct_download_ok
- Checked at: 2026-04-30T16:55:25.780Z
- Expires at: 2026-05-07T16:55:25.780Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/swarm-janitor)
- [Send to Agent page](https://openagent3.xyz/skills/swarm-janitor/agent)
- [JSON manifest](https://openagent3.xyz/skills/swarm-janitor/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/swarm-janitor/agent.md)
- [Download page](https://openagent3.xyz/downloads/swarm-janitor)