opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat: YOLO Mode - Skip All Permission Prompts (CLI + Desktop)

Open mguttmann opened this issue 4 days ago • 3 comments

Summary

Comprehensive implementation of YOLO mode that allows users to skip all permission prompts. This addresses multiple community requests (#8463, #7928, #1813) with a complete solution for both CLI and Desktop.

Features

CLI Support

Method Usage
Flag opencode --yolo or opencode --dangerously-skip-permissions
Environment Variable OPENCODE_YOLO=true opencode
Commands opencode yolo status / enable / disable
# Check current status
$ opencode yolo status
YOLO mode: ENABLED (saved in config)
Config: /Users/.../.config/opencode/config.json

# Enable permanently
$ opencode yolo enable
YOLO mode ENABLED - saved to config
Warning: All permission prompts will be skipped!

# Disable
$ opencode yolo disable
YOLO mode disabled - removed from config

Desktop App Support

New Settings → Danger Zone tab with:

  • This Session Only - Toggle for current session (resets on restart)
  • Always Enabled - Persists to ~/.config/opencode/config.json
  • Clear visual indicators showing active state
  • Live switching without app restart
  • Warning messaging about the risks

Config File Support

{
  "yolo": true
}

Works in both project-level opencode.json and global ~/.config/opencode/config.json.

Technical Implementation

  • Yolo Module (packages/opencode/src/yolo/index.ts): Centralized state management
  • Permission Bypass (permission/next.ts): Auto-approves in PermissionNext.ask() when YOLO enabled
  • API Endpoints: GET/POST /config/yolo for runtime control
  • Safety: Explicit deny rules are still respected even in YOLO mode

Files Changed

File Changes
packages/opencode/src/yolo/index.ts New module for YOLO state management
packages/opencode/src/cli/cmd/yolo.ts New CLI commands
packages/opencode/src/permission/next.ts Auto-approve logic
packages/opencode/src/server/routes/config.ts API endpoints
packages/opencode/src/flag/flag.ts OPENCODE_YOLO env var
packages/opencode/src/config/config.ts Config schema
packages/opencode/src/index.ts CLI flag + command registration
packages/app/src/components/dialog-settings.tsx Desktop UI

Testing

Manually tested:

  • [x] CLI --yolo flag
  • [x] CLI opencode yolo commands
  • [x] Environment variable
  • [x] Desktop UI toggles
  • [x] Config persistence
  • [x] Live toggle without restart
  • [x] Permission prompts appear when disabled
  • [x] Permission prompts skipped when enabled
  • [x] Switching between session-only and permanent modes

Related Issues

This PR provides a comprehensive solution that addresses:

  • #8463: --dangerously-skip-permissions flag ✅
  • #7928: Runtime permission toggle ✅
  • #1813: YOLO mode / auto-accept ✅

Closes #9070

mguttmann avatar Jan 17 '26 11:01 mguttmann

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found one potential duplicate:

PR #7137: feat: add --dangerously-skip-permissions flag https://github.com/anomalyco/opencode/pull/7137

This PR appears to be directly related as it implements a --dangerously-skip-permissions flag, which is one of the methods mentioned in PR #9073 for skipping permission prompts. The current PR #9073 consolidates this feature under the broader "YOLO mode" umbrella with additional functionality for Desktop UI and runtime configuration.

Note: PR #6968 mentions "Autonomous Mode" in the documentation context but appears less directly related to the implementation.

github-actions[bot] avatar Jan 17 '26 11:01 github-actions[bot]

Thanks for flagging PR #7137!

Comparison of the two implementations:

Feature PR #7137 (surma) PR #9073 (this PR)
CLI --dangerously-skip-permissions ✅ (+ --yolo alias)
Environment variable
TUI warning indicator ✅ (Desktop "ACTIVE" badge)
CLI commands (yolo status/enable/disable)
Desktop UI (Settings → Danger Zone)
Config file support ("yolo": true)
Runtime API (GET/POST /config/yolo)
Session vs Permanent modes
Live toggle without restart

Summary:

  • PR #7137 is a focused CLI-only implementation
  • This PR (#9073) is a comprehensive implementation covering CLI + Desktop + Config + API

If PR #7137's simpler approach is preferred, the maintainers could merge that instead. However, this PR provides a more complete solution that addresses all related feature requests (#8463, #7928, #1813) with full parity between CLI and Desktop.

Happy to consolidate or adjust based on maintainer feedback!

mguttmann avatar Jan 17 '26 11:01 mguttmann

This is such a needed addition IMO, thanks for pushing it!

freak4pc avatar Jan 17 '26 11:01 freak4pc

Added ability to delete individual OAuth accounts:

  • CLI: opencode auth logout now shows account selection for multi-account providers
  • Desktop: Delete button (X) with confirmation for each account in Provider settings
  • API: DELETE /auth/account endpoint

This was a missing feature - you could add multiple accounts but couldn't remove them individually.

mguttmann avatar Jan 17 '26 18:01 mguttmann