Cheat Sheet
OpenCode
Open-source AI coding agent, terminal-native
Installation
curl -fsSL https://opencode.ai/install | shInstall OpenCode (Linux/macOS)brew install opencodeInstall via Homebrew (macOS)opencodeLaunch the TUIopencode upgradeUpgrade to the latest versionopencode --versionShow installed versionTUI Keybindings
EnterSend message to agentCtrl+EnterInsert new line in inputEscapeCancel current operation / go backCtrl+CCopy selected text / quitCtrl+ZUndo last file changeCtrl+YRedo last undone change/Focus command input / searchTabCycle focus between panelsSession Commands
/mode planSwitch to Plan mode (read-only analysis)/mode buildSwitch to Build mode (write file changes)@filenameAttach a file to the prompt/undoRevert last AI file changes/sharePublish session as a shareable URL/clearClear conversation history/modelSwitch AI model mid-session/compressCompress conversation to save contextContext & Memory
AGENTS.mdProject instructions (cross-agent standard)opencode.jsonProject configuration file~/.config/opencode/config.jsonGlobal user configurationPlan modeAnalyze codebase without writing filesBuild modeApply AI-generated changes to codebase$rules in configDefine custom instruction rulesProvider Configuration
ANTHROPIC_API_KEY=...Set Claude (Anthropic) API keyOPENAI_API_KEY=...Set OpenAI API keyGOOGLE_API_KEY=...Set Google Gemini API keyprovider: "anthropic"Set default provider in configmodel: "claude-sonnet-4-6"Set default model in configOpenCode ZenManaged model subscription (no API keys)providers: [...]Multi-provider config in opencode.jsonMCP
mcp.servers in opencode.jsonConfigure MCP server listtype: "local"Subprocess (stdio) MCP transporttype: "remote"HTTP/SSE remote MCP transportmcp auth <server>OAuth flow for remote MCP serverargs: [...]MCP server command argumentsenv: {...}MCP server environment variablesopencode mcp listList all active MCP serverscode-agents.oday-bakkour.com · OpenCode · Last verified: April 2026