文档
English Docs
Modes

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:

  • write
  • edit
  • patch
  • bash

Switch between modes using the Tab key during a session.

Configuration Options

OptionPurpose
modelOverride the default AI model
temperatureResponse randomness (0.0-1.0)
promptCustom system instructions via file reference
toolsEnable/disable specific capabilities

Available Tools

  • bash - Execute shell commands
  • edit - Edit existing files
  • write - Create new files
  • read - Read file contents
  • grep - Search file contents
  • glob - Find files by pattern
  • list - List directory contents
  • patch - Apply patches
  • todowrite - Write to todo list
  • todoread - Read todo list
  • webfetch - 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