Configure how the Antigravity agent executes terminal commands, modifies files, and uses the terminal sandbox across the desktop application and CLI.
Antigravity App
更新后的权限设置
权限设置
此设置控制如何使用 权限预设 批准 Agent 操作(终端命令、文件访问、MCP 工具和网页读取):
- Request Review (“Every command requires approval.”): The sandbox is off and every terminal command requires approval. The agent can read and write the workspace, and needs approval for anything else.
- Default(“在执行敏感操作前询问。”;默认):命令在终端沙箱内运行时不会弹出提示;在沙箱外运行则需要获得批准。Agent 可以读写工作区和临时目录,执行其他任何操作都需要获得批准。
- Auto(“自动决定是否运行命令。”):命令在终端沙箱内运行时无需提示,且 Agent 可以直接读写工作区和临时目录而无需询问。当命令需要在沙箱外运行时,Antigravity 会自动评估该命令,使安全、可逆的命令无需提示即可继续执行,而存在风险或不可逆的操作仍会暂停并等待您的批准。
- 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.
您配置的允许、拒绝和询问权限规则位于预设之上,并且始终优先。要了解更多信息,请参阅 Agent 权限。
更改权限预设
You can change the preset in three places:
- 所有项目:打开 Settings > General > Global Permissions > Permission Preset(如果您可以使用远程 Agent,则为 Permissions > This Computer)。
- For a single project: Override the global preset under Settings > Projects. Projects default to Inherit Global, which follows your global preset.
- From the message box (
v2.23.0+): Choose a preset from the permissions picker. The picker changes your global preset, or the project’s preset if the project overrides it. To remove a project override, choose Use Global Settings.
For screenshots of the Settings selector and the message box picker, refer to Change your permission preset.
旧版权限设置
终端命令自动执行
此设置控制 Agent 如何执行生成的 shell 命令:
- Require Review: The agent never executes terminal commands without prompting (except those explicitly added to your configurable Allow list).
- 在沙箱中继续:终端沙箱内部无提示运行命令;需要在其外部运行的命令仍然需要审查。
- 始终继续:Agent 执行命令而不提示(明确添加到可配置拒绝列表中的命令除外)。
Agent 非工作区文件访问
此设置允许 Agent 查看和编辑活动项目文件夹之外的文件:
- 默认情况下,Agent 只能访问项目内的文件夹和应用程序的本地应用程序数据目录
~/.gemini/antigravity/(其中包含产物、知识项等)。 - 强制执行此边界可以保护您的本地敏感数据。谨慎启用非工作空间访问。
终端沙箱模式
此设置将 Agent 终端命令限制在隔离的沙箱中:
- 启用后,shell 命令在沙箱内执行,而无需访问敏感系统路径或未经授权的网络。
- 您可以在应用程序首选项中全局配置此设置或按项目覆盖它。
- 要了解更多信息,请参阅 终端沙箱 指南。
Antigravity CLI
Agent 执行与权限设置
Antigravity CLI lets you configure how the agent edits files, runs shell commands, and enforces workspace boundaries through /config (/settings), ~/.gemini/antigravity-cli/settings.json, or command-line flags:
- Agent Mode (
agentMode/--mode): Controls the session execution mode (cycle during a session with Shift + Tab):default(在default中选择/config,或在agentMode中将""设为settings.json):在修改或创建文件前提示交互式差异审阅,并遵循toolPermission设置处理命令。auto(自v1.5.7起,在支持auto模式的环境中为默认模式):自动批准工作区文件编辑,默认在终端沙箱内运行终端命令,并自动评估需要在沙箱外运行的命令,从而让安全、可逆的命令无需提示即可直接运行,而存在风险或不可逆的命令则会暂停并等待批准。启用时,右下角状态栏会显示auto,提示词输入框会显示Auto mode: edits & safe commands auto-approved (shift+tab to cycle)。accept-edits:自动批准工作区文件的编辑与创建操作,同时继续对命令遵循toolPermission策略。plan: Analyzes the codebase and outlines a plan before making edits.
- Tool Permission (
toolPermission): Controls the baseline authorization policy for tools outsideautomode (and forstrictandalways-proceedoverrides):request-review(toolPermission的默认值):在运行写入、Shell 或网络工具前提示批准。proceed-in-sandbox: Automatically runs sandboxed terminal commands and prompts when commands need to run outside the sandbox.strict: Prompts before all non-read tool calls (overridesautomode).always-proceed: Runs all tools without prompting (overridesautomode; also activated by--dangerously-skip-permissions).
- 沙箱模式 (
enableTerminalSandbox/--sandbox):将 Agent 的 Shell 命令限制在操作系统级容器边界内(在auto模式下自动启用;在其他模式下默认为false)。 - Non-Workspace Access (
allowNonWorkspaceAccess): Controls whether the agent can read or write files outside your active workspace directories (falseby default).
配置示例
在 ~/.gemini/antigravity-cli/settings.json 中配置偏好的 Agent 执行设置(例如,自动批准工作区编辑,同时在运行 Shell 命令前提示确认):
{
"agentMode": "accept-edits"
}To learn more, refer to Choose an execution mode, Settings, Agent permissions, and Terminal sandbox.