OpenCode Interactive Slash Commands
All available slash commands in the OpenCode terminal user interface.
All available slash commands in the OpenCode terminal user interface.
| Command | Keybind | Description |
|---|---|---|
/connect | — | Add a provider to OpenCode; select from available providers and add API keys |
/compact | ctrl+x c | Compact the current session (alias: /summarize) |
/details | — | Toggle tool execution details visibility |
/editor | ctrl+x e | Open external editor for composing messages (uses $EDITOR) |
/exit | ctrl+x q | Exit OpenCode (aliases: /quit, /q) |
/export | ctrl+x x | Export current conversation to Markdown and open in editor |
/help | — | Show the help dialog |
/init | — | Guided setup for creating or updating AGENTS.md |
/models | ctrl+x m | List available models |
/new | ctrl+x n | Start a new session (alias: /clear) |
/redo | ctrl+x r | Redo a previously undone message (requires Git repo) |
/sessions | ctrl+x l | List and switch between sessions (aliases: /resume, /continue) |
/share | — | Share current session via link |
/themes | ctrl+x t | List available themes |
/thinking | — | Toggle visibility of thinking/reasoning blocks |
/undo | ctrl+x u | Undo last message and revert file changes (requires Git repo) |
/unshare | — | Unshare current session |
Sources:
- Built-in commands: OpenCode TUI Documentation
- Custom commands: OpenCode Commands Documentation
Custom Commands
You can define your own slash commands by creating a .md file. The filename becomes the command name (e.g., test.md → /test).
- Project-local:
.opencode/commands/test.md(affects only this project) - Global:
~/.config/opencode/commands/test.md(affects all projects)
---
description: Run tests with coverage
agent: build
---
Run the full test suite with coverage report
and show any failures.
Placeholders
| Syntax | Description |
|---|---|
$ARGUMENTS | All arguments passed after the command |
$1, $2, … | Individual positional arguments |
!`<command>` | Shell command output injected into prompt |
@file/path | File content injected into prompt |