Permission Model
Each agent declares required permissions in its frontmatter. OpenCode supports 17 permission types:| Permission | What it controls |
|---|---|
read | Read files from disk |
write | Write new files |
edit | Modify existing files |
bash | Execute shell commands |
glob | Search files by pattern |
grep | Search file contents |
webfetch | Download from URLs |
task | Launch specialized agents |
mcp | Use MCP servers |
todoread | Read task lists |
todowrite | Modify task lists |
distill | Condense information |
prune | Remove unused code |
sequentialthinking | Multi-step reasoning |
memory | Store context between sessions |
browsermcp | Control browser via MCP |
skill | Load specialized skills |
allow— grant without askingask— prompt before each usedeny— block entirely
bash and task) support pattern-based rules:
Presets
Four built-in presets balance security and productivity:Strict
Read-only mode. Agents can explore code but not modify anything.- ✅
read,glob,grep,todoread,todowrite,skill - ⚠️
memoryasks before storing - ❌
write,edit,bash,webfetch,task,mcp,browsermcp
Balanced (Default)
Prompts for risky operations. Most file operations allowed.- ✅
read,write,edit,glob,grep,webfetch,memory,skill - ⚠️
bashasks except for safe git read commands - ⚠️
mcpandbrowsermcpask before use - ✅
tasklaunches agents without prompting
Permissive
Minimal prompts. Agents have broad access.- ✅ All permissions allowed
- No prompts for
bash,mcp,browsermcp
YOLO
Full trust. All permissions granted, no prompts.- ✅ Everything allowed, no confirmation
CONFIRM before install to prevent accidental use.
Use for: Personal projects, throwaway environments, maximum speed.
CLI Flags
Control permissions at install time:Apply a preset
Override specific permissions
Format:[agent:]permission=action
Save preferences
Make permission choices persistent:~/.config/opencode/agent-permissions.json and apply to all future installs unless overridden.
Ignore saved preferences
Resolution Order
When multiple permission sources conflict, precedence from highest to lowest:- CLI overrides (
--permission-override) - CLI preset (
--permissionsor--yolo) - Saved preferences (from previous
--save-permissions) - Agent built-in (from agent’s frontmatter)
Permission Frontmatter
Agents declare permissions in their frontmatter:*matches any commandgit status*matchesgit status,git status --short, etc.- More specific patterns take precedence
Examples
Conservative review workflow
Trusted automation
Per-agent lockdown
Emergency full access
Security Notes
- Permissions are enforced at runtime by OpenCode, not by the installer
- The installer only writes the permission block to the agent file
- Agents with
UNKNOWN_PERMISSIONS(from upstream sync) default toaskfor risky operations - Pattern-based rules are evaluated in order; first match wins
- Saved preferences affect all agents unless overridden per-install
Related
- Lock System — Verify installed agent integrity
- Architecture — System design and data flow