.opencode.json) to customize its behavior. This page documents the complete schema and all available configuration options.
Configuration file locations
OpenCode searches for configuration files in the following order:$HOME/.opencode.json- Global configuration$XDG_CONFIG_HOME/opencode/.opencode.json- XDG-compliant location./.opencode.json- Local directory (merged with global config)
Local configuration files are merged with global configuration. Local settings take precedence over global settings.
Root properties
object
Storage configuration for OpenCode’s database and files.
string
Working directory for the application. If not specified, uses the current directory.
boolean
default:"false"
Enable debug mode with verbose logging. When
true, log level is set to debug automatically.boolean
default:"false"
Enable Language Server Protocol debug mode for troubleshooting LSP integration issues.
boolean
default:"true"
Automatically summarize conversations when approaching the model’s context window limit. When enabled, OpenCode monitors token usage and creates a new session with a summary at 95% context usage.
array
List of file paths to automatically include in the AI context. These files are added to every conversation.Default paths:
.github/copilot-instructions.md.cursorrules.cursor/rules/CLAUDE.md,CLAUDE.local.mdopencode.md,opencode.local.mdOpenCode.md,OpenCode.local.mdOPENCODE.md,OPENCODE.local.md
Agents configuration
object
Configuration for different AI agents used by OpenCode. Each agent can use a different model and token limit.
Providers configuration
object
LLM provider configurations. Each provider can be enabled/disabled and configured with API keys.
MCP servers configuration
object
Model Control Protocol server configurations. Define custom MCP servers to extend OpenCode’s capabilities.Each key is the server name, and the value is a server configuration object.
LSP configuration
object
Language Server Protocol configurations. Define LSP servers for different programming languages.Each key is a language identifier, and the value is an LSP configuration object.
Shell configuration
object
Shell configuration for the bash tool.
TUI configuration
object
Terminal User Interface configuration.
Example configuration
JSON schema
The complete JSON schema is available in the OpenCode repository atopencode-schema.json. You can use it for validation and autocompletion in your editor: