Skip to content

本页由 AI 根据韩语原文翻译,可能存在错误。

第4章 权限与撤销——四种预设,丢弃要小心 ​

必读 想跟着这个阶段学下去,一定要读这一章。

一句话总结:应用的权限用四个预设(Request Review、Default、Auto、Turbo)来选。刚开始请从 Request Review 或 Default 用起。 Review 窗口里的丢弃会不经确认直接生效。终端里有 /rewind,但最可靠的安全网仍然是 Git 记录。

权限是智能体不经我许可就可以做的事情的范围。比如"改文件夹里的文件不用问,安装程序一定要问"这样的约定。为什么需要权限,在 Claude Code 第4章里讲得更详细(选读)。

本指南还没有在应用界面上实际练习过。和你的界面不同时,以你的界面为准。本章以个人 Google 账号为准。[1]

四种权限预设 ​

预设执行命令什么时候用
Request Review所有命令都要许可刚开始、需要谨慎的事
Default在围栏内不问,要出围栏时才问熟悉之后
Auto (Preview)安全的命令自动执行,只问有风险的命令试验功能
Turbo不设限制,全部执行几乎不用

出处:Antigravity 官方文档(只摘录了一部分)[2]

Turbo 没有围栏,可以读写整台电脑。[3] 整理笔记用不着它。

修改的地方有三处。[4]

  • 所有项目:Settings → General → Global Permissions → Permission Preset
  • 单个项目:Settings → Projects
  • 当前对话:输入框里的权限选择器

项目默认跟随全局设置(Inherit Global),也可以给每个项目单独设定。[5] 意思是,信得过的项目可以放宽,信不过的文件夹可以收紧。[6] 个人账号一开始用的是哪个预设,官方文档里没有写。打开应用后请先确认一下。

理解检查

在 Antigravity 应用的权限预设中,不受任何限制地运行所有命令的是哪个?

围栏与默认规则 ​

应用里有终端围栏(沙箱,Sandbox)。这是把智能体执行的命令能碰到的范围挡起来的装置。官方文档说它默认是开着的。[7]

不过各预设不一样。[8]

  • 开:Default、Auto
  • 关:Request Review、Turbo

围栏开着时,命令会被这样限制。

  • 只能用工作文件夹和临时文件夹。
  • 不能上网。[9]
  • ~/.ssh 或 .env 这类敏感文件(装着密码、密钥的文件)也被挡住。[10]

比如在 Default 下,智能体想用一条从网上下载东西的命令,就得走出围栏。这时应用会自己判断这条命令。安全、能撤回的命令不问就继续;有风险或撤不回的命令会停下来,征求我的许可。[2:1]

不管哪个预设,也有一些默认规则。

  • 项目文件夹内的文件读写不会询问。外面的文件需要许可。[11]
  • 读取和操作网页,默认是"询问"。[12]
  • 规则冲突时,按 拒绝(Deny)> 询问(Ask)> 允许(Allow)的顺序决定。[13] 比如同时定了"允许读取网页"和"拦截这个网站",那在这个网站上就是拦截胜出。现在不用急着定规则。

对话中给过的许可可能会保留下来,所以智能体会渐渐学会哪些动作是可以信任的。[14] 虽然方便,但请记住自己许可过什么。

终端(agy)的默认值不一样。 终端在写文件、执行命令、用网页工具之前会询问[15],围栏默认是关着的。[16] 第6章会讲。

理解检查

在应用的 Default 预设和终端(agy)里,命令围栏(沙盒)默认是怎样的?

撤销 ​

请小心 Review 窗口的丢弃。「Discard unstaged changes」是丢弃还没用 git add 放进待记录清单的改动的按钮。这个按钮会不经确认直接生效,甚至把从没记录过的新文件也删掉。[17]

默认视图里也包含我自己改的内容(第2章)。所以按下这个按钮,不只是智能体改的,连我改的内容也可能消失。丢弃之前一定要看一下里面有什么。

最可靠的撤销是 Git 记录。在这一阶段,也沿用 Codex 第4章的同一个习惯。

  1. 交代任务之前:用 Git 把当前状态记录下来。
  2. 交代任务。
  3. 在 Review 窗口用 Agent Edits,只看改动的部分。
  4. 满意就再记录一次,不满意就撤回。

不会 Git 命令也没关系。请智能体"把现在的状态用 Git 记录下来"就行(这是在 Claude Code 里确认过的方法。在 Antigravity 里,本指南还没有确认)。

还有别的撤销功能,但还没确认它们会不会连文件也一起撤销。

详细说明(点击展开)
  • 终端里有 /rewind(或 /undo),能把对话退回到之前稳定的状态。[18] 名字和 Claude Code 的回退很像,但官方文档只说它撤销的是"对话"。是否连文件也一起撤销,文档里没有写。
  • 应用里似乎也有撤销功能。官方更新记录里提到,"Confirm Undo"确认窗口多了一个只撤销对话的选项。[19] 不过没有找到讲解用法的文档,本指南也没能在应用里确认。

理解检查

点击 Review 窗口里的 Discard unstaged changes 时,为什么要小心?

亲自动手试试 ​

  1. 在 Settings → General → Global Permissions 里确认当前的预设。如果是第一次,就用 Request Review 或 Default。
  2. 用 Git 把整理工具文件夹当前的状态记录下来。
  3. 请它在第2章的会议记录"最上面加一行'撰写日期:今天的日期'"。
  4. 在 Review 窗口用 Agent Edits 查看,确认改动过的那一行。

连续任务:第5章要看计划(/plan)、定时(/schedule、Automations)、浏览器(/browser)、目标(/goal)。

小结 ​

  • 应用权限有四个预设。刚开始用 Request Review 或 Default,不要用 Turbo。
  • 应用的围栏在 Default、Auto 预设里是开的,会挡住网络。终端默认是关的。
  • 项目文件夹里的文件不问,外面的和网页要问。
  • Review 窗口的丢弃不经确认直接删除。交代任务之前先用 Git 记录一下。

术语解释 ​

术语中文名称一句话解释
Permission preset权限预设一次性定好权限的组合
Sandbox沙箱限制命令能动范围的围栏
Discard丢弃把改动的内容扔掉
/rewind回退在终端里把对话退回之前状态的命令

这一章读完了吗?

学习记录只保存在这个浏览器中。整体进度可以在 全部目录中查看。

下一章:第5章. 计划、定时、浏览器、目标

参考资料(20 条)
  1. 本章依据 2026年11月1日确认的 Antigravity 官方文档写成。本指南还没有在应用界面上实际练习过。公司、企业账号的权限界面不同。[20] ↩︎

  2. Antigravity 官方文档,「Agent settings」。"Request Review (“Every command requires approval.”): The sandbox is off and every terminal command requires approval." / "Default (“Ask before sensitive operations.”): Commands run without prompting inside the Terminal sandbox; running outside the sandbox requires approval." / "When a command needs to run outside the sandbox, Antigravity automatically evaluates it so safe, reversible commands proceed without prompting while risky or irreversible actions still pause for your approval." antigravity.google (确认日期 2026-11-01) ↩︎

  3. Antigravity 官方文档,「Agent settings」。"Turbo (“Run all commands without restrictions.”): All commands run without prompting with no isolation or restrictions, and the agent has full read and write access to your filesystem." antigravity.google (确认日期 2026-11-01) ↩︎

  4. Antigravity 官方文档,「Agent settings」。"For all projects: Open Settings > General > Global Permissions > Permission Preset." / "From the message box (v2.23.0+): Choose a preset from the permissions picker." / "For a single project: Override the global preset under Settings > Projects. Projects default to Inherit Global, which follows your global preset." antigravity.google (确认日期 2026-11-01) ↩︎

  5. Antigravity 官方文档,「Agent settings」。"Projects default to Inherit Global, which follows your global preset." antigravity.google (确认日期 2026-11-01) ↩︎

  6. Antigravity 官方文档,「Antigravity features」。"This means you can have a more permissive setting for a trusted project and a more restrictive security setting for an untrusted folder." antigravity.google (确认日期 2026-11-01) ↩︎

  7. Antigravity 官方文档,「Terminal sandbox」。"Antigravity includes a terminal sandbox, enabled by default, that isolates shell commands executed by agents." antigravity.google (确认日期 2026-11-01) ↩︎

  8. Antigravity 官方文档,「Terminal sandbox」。"| Default | On | Allowed in sandbox; ask outside |" / "| Turbo | Off | Allowed without prompting, unrestricted |" antigravity.google (确认日期 2026-11-01) ↩︎

  9. Antigravity 官方文档,「Agent permissions」。"Default (“Ask before sensitive operations.”): Terminal commands run inside the isolated Terminal sandbox with access restricted to your workspace and temp directories and no network access." antigravity.google (确认日期 2026-11-01) ↩︎

  10. Antigravity 官方文档,「Terminal sandbox」。"Sensitive files such as ~/.ssh and .env are blocked, anything not explicitly mounted is invisible inside the sandbox, and network access is limited to domains you’ve approved." antigravity.google (确认日期 2026-11-01) ↩︎

  11. Antigravity 官方文档,「Agent permissions」。"Workspace files: Reading and writing files inside your active project directory is allowed without prompting, while non-workspace files require approval." antigravity.google (确认日期 2026-11-01) ↩︎

  12. Antigravity 官方文档,「Agent permissions」。"Web browsing defaults to Ask: Actions for read_url and execute_url default to Ask." antigravity.google (确认日期 2026-11-01) ↩︎

  13. Antigravity 官方文档,「Agent permissions」。"Precedence rule: Conflicting rules are strictly evaluated in priority order: Deny > Ask > Allow." antigravity.google (确认日期 2026-11-01) ↩︎

  14. Antigravity 官方文档,「Antigravity features」。"Permissions manually granted during a conversation can persist, allowing the agent to learn trusted actions over time." antigravity.google (确认日期 2026-11-01) ↩︎

  15. Antigravity 官方文档,「Antigravity features」。"The default request-review permission asks before the agent writes files, runs shell commands, or uses web tools, unless one of your allow rules matches." antigravity.google (确认日期 2026-11-01) ↩︎

  16. Antigravity 官方文档,「Antigravity features」。"The terminal sandbox is off by default." antigravity.google (确认日期 2026-11-01) ↩︎

  17. Antigravity 官方文档,「Review changes」。"Discard unstaged changes takes effect immediately, without asking you to confirm. It also deletes untracked files from disk." antigravity.google (确认日期 2026-11-01) ↩︎

  18. Antigravity 官方文档,「CLI best practices」。"Type /rewind (or /undo) to roll back your conversation thread to a previous stable checkout." antigravity.google (确认日期 2026-11-01) ↩︎

  19. Antigravity 官方文档,「Changelog」。"The Confirm Undo dialog now offers an option to revert only the conversation." antigravity.google (确认日期 2026-11-01) ↩︎

  20. Antigravity 官方文档,「Agent settings」。"Business and enterprise accounts use the following settings instead of the permission presets above." antigravity.google (确认日期 2026-11-01) ↩︎