Where Action Stops: Trust, Policy, Confirmation, and Sandboxing

Gemini CLI's safety boundary is a sequence, not a single switch. Before a requested command or edit can affect a machine, the project may be inspected for trust, the tool call can be evaluated by policy, a person may be asked to confirm it, and the execution can be restricted by a sandbox and a sanitized environment. This chapter follows that sequence so readers can choose an operating mode deliberately and understand what each layer does—and what it cannot do.

The distinction matters in an ordinary code task. A model may receive an instruction from a repository, propose an edit, and ask to run a test. Those events do not have the same authority. The repository's instructions may or may not be loaded. The edit may be a registered capability but still require approval. The test may be allowed by policy but blocked by a sandbox path or network restriction. Gemini CLI's design is easiest to understand when each transition has a clear question: may this project influence the agent, may this tool call proceed, and where may the resulting process reach?

sequenceDiagram actor User participant CLI as Gemini CLI participant Trust as Workspace trust participant Policy participant Confirm as Confirmation participant Sandbox participant Tool User->>CLI: Request a file change or command CLI->>Trust: Discover project configuration alt Workspace is untrusted Trust-->>CLI: Restricted operation CLI-->>User: Prompt or headless failure else Workspace is trusted Trust-->>CLI: Project influence permitted end CLI->>Policy: Evaluate tool, arguments, mode, and environment alt Policy denies Policy-->>CLI: Deny without execution CLI-->>User: Explain blocked request else Policy asks Policy->>Confirm: Request approval Confirm-->>User: Show intended operation alt User cancels Confirm-->>CLI: Cancel else User approves Confirm-->>CLI: Proceed end else Policy allows Policy-->>CLI: Proceed end CLI->>Sandbox: Prepare paths, network, and environment alt Extra permission is required Sandbox-->>CLI: Expansion request CLI->>Confirm: Ask for scoped expansion Confirm-->>CLI: Approve or cancel end CLI->>Tool: Execute within prepared boundary Tool-->>CLI: Result, error, or denial

The diagram shows a typical mutating request, not a promise that every read requires approval. It also separates two kinds of trust. Workspace trust concerns project-supplied influence and configuration. Tool policy concerns a particular capability and its arguments. Sandboxing concerns the environment in which an authorized process runs. A strong workflow uses the layers together rather than asking one layer to solve every problem.

Trust decides what the project may influence

A repository is not only source code. It can contain configuration, context files, custom commands, skills, hooks, agents, MCP server definitions, and environment files. Some of those inputs can change what Gemini CLI loads or what processes it starts. Folder trust exists to keep a project from silently supplying that influence before the user has evaluated it.

When trust checking is active, Gemini CLI performs a discovery phase before the trust decision.