← 返回 Skills 市场
lucas260514

Trash Manager

作者 lucas0514 · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ⚠ suspicious
69
总下载
1
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install trash-manager
功能描述
Trash management with index tracking for all agents. Use when deleting files to ensure proper index registration and 7-day auto-cleanup.
使用说明 (SKILL.md)

Trash Manager 🗑️

Trash management with index tracking. All agents must use this for file deletion — no bare rm or mv to trash.

Core Rule

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 \x3Cfile> = correct ✅

Workflow

User/Agent requests file deletion
    ↓
Check if file is truly no longer needed
    ↓
Call trash-manager.sh add \x3Cfile>
    ↓
Auto: moves to ~/.openclaw/trash/ + updates index.json
    ↓
Auto-clean: files in trash >7 days cleared every Monday 3 AM

Index File

  • Path: ~/.openclaw/trash/index.json
  • Fields:
    • original_path: original file path
    • trashed_path: actual path inside trash
    • trashed_at: timestamp in seconds when trashed
    • filename: file name

Commands

trash-manager.sh add \x3Cfile>

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 clean

Clean 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 list

List all files in the index.

~/.openclaw/scripts/trash-manager.sh list

trash-manager.sh restore \x3Coriginal_path>

Restore a file from trash.

~/.openclaw/scripts/trash-manager.sh restore /path/to/file

Restore Flow

If the user changes their mind:

  1. Run trash-manager.sh list to find the file
  2. Run trash-manager.sh restore \x3Coriginal_path> to restore
  3. The entry is removed from index, file returns to original path

Other Agents

All 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.

Constraints

  • Retention: 7 days (based on trashed_at, not file mtime)
  • Conflicts: same-name files get a numeric prefix
  • Irreversible: once auto-cleaned, files are permanently gone

Recommended Cron Setup

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:\
\
1. Run /home/node/.openclaw/scripts/trash-manager.sh clean to remove files trashed more than 7 days ago\
2. Check /home/node/.openclaw/logs/trash-clean.log for cleanup results\
3. 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:

  • Use agentTurn + sessionTarget: "isolated" to run in an isolated session without interrupting the main conversation
  • Use announce delivery mode to push results to Feishu
  • Cleanup is based on trashed_at in the index, not file mtime

Related Files

  • Script: ~/.openclaw/scripts/trash-manager.sh
  • Index: ~/.openclaw/trash/index.json
  • Cron: Runs clean every Monday 3 AM
安全使用建议
Install only if you are comfortable with agents routing deletions through a shared trash area and, if you configure the cron example, permanently deleting trashed files after 7 days. Before using it broadly, require your agent to ask before trashing important or user-owned files and verify what ~/.openclaw/scripts/trash-manager.sh actually does.
能力评估
Purpose & Capability
The purpose is coherent: it tells agents to move files through a shared trash manager with an index, restore flow, and 7-day retention instead of using bare rm.
Instruction Scope
The instructions apply to all deletion operations by all agents and include agent-initiated deletion after checking whether a file is no longer needed, but they do not require explicit user confirmation for non-temporary or user-owned files.
Install Mechanism
The submitted artifact is only SKILL.md and declares a python3 binary requirement; it references an external ~/.openclaw/scripts/trash-manager.sh script but does not include or install it in the artifact.
Credentials
A shared trash and index under ~/.openclaw is proportionate for a trash workflow, but the scope is broad because it covers arbitrary file paths and all agents without path limits or ownership boundaries.
Persistence & Privilege
The recommended cron setup would automatically run cleanup every Monday and permanently remove files older than 7 days; this is disclosed, but high-impact and not paired with a mandatory confirmation or opt-in guard in the skill instructions.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install trash-manager
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /trash-manager 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
English only, removed agent names, cleaner cron setup
v1.0.0
Initial release of trash-manager: - Provides a unified trash system with index tracking for all agents. - Enforces deletion via trash-manager.sh add, disallowing direct rm/mv to trash. - Maintains index.json with original path, trashed location, timestamp, and filename. - Supports auto-cleanup of files older than 7 days (via cron). - Includes commands for add, clean (with --dry-run), list, and restore. - Ensures all agents share the same trash and index for consistent file management.
元数据
Slug trash-manager
版本 1.0.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

Trash Manager 是什么?

Trash management with index tracking for all agents. Use when deleting files to ensure proper index registration and 7-day auto-cleanup. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 69 次。

如何安装 Trash Manager?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install trash-manager」即可一键安装,无需额外配置。

Trash Manager 是免费的吗?

是的,Trash Manager 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Trash Manager 支持哪些平台?

Trash Manager 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Trash Manager?

由 lucas0514(@lucas260514)开发并维护,当前版本 v1.0.1。

💬 留言讨论