OpenCode is an open source AI coding agent.
Copy the config examples from ./config into ~/.config/opencode/.
- Copy
config/opencode.jsonto~/.config/opencode/opencode.json - Copy
config/tui.jsonto~/.config/opencode/tui.json
opencode.json contains runtime, provider, and MCP settings.
tui.json contains TUI-only settings like theme and keybinds.
The runtime config example includes:
- Settings for using local models through llama.cpp and LM Studio
- Playwright MCP configuration for local server using
@playwright/mcp@latest
Relevant documentation:
If you want to use OpenCode with local models, start with the guide in ../llama-cpp.
For coding-agent use, OpenCode should connect to a running llama-server instance.
Coding tools usually need more prompt space than normal chat, so context size can matter more here than it does for casual terminal use.
Copy the commands folder to /Users/[your-username]/.config/opencode/commands/
Available commands:
| Command | Path | Description |
|---|---|---|
/git-commit |
commands/git-commit.md |
Stage and commit changes with safety checks and a generated message. |
/git-push |
commands/git-push.md |
Push the current branch with safety checks and optionally create a PR. |
You can define project-specific custom agents by adding an .opencode/agent/ folder inside your project.
This makes the custom mode available only for that project.
Copy the .opencode folder into your project to try it.
| Name | Scope | Path | Description |
|---|---|---|---|
FunMode |
Project-specific | .opencode/agent/funmode.md |
Example custom mode with a playful, high-personality response style. |
Once copied, init OpenCode and press Tab to switch modes, you should see a new FunMode available.