OpenCode Interactive Slash Commands

All available slash commands in the OpenCode terminal user interface.

All available slash commands in the OpenCode terminal user interface.

CommandKeybindDescription
/connect—Add a provider to OpenCode; select from available providers and add API keys
/compactctrl+x cCompact the current session (alias: /summarize)
/details—Toggle tool execution details visibility
/editorctrl+x eOpen external editor for composing messages (uses $EDITOR)
/exitctrl+x qExit OpenCode (aliases: /quit, /q)
/exportctrl+x xExport current conversation to Markdown and open in editor
/help—Show the help dialog
/init—Guided setup for creating or updating AGENTS.md
/modelsctrl+x mList available models
/newctrl+x nStart a new session (alias: /clear)
/redoctrl+x rRedo a previously undone message (requires Git repo)
/sessionsctrl+x lList and switch between sessions (aliases: /resume, /continue)
/share—Share current session via link
/themesctrl+x tList available themes
/thinking—Toggle visibility of thinking/reasoning blocks
/undoctrl+x uUndo last message and revert file changes (requires Git repo)
/unshare—Unshare current session

Sources:

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

SyntaxDescription
$ARGUMENTSAll arguments passed after the command
$1, $2, …Individual positional arguments
!`<command>`Shell command output injected into prompt
@file/pathFile content injected into prompt