[Feature]: Runtime Permission Mode Toggle (like Claude Code's Shift+Tab)
Feature Request: Runtime Permission Mode Toggle
Problem
Currently, OpenCode defaults to auto-edit mode where all file edits execute immediately without confirmation. This is too aggressive for many workflows and can lead to unintended changes.
While permissions can be configured statically in opencode.json, there is no way to toggle between permission modes at runtime without switching agents.
Claude Code solves this elegantly with Shift+Tab cycling through three modes:
- Normal - Edits require confirmation
- Plan - Read-only analysis, no edits allowed
- Auto - Edits execute automatically
Proposed Solution
Add a dedicated keybind (suggest Shift+Tab or configurable) that cycles through permission modes within the current agent:
[Normal Mode] ──Shift+Tab──▶ [Plan Mode] ──Shift+Tab──▶ [Auto Mode]
▲ │
└──────────────────────Shift+Tab───────────────────────┘
Mode behaviors:
| Mode | edit | write | bash |
|---|---|---|---|
| Normal | ask | ask | ask (except safe commands) |
| Plan | deny | deny | deny (read-only commands allowed) |
| Auto | allow | allow | allow |
Current Workaround
Users can create multiple agents with different permissions and use Tab to switch between them:
{
"agent": {
"build": {
"permission": { "edit": "ask" }
}
}
}
<!-- ~/.config/opencode/agent/auto.md -->
---
permission:
edit: allow
write: allow
---
Problems with this workaround:
- Agents have separate conversation contexts
- Switching agents feels like starting over
- Not intuitive for new users expecting Claude Code behavior
- Requires manual configuration
Why This Matters
- Safety by Default - New users should not accidentally overwrite files
- Workflow Flexibility - Sometimes you want to review changes, sometimes you trust the AI
- User Expectations - Claude Code has set the standard for this interaction pattern
- Reduced Anxiety - Users can confidently explore knowing they have control
Implementation Suggestion
- Add a session-level permission override state
- Add keybind
permission_mode_cycle(default:shift+tabif not conflicting) - Show current mode in status bar or input area (e.g.,
[Normal],[Plan],[Auto]) - Persist mode preference per session or globally
Visual Indicator
Show the current mode near the input area:
┌─────────────────────────────────────────┐
│ [Normal] │ Type your message... │
└─────────────────────────────────────────┘
Or in a status line:
build │ claude-sonnet │ Normal Mode
Configuration
Allow users to customize the default mode:
{
"permission": {
"defaultMode": "normal" // "normal" | "plan" | "auto"
}
}
Related
- Current workaround uses agent switching via
Tab/Shift+Tab(agent_cycle keybinds) - Permission system:
packages/opencode/src/permission/ - Claude Code reference: https://docs.anthropic.com/en/docs/claude-code
Note
This is different from the existing agent-switching mechanism. The goal is to change permission behavior within the same agent/session without losing conversation context.