Modes
Modes customize opencode's behavior for different workflows. They allow you to configure model selection, temperature, prompts, and tool access for specific use cases.
Built-in Modes
Build Mode
The default mode with full tool access for standard development work. All tools are enabled.
Plan Mode
A restricted mode designed for planning and analysis. The following tools are disabled by default:
writeeditpatchbash
Switch between modes using the Tab key during a session.
Configuration Options
| Option | Purpose |
|---|---|
model | Override the default AI model |
temperature | Response randomness (0.0-1.0) |
prompt | Custom system instructions via file reference |
tools | Enable/disable specific capabilities |
Available Tools
bash- Execute shell commandsedit- Edit existing fileswrite- Create new filesread- Read file contentsgrep- Search file contentsglob- Find files by patternlist- List directory contentspatch- Apply patchestodowrite- Write to todo listtodoread- Read todo listwebfetch- Fetch web content
Configuration Methods
JSON Configuration
Add to opencode.json:
{
"agent": {
"debug": {
"mode": "primary",
"model": "anthropic/claude-sonnet-4",
"temperature": 0.2,
"tools": {
"write": false,
"edit": false
}
}
}
}Markdown Configuration
Create files in .opencode/mode/ (project) or ~/.config/opencode/mode/ (global):
---
description: Debug mode for investigation
mode: primary
temperature: 0.2
tools:
write: false
edit: false
---
You are in debug mode. Focus on investigating issues without making changes.Common Use Cases
Code Review Mode
{
"agent": {
"review": {
"mode": "primary",
"description": "Reviews code for quality and security",
"tools": {
"write": false,
"edit": false,
"bash": false
}
}
}
}Documentation Mode
{
"agent": {
"docs": {
"mode": "primary",
"description": "Writes and updates documentation",
"model": "anthropic/claude-sonnet-4",
"temperature": 0.3
}
}
}Refactoring Mode
{
"agent": {
"refactor": {
"mode": "primary",
"description": "Refactors code with careful analysis",
"temperature": 0.1
}
}
}Switching Modes
- Press Tab to cycle through primary modes
- Use configured keybinds for direct access
- Modes persist within a session until changed