{"id":167358,"date":"2026-05-03T10:31:21","date_gmt":"2026-05-03T07:31:21","guid":{"rendered":"https:\/\/computingforgeeks.com\/opencode-cli-cheat-sheet\/"},"modified":"2026-05-03T11:18:16","modified_gmt":"2026-05-03T08:18:16","slug":"opencode-cli-cheat-sheet","status":"publish","type":"post","link":"https:\/\/computingforgeeks.com\/opencode-cli-cheat-sheet\/","title":{"rendered":"OpenCode CLI Cheat Sheet &#8211; Commands and Workflows"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">OpenCode is the open-source terminal AI coding agent from sst.dev, written in TypeScript and Go, runs on Bun, and speaks every major LLM provider. The surface area is large: 18 top-level CLI commands, dozens of subcommands, 60+ keyboard shortcuts in the TUI, a custom-commands system, a permissions engine, AGENTS.md project memory, MCP server management, ACP integration for IDEs, plan mode, multi-agent workflows, and 30+ environment variables. This cheat sheet condenses the entire surface into one page, with real outputs captured on Ubuntu 26.04 LTS using OpenCode 1.14.33 against Anthropic Claude.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you came from the <a href=\"https:\/\/computingforgeeks.com\/setup-opencode-ai-coding-agent\/\" target=\"_blank\" rel=\"noreferrer noopener\">OpenCode setup guide<\/a> or the <a href=\"https:\/\/computingforgeeks.com\/install-opencode-oh-my-openagent-linux\/\" target=\"_blank\" rel=\"noreferrer noopener\">Oh-My-OpenAgent install guide<\/a>, this is the working reference to keep open while you code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Verified working: May 2026 with OpenCode 1.14.33 on Ubuntu 26.04 LTS, tested with Anthropic Claude (24 models loaded), the OpenCode-hosted free tier, and an explicit MCP and custom-command setup.<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Quick install reminder<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo npm install -g opencode-ai\nopencode --version<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In the output is the version number of OpenCode installed.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>1.14.33<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If your CPU lacks AVX support (some default QEMU\/KVM guest types) the embedded Bun runtime crashes on launch. Switch the VM CPU type to <code>host<\/code> or pick a runtime that exposes AVX2. Verify inside the guest with <code>grep -m1 -oE 'avx[0-9a-z]*' \/proc\/cpuinfo<\/code>. Full prerequisites and provider login flows live in the <a href=\"https:\/\/computingforgeeks.com\/setup-opencode-ai-coding-agent\/\" target=\"_blank\" rel=\"noreferrer noopener\">OpenCode setup walkthrough<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Top-level command map<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Command<\/th><th>Purpose<\/th><\/tr><\/thead><tbody><tr><td><code>opencode [project]<\/code><\/td><td>Launch the TUI in the given directory (default).<\/td><\/tr><tr><td><code>opencode run [message..]<\/code><\/td><td>One-shot headless invocation.<\/td><\/tr><tr><td><code>opencode serve<\/code><\/td><td>Headless HTTP API server other clients can attach to.<\/td><\/tr><tr><td><code>opencode web<\/code><\/td><td>Headless server plus the OpenCode web UI.<\/td><\/tr><tr><td><code>opencode attach &lt;url&gt;<\/code><\/td><td>Attach a TUI to a running server.<\/td><\/tr><tr><td><code>opencode acp<\/code><\/td><td>Agent Client Protocol over stdin\/stdout (IDE bridge).<\/td><\/tr><tr><td><code>opencode auth<\/code> (alias <code>providers<\/code>)<\/td><td>Manage providers and credentials.<\/td><\/tr><tr><td><code>opencode models [provider]<\/code><\/td><td>List models, optionally filtered.<\/td><\/tr><tr><td><code>opencode mcp<\/code><\/td><td>Manage MCP servers (add, list, auth, debug, logout).<\/td><\/tr><tr><td><code>opencode agent<\/code><\/td><td>Manage agents (list, create).<\/td><\/tr><tr><td><code>opencode session<\/code><\/td><td>List or delete sessions.<\/td><\/tr><tr><td><code>opencode export [sessionID]<\/code><\/td><td>Export session data as JSON.<\/td><\/tr><tr><td><code>opencode import &lt;file&gt;<\/code><\/td><td>Import session from JSON or share URL.<\/td><\/tr><tr><td><code>opencode stats<\/code><\/td><td>Token usage and cost statistics.<\/td><\/tr><tr><td><code>opencode github<\/code><\/td><td>Install or run the GitHub agent.<\/td><\/tr><tr><td><code>opencode pr &lt;number&gt;<\/code><\/td><td>Fetch a GitHub PR branch and run OpenCode on it.<\/td><\/tr><tr><td><code>opencode plugin &lt;module&gt;<\/code> (alias <code>plug<\/code>)<\/td><td>Install a plugin npm module and update config.<\/td><\/tr><tr><td><code>opencode debug<\/code><\/td><td>Debugging utilities (config, paths, agent, LSP, ripgrep, snapshot, scrap).<\/td><\/tr><tr><td><code>opencode db<\/code><\/td><td>Database tools.<\/td><\/tr><tr><td><code>opencode upgrade [target]<\/code><\/td><td>Upgrade OpenCode (npm, pnpm, bun, brew, choco, scoop, curl).<\/td><\/tr><tr><td><code>opencode uninstall<\/code><\/td><td>Uninstall OpenCode and remove related files.<\/td><\/tr><tr><td><code>opencode completion<\/code><\/td><td>Print shell completion script.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Where OpenCode stores state<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><code>opencode debug paths<\/code> prints every directory OpenCode uses. Real output from a fresh Ubuntu 26.04 install:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ opencode debug paths\nhome    \/root\ndata    \/root\/.local\/share\/opencode\nbin     \/root\/.cache\/opencode\/bin\nlog     \/root\/.local\/share\/opencode\/log\ncache   \/root\/.cache\/opencode\nconfig  \/root\/.config\/opencode\nstate   \/root\/.local\/state\/opencode\ntmp     \/tmp\/opencode<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>config<\/strong>: <code>~\/.config\/opencode\/opencode.json<\/code> plus per-user agents, commands, themes.<\/li>\n\n\n\n<li><strong>data<\/strong>: SQLite stores for sessions, messages, projects, plus <code>auth.json<\/code> with provider credentials.<\/li>\n\n\n\n<li><strong>cache<\/strong>: downloaded model lists, LSP server binaries, ripgrep.<\/li>\n\n\n\n<li><strong>state<\/strong>: per-project run history, last session ID, snapshots.<\/li>\n\n\n\n<li><strong>log<\/strong>: rolling log files, useful when chasing a hang or auth bug.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Authentication: providers, login, logout<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code># Interactive login picker (chooses provider, then auth method)\nopencode auth login\n\n# Pre-select provider\nopencode auth login --provider anthropic\n\n# Pre-select provider AND method\nopencode auth login --provider openai --method api-key\n\n# OAuth-style URL flow (self-hosted auth provider)\nopencode auth login https:\/\/auth.example.internal\n\n# Inspect what is configured\nopencode auth list      # alias: opencode auth ls\n\n# Remove credentials\nopencode auth logout<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Keys via environment<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Standard provider env vars work without running <code>auth login<\/code> at all. Easiest path on a server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>export ANTHROPIC_API_KEY=\"sk-ant-api03-...\"\nexport OPENAI_API_KEY=\"sk-proj-...\"\nexport GEMINI_API_KEY=\"aiza...\"\nexport OPENROUTER_API_KEY=\"sk-or-...\"\nexport OPENCODE_SERVER_PASSWORD=\"...\"   # only for attach mode\nexport OPENCODE_SERVER_USERNAME=\"opencode\"  # default, override if needed<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Listing and choosing models<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code># Every model the configured providers expose\nopencode models\n\n# Filter to one provider\nopencode models anthropic\nopencode models openai\nopencode models google\n\n# Refresh the cached list from models.dev\nopencode models --refresh\n\n# Verbose mode prints metadata (context length, costs, capabilities)\nopencode models anthropic --verbose<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Real partial output after authenticating Anthropic:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ opencode models anthropic --refresh\nModels cache refreshed\nanthropic\/claude-3-5-haiku-20241022\nanthropic\/claude-3-5-haiku-latest\nanthropic\/claude-3-5-sonnet-20240620\nanthropic\/claude-3-5-sonnet-20241022\nanthropic\/claude-3-7-sonnet-20250219\nanthropic\/claude-haiku-4-5\nanthropic\/claude-haiku-4-5-20251001\nanthropic\/claude-opus-4-5\nanthropic\/claude-opus-4-5-20251101\nanthropic\/claude-opus-4-6\nanthropic\/claude-opus-4-6-fast\nanthropic\/claude-opus-4-7\n... (24 models total)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Pick a model per invocation with <code>-m provider\/model<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>opencode -m anthropic\/claude-sonnet-4-6\nopencode -m openai\/gpt-5\nopencode -m google\/gemini-2.5-pro\nopencode -m opencode\/big-pickle           # OpenCode hosted free tier<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Global flags reference<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Flag<\/th><th>Purpose<\/th><\/tr><\/thead><tbody><tr><td><code>-m, --model<\/code><\/td><td>Choose <code>provider\/model<\/code>.<\/td><\/tr><tr><td><code>--variant<\/code><\/td><td>Provider-specific reasoning effort (<code>high<\/code>, <code>max<\/code>, <code>minimal<\/code>).<\/td><\/tr><tr><td><code>--thinking<\/code><\/td><td>Show thinking blocks in the TUI.<\/td><\/tr><tr><td><code>-c, --continue<\/code><\/td><td>Continue the last session.<\/td><\/tr><tr><td><code>-s, --session<\/code><\/td><td>Continue a specific session by ID.<\/td><\/tr><tr><td><code>--fork<\/code><\/td><td>Fork a session when continuing (preserves the original).<\/td><\/tr><tr><td><code>--prompt<\/code><\/td><td>Seed the agent with a prompt at launch.<\/td><\/tr><tr><td><code>--agent<\/code><\/td><td>Launch as a named agent (<code>build<\/code>, <code>compaction<\/code>, <code>explore<\/code>, custom).<\/td><\/tr><tr><td><code>--share<\/code><\/td><td>Make the session shareable via URL.<\/td><\/tr><tr><td><code>-f, --file<\/code><\/td><td>Attach files to the initial prompt (repeatable).<\/td><\/tr><tr><td><code>--title<\/code><\/td><td>Title for the new session.<\/td><\/tr><tr><td><code>--attach URL<\/code><\/td><td>Attach to a remote OpenCode server.<\/td><\/tr><tr><td><code>-p, --password<\/code><\/td><td>Server basic-auth password.<\/td><\/tr><tr><td><code>--dir<\/code><\/td><td>Directory to run in (or path on the remote server).<\/td><\/tr><tr><td><code>--port<\/code><\/td><td>Port for the local server.<\/td><\/tr><tr><td><code>--hostname<\/code><\/td><td>Hostname to bind on (default <code>127.0.0.1<\/code>).<\/td><\/tr><tr><td><code>--mdns<\/code><\/td><td>Enable mDNS service discovery (sets hostname to 0.0.0.0).<\/td><\/tr><tr><td><code>--mdns-domain<\/code><\/td><td>Custom mDNS domain (default <code>opencode.local<\/code>).<\/td><\/tr><tr><td><code>--cors<\/code><\/td><td>Additional CORS-allowed domains.<\/td><\/tr><tr><td><code>--format<\/code><\/td><td><code>default<\/code> (formatted) or <code>json<\/code> (raw nd-JSON events).<\/td><\/tr><tr><td><code>--dangerously-skip-permissions<\/code><\/td><td>Auto-approve every permission. Disposable VMs only.<\/td><\/tr><tr><td><code>--pure<\/code><\/td><td>Run without external plugins (debugging).<\/td><\/tr><tr><td><code>--print-logs<\/code><\/td><td>Echo logs to stderr.<\/td><\/tr><tr><td><code>--log-level<\/code><\/td><td><code>DEBUG<\/code>, <code>INFO<\/code>, <code>WARN<\/code>, <code>ERROR<\/code>.<\/td><\/tr><tr><td><code>-v, --version<\/code><\/td><td>Print version.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Headless run and JSON events<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><code>opencode run<\/code> drives the agent without the TUI. The building block for CI integration, cron jobs, and shell pipelines.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># One-shot\nopencode run \"review the latest commit for security issues\" --dir \/repo\n\n# Pick a model + variant\nopencode run --model anthropic\/claude-sonnet-4-6 --variant max \"refactor src\/auth\"\n\n# Continue the previous session\nopencode run \"now write tests for the function you added\" --continue\n\n# Resume a specific session by ID\nopencode run \"explain the diff in src\/api.ts\" --session ses_2132323b6ffeuRlYHhPcU8DaZ6\n\n# Attach to a long-running server\nopencode run \"deploy to staging\" --attach http:\/\/server:4096 -p $OPENCODE_SERVER_PASSWORD\n\n# Fully unattended (only on disposable VMs)\nopencode run \"rebase onto main and resolve trivial conflicts\" \\\n  --dangerously-skip-permissions \\\n  --dir \/repo<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Real session capture (Anthropic Claude Haiku 4.5)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">JSON event format for a real one-shot run, captured exactly as the CLI emitted it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ opencode run --model anthropic\/claude-haiku-4-5 \\\n    'What does this fibonacci function do? Reply in one sentence.' \\\n    --dir \/root\/oc-demo --format json\n\n{\"type\":\"step_start\",\"sessionID\":\"ses_2132323b6ffeuRlYHhPcU8DaZ6\",\n \"part\":{\"id\":\"prt_decdce2a7001ReAIzGIccjb17u\",\"type\":\"step-start\"}}\n{\"type\":\"text\",\"sessionID\":\"ses_2132323b6ffeuRlYHhPcU8DaZ6\",\n \"part\":{\"type\":\"text\",\n \"text\":\"The Fibonacci function generates a sequence of numbers where each\n         number is the sum of the two preceding ones (typically starting with\n         0 and 1).\"}}\n{\"type\":\"step_finish\",\"sessionID\":\"ses_2132323b6ffeuRlYHhPcU8DaZ6\",\n \"part\":{\"reason\":\"stop\",\"tokens\":{\"total\":11168,\"input\":2,\"output\":34,\n                                   \"cache\":{\"write\":11132,\"read\":0}},\n         \"cost\":0.014087}}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Three event types in a clean run: <code>step_start<\/code>, one or more <code>text<\/code> chunks, then <code>step_finish<\/code> carrying token counts and cost. Tool calls insert <code>tool_use<\/code> and <code>tool_result<\/code> events between text chunks. Pipe the stream into <code>jq<\/code> to filter:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Print only the assistant's text replies\nopencode run \"summarise this repo\" --format json | jq -r 'select(.type==\"text\") | .part.text'\n\n# Print final cost and token count\nopencode run \"fix the failing test\" --format json | jq 'select(.type==\"step_finish\") | .part'<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Server, web, and attach modes<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The TUI runs on top of a local HTTP server. Detach the server, talk to it from another box, or open the same session in a browser.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Headless server on a fixed port + LAN-bind\nopencode serve --port 4096 --hostname 0.0.0.0\n\n# Browser UI on top of a local server\nopencode web --port 4096\n\n# Attach a TUI from another machine\nopencode attach http:\/\/10.0.1.10:4096 --password \"$PW\"\n\n# mDNS auto-discovery on a homelab\nopencode serve --mdns --mdns-domain ai.lab.local\nopencode attach http:\/\/laptop.ai.lab.local:4096<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Pair this with <code>tmux<\/code> or <code>systemd<\/code> to keep an OpenCode server running on your homelab and attach from any laptop on the LAN. Set <code>OPENCODE_SERVER_PASSWORD<\/code> in the systemd unit to require basic auth on every connection.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Agent Client Protocol (ACP)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">ACP is OpenCode&#8217;s bridge to external clients (Zed, Cursor, custom IDEs). The protocol is line-delimited JSON over stdin\/stdout. Run the ACP server and point your editor at it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Plain ACP over stdio\nopencode acp\n\n# ACP with explicit cwd and an HTTP fallback\nopencode acp --cwd \/repo --port 4096 --hostname 127.0.0.1<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">TUI keyboard shortcuts<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The TUI uses a <strong>leader-key<\/strong> pattern (default <code>Ctrl+x<\/code>) plus direct shortcuts. Memorise the leader and the shortcuts that follow. The cheat sheet below is what you should print and pin next to your monitor.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Application control<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Action<\/th><th>Shortcut<\/th><\/tr><\/thead><tbody><tr><td>Quit<\/td><td><code>Ctrl+C<\/code>, <code>Ctrl+D<\/code>, or <code>&lt;leader&gt;q<\/code><\/td><\/tr><tr><td>Command palette<\/td><td><code>Ctrl+P<\/code><\/td><\/tr><tr><td>Toggle theme<\/td><td><code>&lt;leader&gt;t<\/code><\/td><\/tr><tr><td>Toggle sidebar<\/td><td><code>&lt;leader&gt;b<\/code><\/td><\/tr><tr><td>Show status<\/td><td><code>&lt;leader&gt;s<\/code><\/td><\/tr><tr><td>Toggle tips<\/td><td><code>&lt;leader&gt;h<\/code><\/td><\/tr><tr><td>External editor<\/td><td><code>&lt;leader&gt;e<\/code><\/td><\/tr><tr><td>Suspend to background<\/td><td><code>Ctrl+Z<\/code><\/td><\/tr><tr><td>Interrupt running tool call<\/td><td><code>Escape<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Sessions<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Action<\/th><th>Shortcut<\/th><\/tr><\/thead><tbody><tr><td>New session<\/td><td><code>&lt;leader&gt;n<\/code><\/td><\/tr><tr><td>List sessions<\/td><td><code>&lt;leader&gt;l<\/code><\/td><\/tr><tr><td>Session history<\/td><td><code>&lt;leader&gt;g<\/code><\/td><\/tr><tr><td>Export session<\/td><td><code>&lt;leader&gt;x<\/code><\/td><\/tr><tr><td>Compact context<\/td><td><code>&lt;leader&gt;c<\/code><\/td><\/tr><tr><td>Next child session<\/td><td><code>&lt;leader&gt;Right<\/code><\/td><\/tr><tr><td>Previous child session<\/td><td><code>&lt;leader&gt;Left<\/code><\/td><\/tr><tr><td>Parent session<\/td><td><code>&lt;leader&gt;Up<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Message navigation<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Action<\/th><th>Shortcut<\/th><\/tr><\/thead><tbody><tr><td>Scroll to top<\/td><td><code>Ctrl+G<\/code> or <code>Home<\/code><\/td><\/tr><tr><td>Scroll to bottom<\/td><td><code>Ctrl+Alt+G<\/code> or <code>End<\/code><\/td><\/tr><tr><td>Page up \/ down<\/td><td><code>PageUp<\/code> \/ <code>PageDown<\/code><\/td><\/tr><tr><td>Half-page up \/ down<\/td><td><code>Ctrl+Alt+U<\/code> \/ <code>Ctrl+Alt+D<\/code><\/td><\/tr><tr><td>Copy last message<\/td><td><code>&lt;leader&gt;y<\/code><\/td><\/tr><tr><td>Undo last action<\/td><td><code>&lt;leader&gt;u<\/code><\/td><\/tr><tr><td>Redo<\/td><td><code>&lt;leader&gt;r<\/code><\/td><\/tr><tr><td>Toggle code block visibility<\/td><td><code>&lt;leader&gt;h<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Models, agents, and modes<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Action<\/th><th>Shortcut<\/th><\/tr><\/thead><tbody><tr><td>Open model picker<\/td><td><code>&lt;leader&gt;m<\/code><\/td><\/tr><tr><td>Cycle to next recent model<\/td><td><code>F2<\/code><\/td><\/tr><tr><td>Cycle to previous recent model<\/td><td><code>Shift+F2<\/code><\/td><\/tr><tr><td>Open agent picker<\/td><td><code>&lt;leader&gt;a<\/code><\/td><\/tr><tr><td>Tab through agent options<\/td><td><code>Tab<\/code> \/ <code>Shift+Tab<\/code><\/td><\/tr><tr><td>Toggle plan mode<\/td><td><code>Tab<\/code> in the input<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Input field<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Action<\/th><th>Shortcut<\/th><\/tr><\/thead><tbody><tr><td>Submit<\/td><td><code>Enter<\/code><\/td><\/tr><tr><td>New line in input<\/td><td><code>Shift+Enter<\/code>, <code>Ctrl+Enter<\/code>, or <code>Alt+Enter<\/code><\/td><\/tr><tr><td>Move cursor by char<\/td><td><code>Ctrl+B<\/code> \/ <code>Ctrl+F<\/code> (or arrows)<\/td><\/tr><tr><td>Jump to start \/ end of line<\/td><td><code>Ctrl+A<\/code> \/ <code>Ctrl+E<\/code><\/td><\/tr><tr><td>Extend selection<\/td><td><code>Shift+Arrows<\/code>, <code>Ctrl+Shift+A<\/code>, <code>Ctrl+Shift+E<\/code><\/td><\/tr><tr><td>Clear input<\/td><td><code>Ctrl+C<\/code><\/td><\/tr><tr><td>Paste<\/td><td><code>Ctrl+V<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Customising keybinds<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"$schema\": \"https:\/\/opencode.ai\/config.json\",\n  \"keybinds\": {\n    \"leader\": \"ctrl+x\",\n    \"messages_last\": \"ctrl+alt+g,end\",\n    \"messages_first\": \"ctrl+g,home\",\n    \"session_new\": \"&lt;leader&gt;n\",\n    \"model_cycle_recent\": \"f2\",\n    \"agent_picker\": \"&lt;leader&gt;a\"\n  }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Separate alternative bindings with commas. Use <code>&lt;leader&gt;<\/code> to chain. Modifiers: <code>ctrl<\/code>, <code>alt<\/code>, <code>shift<\/code>, <code>meta<\/code>. Set a key to <code>\"none\"<\/code> to disable a default binding.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Slash commands inside the TUI<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Built-in slash commands handle session lifecycle, sharing, and meta-tasks. Custom commands extend the set with project-specific prompts.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Slash command<\/th><th>What it does<\/th><\/tr><\/thead><tbody><tr><td><code>\/init<\/code><\/td><td>Generate <code>AGENTS.md<\/code> by analysing the current repo. Run once per project.<\/td><\/tr><tr><td><code>\/help<\/code><\/td><td>Show available commands and a quick keybind reference.<\/td><\/tr><tr><td><code>\/share<\/code><\/td><td>Generate a public URL for the current session transcript.<\/td><\/tr><tr><td><code>\/undo<\/code><\/td><td>Revert the agent&#8217;s last action (file edits, commits).<\/td><\/tr><tr><td><code>\/redo<\/code><\/td><td>Re-apply the last undone action.<\/td><\/tr><tr><td><code>\/connect<\/code><\/td><td>Re-authenticate or switch the active provider.<\/td><\/tr><tr><td><code>\/&lt;custom&gt;<\/code><\/td><td>Any user-defined command from <code>.opencode\/commands\/<\/code> or <code>~\/.config\/opencode\/commands\/<\/code>.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">@ file fuzzy search and image attach<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Inside the input, type <code>@<\/code> to open a fuzzy file picker. Useful patterns:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@src\/auth.ts review this for SQL injection\n@src\/auth.ts @tests\/auth_test.ts find shared validation logic\n@docs\/api-spec.md follow this spec when refactoring src\/api\/*<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Drag-and-drop also works for images: drop a screenshot onto the TUI window and the next message attaches it for vision-capable models.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Custom commands<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Custom commands are markdown files dropped under <code>.opencode\/commands\/<\/code> (project) or <code>~\/.config\/opencode\/commands\/<\/code> (user). Each command becomes a slash command in the TUI.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Anatomy<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># .opencode\/commands\/test.md\n---\ndescription: Run the test suite and fix failures\nagent: build\nmodel: anthropic\/claude-sonnet-4-6\nsubtask: false\n---\n\nRun the project test suite, identify any failures, and fix them.\n\nTest command output:\n!`npm test`\n\nRecent test files:\n@tests\/\n\nFocus on: $ARGUMENTS<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Frontmatter keys<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Key<\/th><th>Required<\/th><th>Purpose<\/th><\/tr><\/thead><tbody><tr><td><code>description<\/code><\/td><td>recommended<\/td><td>One-line description shown in the slash autocomplete.<\/td><\/tr><tr><td><code>agent<\/code><\/td><td>optional<\/td><td>Force the command to run as a specific agent (default: current).<\/td><\/tr><tr><td><code>model<\/code><\/td><td>optional<\/td><td>Override the model for this command only.<\/td><\/tr><tr><td><code>subtask<\/code><\/td><td>optional (boolean)<\/td><td>Run inside a subagent so the main session keeps a clean context.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Prompt placeholders<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>$ARGUMENTS<\/code>: everything the user typed after the command name.<\/li>\n\n\n\n<li><code>$1<\/code>, <code>$2<\/code>, <code>$3<\/code>: positional arguments.<\/li>\n\n\n\n<li><code>!`shell command`<\/code>: inject the command&#8217;s stdout directly into the prompt.<\/li>\n\n\n\n<li><code>@path\/to\/file<\/code> or <code>@dir\/<\/code>: include file or directory contents.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Invocation example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># In the TUI input\n\/test src\/auth\/\n\n# Translates to:\n# Run the project test suite, identify any failures, and fix them.\n# Test command output: &lt;output of `npm test`&gt;\n# Recent test files: &lt;contents of tests\/ dir&gt;\n# Focus on: src\/auth\/<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Modes vs Agents vs Skills<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Three concepts shape OpenCode&#8217;s behaviour. They look similar but answer different questions.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Concept<\/th><th>What it is<\/th><th>Where to define<\/th><\/tr><\/thead><tbody><tr><td><strong>Mode<\/strong><\/td><td>A behavioural shape (build, plan, edit-only, read-only) that adjusts permissions and prompts.<\/td><td><code>opencode.json<\/code> under <code>\"mode\"<\/code> key.<\/td><\/tr><tr><td><strong>Agent<\/strong><\/td><td>A named role with its own prompt, model, tools, permissions. Can be a primary agent (user-facing) or a subagent (called via <code>task<\/code>).<\/td><td><code>~\/.config\/opencode\/agents\/&lt;name&gt;.md<\/code> or <code>.opencode\/agents\/&lt;name&gt;.md<\/code>.<\/td><\/tr><tr><td><strong>Skill<\/strong><\/td><td>A reusable capability bundle. Lighter than an agent, often invocable from any agent. Includes prompts and tool restrictions.<\/td><td><code>.opencode\/skills\/&lt;name&gt;.md<\/code> or installed via plugins.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Built-in agents<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Three agents ship by default:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>build<\/strong> (primary): the default agent. Full tool access subject to the permissions engine. Description: &#8220;executes tools based on configured permissions&#8221;.<\/li>\n\n\n\n<li><strong>compaction<\/strong> (primary): summarises and compacts long sessions to free up context.<\/li>\n\n\n\n<li><strong>explore<\/strong> (subagent): read-only investigator. Used when you want to look at code without risking edits.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Creating a custom agent<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>opencode agent create \\\n  --description \"review terraform plans for safety\" \\\n  --mode primary \\\n  --permissions \"bash,read,grep,glob,webfetch,task\" \\\n  --model anthropic\/claude-sonnet-4-6 \\\n  --path .opencode\/agents\/tf-reviewer.md<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Available permission strings: <code>bash, read, edit, glob, grep, webfetch, task, todowrite, websearch, lsp, skill<\/code>. Modes: <code>all<\/code>, <code>primary<\/code>, <code>subagent<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Multi-agent workflows<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">OpenCode&#8217;s <code>task<\/code> permission lets one agent dispatch another. A common production pattern uses a strict pipeline of read-only reviewers and a sandboxed implementor:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>@check<\/strong>: design reviewer, read-only, identifies risks across 8 axes (assumptions, failure modes, edge cases, compatibility, security, ops, scale, testability).<\/li>\n\n\n\n<li><strong>@simplify<\/strong>: complexity reviewer, read-only, flags overengineering and YAGNI violations.<\/li>\n\n\n\n<li><strong>@test<\/strong>: TDD test author, can write test files only, verifies RED before handoff.<\/li>\n\n\n\n<li><strong>@make<\/strong>: implementor, sandboxed bash, file list constrained, RED \u2192 GREEN with regression check.<\/li>\n\n\n\n<li><strong>@pm<\/strong>: project manager bridge, runs only <code>linear<\/code> CLI commands.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Wired together with a <code>\/workflow<\/code> custom command, this pattern takes a Linear issue ID, plans, tests, implements, and opens a draft PR autonomously. Read-only reviewers prevent accidental modifications, fresh per-task context prevents pollution.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Plan mode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Plan mode is a read-only review state. The agent reads, reasons, and proposes a plan but cannot write or execute. Toggle it from the input field with <code>Tab<\/code>, or pin a session in plan mode by launching with <code>--agent explore<\/code> or via the <code>OPENCODE_EXPERIMENTAL_PLAN_MODE<\/code> env var.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use plan mode for: code reviews, architecture audits, &#8220;what would happen if I did X&#8221; exploration, security walk-throughs, dependency upgrade impact analysis. Once the plan is solid, drop out with <code>Tab<\/code> again and the agent applies it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Permissions system<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">OpenCode runs every tool call through a permissions engine before execution. Rules live in <code>opencode.json<\/code> under <code>\"permission\"<\/code> and per-agent under each agent&#8217;s frontmatter. The engine evaluates rules top to bottom, first match wins.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Default permission set (build agent)<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>$ opencode debug agent build | head -20\n{\n  \"name\": \"build\",\n  \"description\": \"The default agent. Executes tools based on configured permissions.\",\n  \"permission\": &#91;\n    { \"permission\": \"*\",                  \"action\": \"allow\", \"pattern\": \"*\" },\n    { \"permission\": \"doom_loop\",          \"action\": \"ask\",   \"pattern\": \"*\" },\n    { \"permission\": \"external_directory\", \"action\": \"ask\",   \"pattern\": \"*\" },\n    { \"permission\": \"external_directory\", \"action\": \"allow\",\n      \"pattern\": \"\/root\/.local\/share\/opencode\/tool-output\/*\" },\n    { \"permission\": \"external_directory\", \"action\": \"allow\", \"pattern\": \"\/tmp\/opencode\/*\" },\n    ...\n  ]\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Three actions<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>allow<\/code>: silent yes.<\/li>\n\n\n\n<li><code>ask<\/code>: prompt the user, default for sensitive operations.<\/li>\n\n\n\n<li><code>deny<\/code>: block silently, agent receives an error.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Common permission categories<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>bash &lt;pattern&gt;<\/code>: shell commands.<\/li>\n\n\n\n<li><code>read &lt;glob&gt;<\/code>: file reads.<\/li>\n\n\n\n<li><code>edit &lt;glob&gt;<\/code>: file writes.<\/li>\n\n\n\n<li><code>external_directory &lt;path&gt;<\/code>: writes outside project root.<\/li>\n\n\n\n<li><code>doom_loop<\/code>: long-running loop heuristic guard.<\/li>\n\n\n\n<li><code>plan_enter<\/code> \/ <code>plan_exit<\/code>: control plan-mode transitions.<\/li>\n\n\n\n<li><code>question<\/code>: asking the user clarifying questions.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Production guardrail example<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"permission\": &#91;\n    { \"permission\": \"bash\", \"pattern\": \"rm -rf *\",          \"action\": \"deny\"  },\n    { \"permission\": \"bash\", \"pattern\": \"git push --force *\",\"action\": \"deny\"  },\n    { \"permission\": \"bash\", \"pattern\": \"sudo *\",            \"action\": \"deny\"  },\n    { \"permission\": \"bash\", \"pattern\": \"git push *\",        \"action\": \"ask\"   },\n    { \"permission\": \"bash\", \"pattern\": \"linear *\",          \"action\": \"deny\"  },\n    { \"permission\": \"read\", \"pattern\": \"*.env\",             \"action\": \"ask\"   },\n    { \"permission\": \"read\", \"pattern\": \"*.env.example\",     \"action\": \"allow\" },\n    { \"permission\": \"read\", \"pattern\": \"*.env.*\",           \"action\": \"ask\"   },\n    { \"permission\": \"*\",    \"pattern\": \"*\",                 \"action\": \"allow\" }\n  ]\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then a single agent (the project manager) overrides <code>linear *<\/code> back to <code>allow<\/code> in its own frontmatter. Other agents stay locked out of Linear, only the PM agent can touch issues.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">AGENTS.md project memory<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">OpenCode auto-loads <code>AGENTS.md<\/code> at the project root every session, the same way Claude Code reads <a href=\"https:\/\/computingforgeeks.com\/claude-code-dot-claude-directory-guide\/\" target=\"_blank\" rel=\"noreferrer noopener\">CLAUDE.md from the .claude directory<\/a>. Generate a starter via <code>\/init<\/code> in the TUI:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># In the TUI\n\/init<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">OpenCode reads the repo, classifies it (Node\/Python\/Go\/Rust\/multi), and writes an <code>AGENTS.md<\/code> with: build commands, test commands, lint commands, project conventions, and a brief architecture summary. Edit the file by hand to encode any rule the agent should respect.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Compatibility with .claude and GEMINI.md<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">OpenCode also reads <code>~\/.claude\/CLAUDE.md<\/code>, project-level <code>.claude\/skills<\/code>, and <code>GEMINI.md<\/code> if present. Disable each individually:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>OPENCODE_DISABLE_CLAUDE_CODE=1            # ignore .claude entirely\nOPENCODE_DISABLE_CLAUDE_CODE_PROMPT=1     # ignore ~\/.claude\/CLAUDE.md\nOPENCODE_DISABLE_CLAUDE_CODE_SKILLS=1     # ignore .claude\/skills<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Managing MCP servers<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>$ opencode mcp --help\nCommands:\n  opencode mcp add            add an MCP server\n  opencode mcp list           list MCP servers and their status (alias: ls)\n  opencode mcp auth &#91;name]    authenticate with an OAuth-enabled MCP server\n  opencode mcp auth list      list configured OAuth MCP servers\n  opencode mcp logout &#91;name]  remove OAuth credentials for an MCP server\n  opencode mcp debug &lt;name&gt;   debug OAuth connection for an MCP server<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Common MCP servers<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Filesystem (scoped path)\nopencode mcp add filesystem npx -y @modelcontextprotocol\/server-filesystem \/home\/user\/projects\n\n# GitHub\nGITHUB_TOKEN=ghp_... opencode mcp add github npx -y @modelcontextprotocol\/server-github\n\n# Postgres\nopencode mcp add postgres npx -y @modelcontextprotocol\/server-postgres \"postgresql:\/\/user:pass@host:5432\/db\"\n\n# Context7 for live library docs\nopencode mcp add context7 npx -y @upstash\/context7-mcp@latest\n\n# Sentry, Slack, Playwright, fal.ai, exa-search all follow the same pattern<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">MCP in opencode.json<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"mcp\": {\n    \"github\": {\n      \"type\": \"local\",\n      \"command\": &#91;\"npx\", \"-y\", \"@modelcontextprotocol\/server-github\"],\n      \"environment\": { \"GITHUB_TOKEN\": \"{env:GITHUB_TOKEN}\" }\n    },\n    \"postgres\": {\n      \"type\": \"local\",\n      \"command\": &#91;\"npx\", \"-y\", \"@modelcontextprotocol\/server-postgres\",\n                  \"postgresql:\/\/{env:PG_USER}:{env:PG_PASS}@db.lab.local\/app\"]\n    },\n    \"remote-mcp\": {\n      \"type\": \"remote\",\n      \"url\": \"https:\/\/mcp.example.com\",\n      \"headers\": { \"Authorization\": \"Bearer {env:MCP_TOKEN}\" }\n    }\n  }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Use <code>{env:VAR_NAME}<\/code> for secret expansion at runtime. <code>type: local<\/code> spawns a stdio process; <code>type: remote<\/code> connects via Streamable HTTP.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Sessions: list, delete, fork, share<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>$ opencode session list --help\nopencode session list\nlist sessions\nOptions:\n  -n, --max-count   limit to N most recent sessions\n      --format      output format             &#91;choices: \"table\", \"json\"] &#91;default: \"table\"]<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code># Recent sessions in a table\nopencode session list -n 10\n\n# JSON for scripting\nopencode session list --max-count 50 --format json | jq '.&#91;].id'\n\n# Delete by ID\nopencode session delete ses_2132323b6ffeuRlYHhPcU8DaZ6\n\n# Continue most recent\nopencode -c\n\n# Continue specific session\nopencode -s ses_2132323b6ffeuRlYHhPcU8DaZ6\n\n# Fork before continuing (preserves the original)\nopencode -c --fork\n\n# Generate a shareable URL\nopencode --share -m anthropic\/claude-sonnet-4-6 --prompt \"explain auth flow\"<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Export and import<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Full export with raw transcript\nopencode export ses_2132323b6ffeuRlYHhPcU8DaZ6 &gt; session.json\n\n# Sanitised export (redacts secrets, file paths, prompts)\nopencode export ses_2132323b6ffeuRlYHhPcU8DaZ6 --sanitize &gt; session-redacted.json\n\n# Re-import on another machine\nopencode import session.json\nopencode import https:\/\/opncd.ai\/s\/abc123<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Real session JSON shape<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"id\": \"ses_2132323b6ffeuRlYHhPcU8DaZ6\",\n  \"title\": \"What does this fibonacci function do\",\n  \"model\": \"anthropic\/claude-haiku-4-5\",\n  \"agent\": \"build\",\n  \"time\": { \"created\": 1777795391000, \"updated\": 1777795392442 },\n  \"stats\": { \"deletions\": 0, \"additions\": 0, \"files\": 0 },\n  \"permission\": &#91;\n    { \"permission\": \"question\", \"pattern\": \"*\", \"action\": \"deny\" },\n    { \"permission\": \"plan_enter\", \"pattern\": \"*\", \"action\": \"deny\" },\n    ...\n  ],\n  \"messages\": &#91; \/* transcript *\/ ]\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Stats and cost tracking<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>$ opencode stats --days 7\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502                       OVERVIEW                         \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502Sessions                                              1 \u2502\n\u2502Messages                                              2 \u2502\n\u2502Days                                                  7 \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502                    COST &amp; TOKENS                       \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502Total Cost                                        $0.01 \u2502\n\u2502Avg Cost\/Day                                      $0.00 \u2502\n\u2502Avg Tokens\/Session                                11.2K \u2502\n\u2502Median Tokens\/Session                             11.2K \u2502\n\u2502Input                                                 2 \u2502\n\u2502Output                                               34 \u2502\n\u2502Cache Read                                            0 \u2502\n\u2502Cache Write                                       11.1K \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Useful flags:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>--days N<\/code>: rolling window. Default is all-time.<\/li>\n\n\n\n<li><code>--tools N<\/code>: top N tools by call count. Default is all.<\/li>\n\n\n\n<li><code>--models<\/code>: per-model breakdown. Pass a number to limit to top N.<\/li>\n\n\n\n<li><code>--project SLUG<\/code>: filter to one project. Empty string filters to current project.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">GitHub agent and PR workflows<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code># Install the GitHub agent (writes a .github\/workflows\/opencode.yml)\nopencode github install\n\n# Run it locally for testing\nopencode github run\n\n# Test with a mocked event payload\nopencode github run --event issue_comment --token $GH_PAT\n\n# Pull a PR and immediately open OpenCode on it\nopencode pr 1234<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The GitHub agent reacts to <code>\/opencode<\/code> mentions in PR comments. Run <code>opencode github run --event<\/code> with a mocked payload during workflow development to verify behaviour without pushing branches.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Plugins<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code># Install per-project\nopencode plugin some-opencode-plugin\n\n# Install globally\nopencode plugin some-opencode-plugin --global\n\n# Replace an existing version\nopencode plugin some-opencode-plugin --force<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>opencode --pure<\/code> disables every plugin for one invocation. Useful for narrowing down a misbehaving session to OpenCode itself.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Debugging utilities<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Subcommand<\/th><th>Purpose<\/th><\/tr><\/thead><tbody><tr><td><code>opencode debug paths<\/code><\/td><td>Print all data, config, cache, state directories.<\/td><\/tr><tr><td><code>opencode debug config<\/code><\/td><td>Print the resolved config (after merging user + project).<\/td><\/tr><tr><td><code>opencode debug startup<\/code><\/td><td>Print startup timing in ms.<\/td><\/tr><tr><td><code>opencode debug skill<\/code><\/td><td>List discovered skills.<\/td><\/tr><tr><td><code>opencode debug agent &lt;name&gt;<\/code><\/td><td>Show a named agent&#8217;s full configuration.<\/td><\/tr><tr><td><code>opencode debug lsp<\/code><\/td><td>Inspect Language Server Protocol bridges.<\/td><\/tr><tr><td><code>opencode debug rg<\/code><\/td><td>Verify the bundled ripgrep binary works.<\/td><\/tr><tr><td><code>opencode debug file<\/code><\/td><td>File-system bridge sanity check.<\/td><\/tr><tr><td><code>opencode debug snapshot<\/code><\/td><td>Inspect or replay session snapshots.<\/td><\/tr><tr><td><code>opencode debug scrap<\/code><\/td><td>List every project OpenCode has run in.<\/td><\/tr><tr><td><code>opencode debug wait<\/code><\/td><td>Wait indefinitely. Used for protocol probing.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Real outputs from a fresh box:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ opencode debug startup\n989.441416     # ms\n\n$ opencode debug skill\n&#91;]             # no skills installed yet\n\n$ opencode debug config\n{\n  \"agent\": {},\n  \"mode\": {},\n  \"plugin\": &#91;],\n  \"command\": {},\n  \"username\": \"root\"\n}\n\n$ opencode debug scrap\n&#91; { \"id\": \"global\", \"worktree\": \"\/\", \"time\": {...}, \"sandboxes\": &#91;] }, ... ]<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">opencode.json full reference<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">OpenCode reads two config files in this priority order:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><code>.\/.opencode.json<\/code> at the project root.<\/li>\n\n\n\n<li><code>~\/.config\/opencode\/opencode.json<\/code> for user-level defaults.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Annotated reference covering every important key:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"$schema\": \"https:\/\/opencode.ai\/config.json\",\n\n  \"model\": \"anthropic\/claude-sonnet-4-6\",\n  \"small_model\": \"anthropic\/claude-haiku-4-5\",\n\n  \"share\": \"manual\",\n  \"autoshare\": false,\n  \"theme\": \"system\",\n  \"username\": \"yourname\",\n\n  \"keybinds\": {\n    \"leader\": \"ctrl+x\",\n    \"session_new\": \"&lt;leader&gt;n\",\n    \"model_cycle_recent\": \"f2\"\n  },\n\n  \"experimental\": { \"hooks\": true, \"plan_mode\": true },\n\n  \"plugin\": &#91;\n    \"@opencode-ai\/plugin-prettier\",\n    \".\/plugins\/local-plugin.js\"\n  ],\n\n  \"agent\": {\n    \"tf-reviewer\": {\n      \"description\": \"Read-only Terraform plan reviewer\",\n      \"mode\": \"primary\",\n      \"model\": \"anthropic\/claude-sonnet-4-6\",\n      \"tools\": { \"edit\": false, \"bash\": false, \"read\": true, \"grep\": true }\n    }\n  },\n\n  \"mode\": {\n    \"review\": {\n      \"tools\": { \"edit\": false, \"bash\": false }\n    }\n  },\n\n  \"command\": {\n    \"test\": { \"template\": \"Run tests and fix failures: $ARGUMENTS\" }\n  },\n\n  \"mcp\": {\n    \"context7\": {\n      \"type\": \"local\",\n      \"command\": &#91;\"npx\", \"-y\", \"@upstash\/context7-mcp@latest\"]\n    }\n  },\n\n  \"permission\": &#91;\n    { \"permission\": \"bash\", \"pattern\": \"rm -rf *\",  \"action\": \"deny\" },\n    { \"permission\": \"bash\", \"pattern\": \"git push *\",\"action\": \"ask\"  },\n    { \"permission\": \"*\",    \"pattern\": \"*\",         \"action\": \"allow\"}\n  ],\n\n  \"lsp\": {\n    \"typescript\": { \"command\": &#91;\"typescript-language-server\", \"--stdio\"] }\n  },\n\n  \"formatter\": {\n    \"*.py\": \"ruff format -\",\n    \"*.{ts,tsx,js,jsx}\": \"prettier --stdin-filepath {file}\"\n  }\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Inline config via env<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">For container or CI environments, ship the entire config inline:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>export OPENCODE_CONFIG_CONTENT='{\"model\":\"anthropic\/claude-sonnet-4-6\",\"permission\":&#91;...]}'\nopencode run \"fix the failing tests\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Or point at an alternative path:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>export OPENCODE_CONFIG=\/etc\/opencode\/prod.json\nexport OPENCODE_CONFIG_DIR=\/etc\/opencode<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Environment variables<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Core<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Variable<\/th><th>Purpose<\/th><\/tr><\/thead><tbody><tr><td><code>OPENCODE_CONFIG<\/code><\/td><td>Override path to <code>opencode.json<\/code>.<\/td><\/tr><tr><td><code>OPENCODE_CONFIG_DIR<\/code><\/td><td>Override the entire config directory.<\/td><\/tr><tr><td><code>OPENCODE_CONFIG_CONTENT<\/code><\/td><td>Inline JSON config (for CI \/ containers).<\/td><\/tr><tr><td><code>OPENCODE_TUI_CONFIG<\/code><\/td><td>Override path to TUI config.<\/td><\/tr><tr><td><code>OPENCODE_PERMISSION<\/code><\/td><td>Inline JSON permissions array.<\/td><\/tr><tr><td><code>OPENCODE_AUTO_SHARE<\/code><\/td><td>Auto-share every session (boolean).<\/td><\/tr><tr><td><code>OPENCODE_DISABLE_AUTOUPDATE<\/code><\/td><td>Skip update checks.<\/td><\/tr><tr><td><code>OPENCODE_DISABLE_AUTOCOMPACT<\/code><\/td><td>Disable automatic context compaction.<\/td><\/tr><tr><td><code>OPENCODE_DISABLE_MOUSE<\/code><\/td><td>Disable TUI mouse input.<\/td><\/tr><tr><td><code>OPENCODE_DISABLE_LSP_DOWNLOAD<\/code><\/td><td>Skip auto-download of language servers.<\/td><\/tr><tr><td><code>OPENCODE_DISABLE_DEFAULT_PLUGINS<\/code><\/td><td>Disable bundled plugins.<\/td><\/tr><tr><td><code>OPENCODE_DISABLE_MODELS_FETCH<\/code><\/td><td>Skip remote models.dev fetch.<\/td><\/tr><tr><td><code>OPENCODE_ENABLE_EXA<\/code><\/td><td>Enable Exa web search integration.<\/td><\/tr><tr><td><code>OPENCODE_ENABLE_EXPERIMENTAL_MODELS<\/code><\/td><td>Show experimental models in <code>models<\/code>.<\/td><\/tr><tr><td><code>OPENCODE_MODELS_URL<\/code><\/td><td>Custom models.dev-compatible URL.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Server \/ auth<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Variable<\/th><th>Purpose<\/th><\/tr><\/thead><tbody><tr><td><code>OPENCODE_SERVER_PASSWORD<\/code><\/td><td>Enable HTTP basic auth on <code>opencode serve<\/code>.<\/td><\/tr><tr><td><code>OPENCODE_SERVER_USERNAME<\/code><\/td><td>Auth username (default <code>opencode<\/code>).<\/td><\/tr><tr><td><code>OPENCODE_GIT_BASH_PATH<\/code><\/td><td>Custom Git Bash path on Windows.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Claude\/Gemini interop<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Variable<\/th><th>Purpose<\/th><\/tr><\/thead><tbody><tr><td><code>OPENCODE_DISABLE_CLAUDE_CODE<\/code><\/td><td>Skip <code>.claude<\/code> directory entirely.<\/td><\/tr><tr><td><code>OPENCODE_DISABLE_CLAUDE_CODE_PROMPT<\/code><\/td><td>Skip <code>~\/.claude\/CLAUDE.md<\/code>.<\/td><\/tr><tr><td><code>OPENCODE_DISABLE_CLAUDE_CODE_SKILLS<\/code><\/td><td>Skip <code>.claude\/skills<\/code> loading.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Experimental<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Master flag <code>OPENCODE_EXPERIMENTAL=1<\/code> enables every experimental feature. Otherwise, opt in individually:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Variable<\/th><th>Purpose<\/th><\/tr><\/thead><tbody><tr><td><code>OPENCODE_EXPERIMENTAL_PLAN_MODE<\/code><\/td><td>Plan mode (Tab toggle in input).<\/td><\/tr><tr><td><code>OPENCODE_EXPERIMENTAL_FILEWATCHER<\/code><\/td><td>File-watcher integration.<\/td><\/tr><tr><td><code>OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER<\/code><\/td><td>Disable file-watcher.<\/td><\/tr><tr><td><code>OPENCODE_EXPERIMENTAL_LSP_TOOL<\/code><\/td><td>Experimental LSP tool integration.<\/td><\/tr><tr><td><code>OPENCODE_EXPERIMENTAL_LSP_TY<\/code><\/td><td>Python TY language server.<\/td><\/tr><tr><td><code>OPENCODE_EXPERIMENTAL_OXFMT<\/code><\/td><td>Use the oxfmt formatter.<\/td><\/tr><tr><td><code>OPENCODE_EXPERIMENTAL_MARKDOWN<\/code><\/td><td>Markdown processing improvements.<\/td><\/tr><tr><td><code>OPENCODE_EXPERIMENTAL_ICON_DISCOVERY<\/code><\/td><td>Icon detection in TUI.<\/td><\/tr><tr><td><code>OPENCODE_EXPERIMENTAL_OUTPUT_TOKEN_MAX<\/code><\/td><td>LLM response token cap.<\/td><\/tr><tr><td><code>OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS<\/code><\/td><td>Default bash command timeout.<\/td><\/tr><tr><td><code>OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT<\/code><\/td><td>Don&#8217;t auto-copy on selection.<\/td><\/tr><tr><td><code>OPENCODE_EXPERIMENTAL_EXA<\/code><\/td><td>Exa search experimental features.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Themes<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Themes change the TUI&#8217;s colour palette. Cycle with <code>&lt;leader&gt;t<\/code> or set the default in <code>opencode.json<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{ \"theme\": \"system\" }       \/\/ follow OS dark\/light\n{ \"theme\": \"dark\" }\n{ \"theme\": \"light\" }\n{ \"theme\": \"tokyo-night\" }\n{ \"theme\": \"catppuccin\" }<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Custom themes drop into <code>~\/.config\/opencode\/themes\/&lt;name&gt;.json<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Oh-My-OpenAgent extensions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Oh-My-OpenAgent (omoa) is a community plugin manager that ships pre-built agents, themes, and skill bundles. Most-used commands once installed via the <a href=\"https:\/\/computingforgeeks.com\/install-opencode-oh-my-openagent-linux\/\" target=\"_blank\" rel=\"noreferrer noopener\">Oh-My-OpenAgent install guide<\/a>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>omoa list                # available bundles\nomoa install &lt;name&gt;      # add an agent or theme bundle\nomoa update              # pull updates\nomoa search &lt;term&gt;       # find a bundle<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Bundles drop their files under <code>~\/.config\/opencode\/agents\/<\/code> and <code>~\/.config\/opencode\/skills\/<\/code>. OpenCode picks them up next launch.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Upgrade and uninstall<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code># Upgrade to latest using the same install method\nopencode upgrade\n\n# Pin a specific version\nopencode upgrade 1.14.33\n\n# Force install method\nopencode upgrade --method npm\nopencode upgrade --method bun\nopencode upgrade --method curl\nopencode upgrade --method brew\nopencode upgrade --method choco\nopencode upgrade --method scoop\n\n# Uninstall (with options)\nopencode uninstall                  # full clean\nopencode uninstall --keep-config    # preserve ~\/.config\/opencode\nopencode uninstall --keep-data      # preserve ~\/.local\/share\/opencode\nopencode uninstall --dry-run        # preview removal\nopencode uninstall --force          # skip confirmations<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Common errors and fixes<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Error: &#8220;CPU lacks AVX support&#8221;<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The bundled Bun runtime requires AVX2. Most cloud VMs and modern laptops have it. If your hypervisor passes a generic CPU type, the runtime crashes on launch. Fix on Proxmox: stop the VM, set <code>cpu: host<\/code>, restart. On QEMU directly: pass <code>-cpu host<\/code>. Check support inside the guest with <code>grep -m1 -oE 'avx[0-9a-z]*' \/proc\/cpuinfo<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Error: &#8220;Performing one time database migration&#8221;<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Informational on first launch. The CLI builds a SQLite store under <code>~\/.local\/share\/opencode\/<\/code>. Can take 10 to 30 seconds, longer on slow disks. Wait for <code>sqlite-migration:done<\/code> before assuming a hang.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Error: &#8220;no provider configured&#8221;<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run <code>opencode auth login<\/code> and finish the flow, or export the right env var (<code>ANTHROPIC_API_KEY<\/code>, <code>OPENAI_API_KEY<\/code>, <code>GEMINI_API_KEY<\/code>) before launching. <code>opencode auth list<\/code> confirms what is currently configured.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Issue: attach mode rejected with 401<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The remote server requires basic auth and you did not pass the password. Either set <code>OPENCODE_SERVER_PASSWORD<\/code> in your env or pass <code>-p &lt;password&gt;<\/code>. The server prints the expected password on first start if you launched with <code>opencode serve<\/code> and did not set one explicitly.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Issue: Bash commands time out unexpectedly<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Long-running commands (test suites, builds) hit the default bash timeout. Raise it with <code>OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS=300000<\/code> in the environment, or per-command via the <code>timeout<\/code> field in custom command frontmatter.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">OpenCode vs Claude Code vs Aider vs Codex CLI<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>OpenCode<\/strong>: open-source, server-mode native, multi-provider, web UI, ACP for IDE integration, sophisticated permissions and multi-agent workflows. Best when you want a fleet-of-agents setup or self-hosted access from multiple machines.<\/li>\n\n\n\n<li><strong>Claude Code<\/strong>: deepest agent ecosystem, hooks, skills, plugins, polished UX. See the <a href=\"https:\/\/computingforgeeks.com\/claude-code-cheat-sheet\/\" target=\"_blank\" rel=\"noreferrer noopener\">Claude Code cheat sheet<\/a>.<\/li>\n\n\n\n<li><strong>Aider<\/strong>: git-native, repo-map-aware, broadest provider routing. See the <a href=\"https:\/\/computingforgeeks.com\/aider-cheat-sheet\/\" target=\"_blank\" rel=\"noreferrer noopener\">Aider cheat sheet<\/a>.<\/li>\n\n\n\n<li><strong>Codex CLI<\/strong>: tight focus, OpenAI-only, sharpest at short refactors. See the <a href=\"https:\/\/computingforgeeks.com\/codex-cli-cheat-sheet\/\" target=\"_blank\" rel=\"noreferrer noopener\">Codex CLI cheat sheet<\/a>.<\/li>\n\n\n\n<li><strong>Gemini CLI<\/strong>: free OAuth tier, 1M-token context. See the <a href=\"https:\/\/computingforgeeks.com\/gemini-cli-cheat-sheet\/\" target=\"_blank\" rel=\"noreferrer noopener\">Gemini CLI cheat sheet<\/a>.<\/li>\n\n\n\n<li>For a deeper head-to-head, see <a href=\"https:\/\/computingforgeeks.com\/opencode-vs-claude-code-vs-cursor\/\" target=\"_blank\" rel=\"noreferrer noopener\">OpenCode vs Claude Code vs Cursor<\/a>.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently asked questions<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Where is the OpenCode config file?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">User-level config is at <code>~\/.config\/opencode\/opencode.json<\/code>. Project-level overrides go in <code>.\/.opencode.json<\/code> at the repo root. Project values override user values. Inspect the merged result with <code>opencode debug config<\/code>. Override the path entirely with <code>OPENCODE_CONFIG=\/path\/to\/file<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Does OpenCode have a free tier?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Yes. The OpenCode team hosts five free models under the <code>opencode\/<\/code> provider (<code>opencode\/big-pickle<\/code>, <code>opencode\/gpt-5-nano<\/code>, plus three preview slots). Run <code>opencode models opencode<\/code> to see the current set. Quota is throttled per IP.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How do I add an MCP server in OpenCode?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Two paths. The CLI: <code>opencode mcp add<\/code> walks you through the interactive flow. The config file: edit <code>opencode.json<\/code> and add an entry under the <code>mcp<\/code> key with <code>type<\/code>, <code>command<\/code>, and optional <code>environment<\/code>. Then run <code>opencode mcp list<\/code> to verify.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Can OpenCode work with Ollama?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Yes. Add Ollama as an OpenAI-compatible provider in <code>opencode.json<\/code> by pointing the OpenAI provider at <code>http:\/\/localhost:11434\/v1<\/code>. Then launch with <code>-m ollama\/llama3.3<\/code>. Pair with the <a href=\"https:\/\/computingforgeeks.com\/ollama-commands-cheat-sheet\/\" target=\"_blank\" rel=\"noreferrer noopener\">Ollama commands cheat sheet<\/a> for model management.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How do I share an OpenCode session?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Launch with <code>--share<\/code>, or invoke <code>\/share<\/code> inside a running session. OpenCode prints a public URL pointing at the session transcript on the OpenCode share service. Use <code>opencode export &lt;sessionID&gt; --sanitize<\/code> first to redact sensitive content before sharing.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What is plan mode?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Plan mode is a read-only state where the agent reads, reasons, and proposes a plan but cannot write or run shell commands. Toggle it from the input field with <code>Tab<\/code>. Useful for code reviews, audits, and &#8220;what would happen if&#8221; exploration before letting the agent touch anything.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How do I create a custom slash command?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Drop a markdown file under <code>.opencode\/commands\/&lt;name&gt;.md<\/code> (project-scoped) or <code>~\/.config\/opencode\/commands\/&lt;name&gt;.md<\/code> (user-scoped). The frontmatter sets <code>description<\/code>, optional <code>agent<\/code>, optional <code>model<\/code>, optional <code>subtask<\/code>. The body is the prompt template, with placeholders like <code>$ARGUMENTS<\/code>, <code>$1<\/code>, <code>!`shell`<\/code>, and <code>@file<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Keep this open while you work<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">OpenCode releases roughly every two weeks, and the surface keeps growing. When a new version ships check the freshness block at the top of this page and re-read the section that changed. Pair this with the <a href=\"https:\/\/computingforgeeks.com\/setup-opencode-ai-coding-agent\/\" target=\"_blank\" rel=\"noreferrer noopener\">OpenCode setup guide<\/a> for first-time install, the <a href=\"https:\/\/computingforgeeks.com\/install-opencode-oh-my-openagent-linux\/\" target=\"_blank\" rel=\"noreferrer noopener\">Oh-My-OpenAgent install guide<\/a> if you use the community plugin manager, and the <a href=\"https:\/\/computingforgeeks.com\/opencode-vs-claude-code-vs-cursor\/\" target=\"_blank\" rel=\"noreferrer noopener\">OpenCode vs Claude Code vs Cursor comparison<\/a> when picking your daily driver.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>OpenCode is the open-source terminal AI coding agent from sst.dev, written in TypeScript and Go, runs on Bun, and speaks every major LLM provider. The surface area is large: 18 top-level CLI commands, dozens of subcommands, 60+ keyboard shortcuts in the TUI, a custom-commands system, a permissions engine, AGENTS.md project memory, MCP server management, ACP &#8230; <a title=\"OpenCode CLI Cheat Sheet &#8211; Commands and Workflows\" class=\"read-more\" href=\"https:\/\/computingforgeeks.com\/opencode-cli-cheat-sheet\/\" aria-label=\"Read more about OpenCode CLI Cheat Sheet &#8211; Commands and Workflows\">Read more<\/a><\/p>\n","protected":false},"author":3,"featured_media":167359,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39034,329,690],"tags":[17245,212,669],"cfg_series":[],"class_list":["post-167358","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai","category-automation","category-dev","tag-ai","tag-automation","tag-dev"],"_links":{"self":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/167358","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/comments?post=167358"}],"version-history":[{"count":2,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/167358\/revisions"}],"predecessor-version":[{"id":167361,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/167358\/revisions\/167361"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media\/167359"}],"wp:attachment":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media?parent=167358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/categories?post=167358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/tags?post=167358"},{"taxonomy":"cfg_series","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/cfg_series?post=167358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}