Skip to main content

Approval modes

By default, OpsCode asks for your approval before running any tool that can modify files, execute shell commands, make outbound network calls, or spawn subagents. Read-only operations such as ls, read_file, glob, and grep always run without prompting.

Approval modes let you control how much human oversight each session requires for gated actions.

Choose a mode​

ModeBehaviorCLI flag
Manual (default)Prompts before every gated action (write_file, edit_file, execute, web requests, subagents)(none)
AutoAuto-approves safe read-only commands (kubectl get, tofu validate); prompts before mutating actions-y, --auto-approve
YOLORuns all tool calls without interactive review after an explicit risk acknowledgement--yolo

Press Shift+Tab at any time during an interactive session to toggle between Manual and Auto mode.

Auto mode is a safety heuristic for local development. It is not a container boundary or OS-level sandbox. To isolate untrusted or destructive workloads, run OpsCode inside Remote Sandboxes.

Manual mode​

In Manual mode, every mutating tool call pauses execution and displays an interactive approval bar:

[Approve]  [Reject]  [Edit Command]  [Always Allow]

You inspect the exact shell command or unified file diff before it touches your filesystem or cloud environment. Manual mode is recommended whenever your terminal holds active credentials for production clusters or cloud accounts.

Auto mode​

Auto mode uses a command classifier to distinguish safe inspection commands from state-changing operations:

  • Auto-approved: ls, grep, cat, kubectl get, kubectl describe, terraform validate, tofu fmt -check, and workspace file reads.
  • Gated (prompts for review): terraform apply, tofu apply, kubectl delete, rm, helm upgrade, and file writes or edits.

Start OpsCode in Auto mode from the command line:

ops -y

Or configure Auto mode as your default in ~/.opscode/config.toml:

[startup]
mode = "auto"

YOLO mode​

YOLO mode executes all tool calls without interruption. The first time you enable it, OpsCode displays a safety acknowledgement dialog explaining the risks.

ops --yolo

Never run --yolo against production cloud accounts or live Kubernetes contexts. When using --yolo in automated pipelines, pair it with an ephemeral Remote Sandbox and scoped IAM credentials.

Switch modes at runtime​

Press Shift+Tab in an interactive session to cycle through available modes:

Manual → Auto → YOLO → Manual

The keyboard cycle respects your configuration:

  • Auto is skipped if the command classifier is disabled for the current environment.
  • YOLO is skipped unless you explicitly enable [startup].yolo_switcher = true in ~/.opscode/config.toml.

Per-thread persistence​

OpsCode saves the active approval mode per conversation thread. When you resume a thread with ops -r, OpsCode restores the exact approval mode that was active when you left off.

Shell allowlists​

You can pre-approve specific CLI binaries so they bypass interactive prompts regardless of the active approval mode:

# Allow specific DevOps binaries
ops -S "terraform,tofu,kubectl,helm"

# Use the curated read-only recommended set
ops -S recommended

# Allow all shell commands
ops -S all

To persist your shell allowlist across sessions, add it to ~/.opscode/config.toml:

[tools]
shell_allow_list = ["tofu", "terraform", "kubectl", "helm", "ansible-playbook"]

Fine-grained permissions​

In addition to high-level approval modes, you can configure granular permission flags in ~/.opscode/config.toml:

PermissionDefaultControls
shell_readtrueNon-mutating shell commands (kubectl get, git status)
shell_writefalseMutating shell commands (kubectl apply, rm)
file_readtrueWorkspace file reads (read_file, grep, glob, ls)
file_writefalseFile creation, edits, and deletions
infra_planfalseInfrastructure dry-runs (terraform plan, tofu plan)
infra_applyfalseInfrastructure state changes (terraform apply, tofu apply)

Run /permissions inside an interactive session to inspect and toggle these flags on the fly.

Defense-in-depth security layers​

OpsCode enforces automated safety checks on every tool invocation regardless of which approval mode is active:

  1. Shell safety classification: Every shell command is parsed (including pipes, subshells, and command chaining) and classified as read-only or mutating before execution.
  2. Headless MCP guard: In non-interactive (-n) mode, MCP tools are categorized into four security tiers (READ_ONLY, MUTATING_SAFE, MUTATING_DESTRUCTIVE, and PRIVILEGED). Destructive and privileged MCP calls are blocked unless explicitly allowlisted.
  3. Subagent tool scoping: Subagents can only invoke the tools declared in their AGENTS.md frontmatter and cannot escalate their own permissions.
  4. Unicode and homoglyph scanning: Tool arguments and model inputs are scanned for zero-width characters, homoglyphs, and bidirectional text overrides (Trojan Source vectors).
  5. SSRF and metadata protection: Web fetch tools block requests to loopback addresses, RFC 1918 private networks, and cloud instance metadata endpoints (169.254.169.254, metadata.google.internal).