Skip to content
OpenCode logo

OpenCode cheat sheet

$ opencode SST / Anomaly Official docs

Every command, flag and slash command for opencode — Open-source terminal agent with a slick TUI, 75+ providers via Models.dev, and a headless HTTP server. 13+ commands, verified July 2026.

The GitHub org was renamed sstanomalycogithub.com/sst/opencode now redirects. Same project; only the brew tap and repo URL changed. This is *not* the unrelated opencode-ai/opencode fork.

Install
curl -fsSL https://opencode.ai/install | bash   # official installer
npm install -g opencode-ai                       # npm (also bun / pnpm / yarn)
brew install anomalyco/tap/opencode              # Homebrew tap (most current)
Start & run
opencode                     # launch the TUI in the current dir
opencode /path/to/project    # TUI in a specific directory
opencode run "<message>"     # headless: run one prompt, print the result
opencode auth login          # add a provider + API key
opencode models [provider]   # list available models
opencode serve               # headless HTTP API server (no TUI)

`run` flags

FlagWhat it does
-c, --continueContinue the last session
-s, --session <id>Continue a specific session id
-m, --model <p/m>Model in provider/model form
--agent <name>Agent to use
--format <default|json>json emits raw JSON events (scripting)
--autoAuto-approve any permission not explicitly denied

In-session (TUI · `ctrl+p` palette)

CommandWhat it does
/initCreate / update AGENTS.md for the project
/models · /sessionsBrowse models / past sessions
/new (/clear)Start a fresh session
/compact (/summarize)Compress the session to save context
/undo · /redoRevert / restore a message + its file changes
/share · /exportShare the session / save to Markdown
/editorCompose the message in your external $EDITOR
Config
// opencode.json (project)  ·  ~/.config/opencode/opencode.json (global)
{
  "$schema": "https://opencode.ai/config.json",
  "model": "anthropic/claude-sonnet-4-5"
}
// AGENTS.md = project rules (/init to generate)
// keys are added with `opencode auth login`, stored separately from config
Common one-liners
opencode run "explain what this repo does and its entry points"
opencode run -c "now add unit tests for the change you just made"
opencode run -m anthropic/claude-sonnet-4-5 "refactor src/auth.ts"
opencode run --format json "list every TODO comment with its file and line"

More CLI cheat sheets

Stop memorizing flags

Run OpenCode — and every other agent — from one app

TheVibeFather orchestrates OpenCode alongside every other coding CLI in one native macOS app. Bring the models you already pay for; keep your keys.