Install
openclaw skills install trash-managerTrash management with index tracking for all agents. Use when deleting files to ensure proper index registration and 7-day auto-cleanup.
openclaw skills install trash-managerTrash management with index tracking. All agents must use this for file deletion — no bare rm or mv to trash.
Always move files to trash and update the index before "deleting" anything.
Bare rm = forbidden ❌
mv ~/.openclaw/trash/ = forbidden ❌ (no index)
trash-manager.sh add <file> = correct ✅
User/Agent requests file deletion
↓
Check if file is truly no longer needed
↓
Call trash-manager.sh add <file>
↓
Auto: moves to ~/.openclaw/trash/ + updates index.json
↓
Auto-clean: files in trash >7 days cleared every Monday 3 AM
~/.openclaw/trash/index.jsonoriginal_path: original file pathtrashed_path: actual path inside trashtrashed_at: timestamp in seconds when trashedfilename: file nametrash-manager.sh add <file>Move to trash and update index. All deletion operations must use this.
# Example
~/.openclaw/scripts/trash-manager.sh add /path/to/unused-file.txt
~/.openclaw/scripts/trash-manager.sh add ~/.openclaw/workspace/tmp/old.log
trash-manager.sh cleanClean files in trash older than 7 days (triggered by cron on Mondays).
# Dry run (does not actually delete)
~/.openclaw/scripts/trash-manager.sh clean --dry-run
# Actual cleanup
~/.openclaw/scripts/trash-manager.sh clean
trash-manager.sh listList all files in the index.
~/.openclaw/scripts/trash-manager.sh list
trash-manager.sh restore <original_path>Restore a file from trash.
~/.openclaw/scripts/trash-manager.sh restore /path/to/file
If the user changes their mind:
trash-manager.sh list to find the filetrash-manager.sh restore <original_path> to restoreAll agents share the same trash and index. Use trash-manager.sh add for all deletions and trash-manager.sh restore for all restorations.
Note: Trash is shared. File paths are unique, so no cross-agent conflicts. Cleanup is based on trashed_at time, regardless of which agent deleted the file.
trashed_at, not file mtime)Recommended cron for automatic trash cleanup:
{
"name": "Weekly Trash Cleanup",
"schedule": { "kind": "cron", "expr": "0 3 * * 1", "tz": "Asia/Shanghai" },
"payload": {
"kind": "agentTurn",
"message": "Please execute the cleanup task:\n\n1. Run /home/node/.openclaw/scripts/trash-manager.sh clean to remove files trashed more than 7 days ago\n2. Check /home/node/.openclaw/logs/trash-clean.log for cleanup results\n3. Reply with \"Trash cleanup done\" listing how many files were removed",
"timeoutSeconds": 60
},
"delivery": {
"mode": "announce",
"channel": "feishu",
"to": "user:ou_YOUR_OPEN_ID"
},
"sessionTarget": "isolated"
}
Key points:
agentTurn + sessionTarget: "isolated" to run in an isolated session without interrupting the main conversationannounce delivery mode to push results to Feishutrashed_at in the index, not file mtime~/.openclaw/scripts/trash-manager.sh~/.openclaw/trash/index.json