← 返回
未分类 中文

Workspace Trash

Soft-delete protection for workspace files. Intercept file deletions and move them to a recoverable trash instead of permanent removal. Use when deleting, re...
软删除保护工作区文件。拦截文件删除并将其移至可恢复的回收站而非永久删除。适用于删除时...
crewhaus crewhaus 来源
未分类 clawhub v1.2.0 1 版本 99815.2 Key: 无需
★ 0
Stars
📥 540
下载
💾 0
安装
1
版本
#latest

概述

Workspace Trash

Never permanently delete workspace files. Always use trash instead of rm.

Dependencies

  • Node.js (node) — required for manifest (JSON) management
  • POSIX utilitiesmv, cp, rm, find, awk, date, basename, dirname

Configuration

VariableDefaultDescription
---------
OPENCLAW_HOME$HOME/.openclawOpenClaw root directory. Only files under this path can be trashed.
OPENCLAW_WORKSPACE$OPENCLAW_HOME/workspacePrimary workspace directory. Trash lives at $OPENCLAW_WORKSPACE/.trash/.

These variables are standard OpenClaw environment variables and are typically already set. The script uses safe defaults if unset.

Slash Commands

  • /trash — Show trash menu (view, empty, restore options)
  • /trash:view — List all items in trash
  • /trash:empty — Permanently delete all trash contents (confirm first!)
  • /trash:restore — List items and ask which to restore

Script

bash skills/workspace-trash/scripts/trash.sh <action> [args...]

Actions: move, list, restore , empty, size

Security

  • Scope lock: Only files under $OPENCLAW_HOME (default ~/.openclaw/) can be trashed. Paths outside this boundary are refused.
  • Symlink resolution: All paths are resolved to their real location before the scope check, preventing symlink traversal attacks.
  • No shell interpolation of user data: All user-provided paths and filenames are passed to Node.js via environment variables (process.env), never via string interpolation into node -e scripts. This prevents code injection via crafted filenames.
  • -- separators: All mv, cp, and rm calls use -- to prevent filenames starting with - from being interpreted as flags.

Destructive Operations

  • empty action: Uses rm -rf to permanently delete all trash contents. This is irreversible. The agent must always confirm with the user and show what will be deleted before running this action.
  • Cross-filesystem fallback: When mv fails across filesystem boundaries, the script falls back to cp -a + rm -rf. The source is only deleted after a successful copy.

Rules

  1. NEVER use rm or rm -rf on OpenClaw files. Always use the trash script's move action instead.
  2. When asked to delete/remove/clean up files, use trash.sh move — not rm.
  3. Before emptying trash, always confirm with the user and show what will be deleted.
  4. The trash lives at .trash/ in the primary workspace root. A .manifest.json tracks original paths for restoration.
  5. Scope: any file under ~/.openclaw/ — primary workspace, agent workspaces (workspace-*), and other OpenClaw directories. The script refuses paths outside ~/.openclaw/.
  6. Cross-filesystem support: Agent workspaces may be on different mounts. The script uses cp -a + rm as a fallback when mv fails across filesystems. Restore also handles cross-filesystem moves.
  7. Restore by index number (from list) or by trash name. Items from agent workspaces show [agent] tag in list view.
  8. When multiple files are being deleted, pass them all in one command: trash.sh move file1 file2 dir1

版本历史

共 1 个版本

  • v1.2.0 当前
    2026-05-02 00:03 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

office-efficiency

Word / DOCX

ivangdavila
创建、检查和编辑 Microsoft Word 文档及 DOCX 文件,支持样式、编号、修订记录、表格、分节符及兼容性检查等功能。
★ 457 📥 152,137
office-efficiency

Excel / XLSX

ivangdavila
创建、检查和编辑 Microsoft Excel 工作簿及 XLSX 文件,支持可靠的公式、日期、类型、格式、重算及模板保留功能。
★ 381 📥 144,686
ai-agent

Focus Tracker

crewhaus
在压缩和会话重启之间保持对当前工作的持续专注。适用于开始多步骤项目、压缩后恢复等场景。
★ 0 📥 867