Skip to main content

Common Commands

TUI Slash Commands

CommandAliasDescription
/init-Initialize project with AGENTS.md
/connect-Add or update provider credentials
/models-List and select active models
/undo-Undo last AI-generated changes (uses git snapshots)
/redo-Redo previously undone changes
/share-Create a share link for the current conversation
/unshare-Remove share link and delete remote data
/compact/summarizeCompact session context window
/new/clearStart a fresh session
/sessions/resume, /continueList and switch between sessions
/help-Open the help dialog
/exit/quit, /qExit OpenCode
/editor-Open the current message in an external editor
/export-Export the conversation as Markdown
/details-Toggle display of tool execution details
/themes-List available TUI themes
/thinking-Toggle visibility of model thinking blocks

CLI Commands

CommandDescription
opencodeLaunch the interactive TUI
opencode run "prompt"Run a prompt non-interactively, output to stdout
opencode serveStart headless HTTP API server
opencode webStart server with web UI
opencode attach <url>Connect TUI to a running server
opencode run --attach <url> "prompt"Run prompt through server, captures full agent workflow
opencode connect <provider>Add provider credentials from CLI
opencode models [provider]List available models, optionally filter by provider
opencode agent listList defined agents
opencode auth listList configured providers and auth status
opencode plugin <module>Install or list plugins
opencode plug <module>Alias for opencode plugin
opencode statsShow usage statistics
opencode debugPrint system information for troubleshooting
opencode mcp debug <name>Run diagnostics on an MCP server
opencode --versionPrint version and exit
opencode --helpPrint help and exit
opencode --print-logsShow all log output on stdout
opencode --log-level <level>Set minimum log level (error, warn, info, debug, trace)

TUI Input Shortcuts

InputDescription
@Activate file reference fuzzy search
/Activate slash command selector
!Prefix a line with ! to run as a bash command
TabSwitch between primary agents (Build/Plan)
ctrl+pOpen command palette

CLI Examples

# Run a quick prompt
opencode run "Write a Python script to sort a list of dictionaries by a key"

# Run in a specific directory
opencode run "Initialize a new Node.js project" --cwd /path/to/project

# Attach to a remote server and run a task
opencode run --attach http://server:4096 "Review the latest commit" --cwd /workspace

# List models from a specific provider
opencode models anthropic

# Install a plugin globally
opencode plugin opencode-helicone-session -g

# Start server on a custom port
opencode serve --port 8080

# Debug an MCP server
opencode mcp debug filesystem