safe-file-deletion
它能做什么
这是一条安全规则,在你批准之前阻止 AI 智能体删除文件。适用于让智能体处理自己文件、并希望防止误删的人。
适用场景
- ✓当智能体即将运行 rm、unlink 或类似的删除命令时。
- ✓当任务会一次删除一个文件夹或多个文件时。
- ✓当你希望在删除任何文件之前,得到明确的是或否的答复时。
技能链接
https://github.com/MemTensor/MemOS/blob/main/apps/openwork-memos-integration/apps/desktop/skills/safe-file-deletion/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请清理旧的构建文件夹,但在删除任何东西之前先问我。”
每周 5 个新技能,1 分钟读完。
工作原理
在任何删除操作之前,智能体都会请求许可,并列出涉及的文件。如果你拒绝,它不会删除这些文件,也不会尝试变通办法。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Safe File Deletion
Rule
Before deleting ANY file, you MUST:
- Call
request_file_permissionwithoperation: "delete" - For multiple files, use
filePathsarray (not multiple calls) - Wait for response
- Only proceed if "allowed"
- If "denied", acknowledge and do NOT delete
Applies To
rmcommands (single or multiple files)rm -rf(directories)unlink,fs.rm,fs.rmdir- Any script or tool that deletes files
Examples
Single file:
{
"operation": "delete",
"filePath": "/path/to/file.txt"
}
Multiple files (batched into one prompt):
{
"operation": "delete",
"filePaths": ["/path/to/file1.txt", "/path/to/file2.txt"]
}
No Workarounds
Never bypass deletion warnings by:
- Emptying files instead of deleting
- Moving to hidden/temp locations
- Using obscure commands
The user will see a prominent warning. Wait for explicit approval.
常见问题
它也涵盖文件夹吗?
涵盖。它适用于删除目录的操作,例如 rm -rf,也适用于单个文件。
被拒绝的请求,智能体能绕过吗?
不能。该技能禁止变通办法,例如清空文件或把文件移到隐藏位置。
智能体如何请求许可?
它使用文件权限请求,会向你显示警告并等待你的回答。
详情
作者的原始描述
Enforces explicit user permission before any file deletion. Activates when you're about to use rm, unlink, fs.rm, or any operation that removes files from disk. MUST be followed for all delete operations.
repo: MemTensor/MemOS
热度
- GitHub 星标
- 12k
- 排名
- #11402
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
memos-local
12k帮你的智能体安装并设置 MemOS,这是 OpenClaw 的本地记忆插件,让它能记住你设备上的过往对话。
browserwing-admin
12k帮你的智能体安装和管理 BrowserWing 浏览器自动化工具,包括创建、运行和修复自动化脚本。
browserwing-executor
12k让你的智能体通过 HTTP API 控制浏览器,打开页面、点击、输入、提取数据、截图,并运行成批的步骤。
memos-memory-guide
12k教你的智能体在你提到过去的对话、你的偏好或过去的决定时,搜索你的历史对话和共享的团队记忆。