agentleFS
Marnie0415Marnie0415/pi-skills/permission-modes/SKILL.md

permission-modes

Skill1 starsChanged 5 months agoMITView on GitHub

Control pi's permission levels (default/auto/bypass) with automatic file backup and restore. Use when needing to adjust execution autonomy or recover accidentally modified files.

  • Pipes a download into a shell
  • Reads credentials
  • Deletes or force-pushes
  • Installs packages
  • Sends data out
  • Commits and pushes

The file

Files
SKILL.md

Permission Modes Skill

本技能定义了 pi 的三种权限模式,以及对应的安全备份机制。


权限模式总览

模式命令行为适用场景
default 🔒/pm default每次 bash/write/edit 都弹窗确认初次使用、不熟悉的项目、高价值代码
auto ⚠️/pm auto安全操作自动放行,危险操作弹窗确认日常开发、中等信任度
bypass 🚀/pm bypass所有操作自动执行(文件自动备份)信任的 agent、重复性任务

安全备份机制

在 所有模式 下,write 和 edit 操作在执行前会自动备份目标文件:

  • 备份位置: ~/.pi/agent/backups/
  • 备份命名: <文件路径>.<时间戳>-<随机ID>.bak
  • 最大保留: 200 个最新备份(自动淘汰最旧的)
  • 保留期限: 30 天
  • 文件大小限制: 超过 10MB 的文件不备份

备份命令

命令说明
/backups列出所有有备份的文件
/backups --stats查看备份统计
/backups --file <路径>查看某个文件的所有备份
/restore <backup-id>从指定备份恢复文件
/restore <文件路径>交互式选择该文件的备份并恢复
/pm backup on启用自动备份(默认开启)
/pm backup off禁用自动备份

Auto 模式分类规则

危险操作(会弹窗确认)

# 文件删除
rm -rf / rm --recursive

# 权限提升
sudo

# 权限修改
chmod 777 / chown 777

# 磁盘操作
dd / mkfs / fdisk / parted / mkswap

# 远程下载并执行
curl | bash / wget | sh

# 系统用户管理
passwd / useradd / usermod

# 进程管理
killall / pkill

# 系统重启/关机
systemctl reboot / systemctl poweroff

# 包卸载
apt-get remove/purge / pip uninstall / npm uninstall

# Git 破坏性操作
git push --force / git reset --hard / git clean -fd

# 修改系统配置
> /etc/  / mv ... /etc/  / rm /etc/

状态变更操作(auto 模式会弹窗确认)

# 包安装
git/npm/pip/apt install

# 发布操作
npm publish/unpublish / gh pr merge

# Git 推送
git push

# Docker 构建/推送
docker build/push/tag/rmi/system prune

# HTTP 写操作
curl -X POST/PUT/DELETE/PATCH

敏感文件(auto 模式下修改这些会弹窗确认)

  • .env / .env.* — 环境变量/密钥
  • .pem / .key — 证书/私钥
  • id_rsa / id_ed25519 — SSH 密钥
  • credentials.json — 凭证文件
  • secrets.* — 机密文件
  • .htpasswd / .pgpass — 密码文件
  • service-account* — 服务账户

LLM 行为指导

在 bypass 模式下

  • 你有完全的执行自主权
  • 文件在修改前会自动备份,可随时用 /restore 恢复
  • 建议:先读取文件了解内容再修改
  • 建议:批量操作分步执行,不要一次完成所有修改

在 auto 模式下

  • 安全操作自动执行,不需要用户确认
  • 危险操作会弹窗,需要在发起前向用户解释
  • 在调用危险操作前,先在回复中说明你要做什么

在 default 模式下

  • 每次工具调用都会弹窗等待用户批准
  • 在发起每次操作前,先向用户解释你要做什么以及为什么
  • 如果用户反复拒绝,换一种方法尝试

故障恢复流程

如果 LLM 操作失误导致文件损坏:

  1. 运行 /backups --file <路径> 查看该文件的备份
  2. 运行 /restore <backup-id> 恢复
  3. 如果备份也不理想,可以切换模式到 default 重新操作

注意: 备份机制自动在每次 write/edit 前快照文件,所以即使 bypass 模式翻车了,也能找回修改前的版本。

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.