OpenCode field reference

OpenCode Code Cheatsheet and Command Guide

Move from “what was that command?” to the exact syntax, shortcut, flag, path, or configuration you need—without losing the thread of your work.

Updated July 28, 2026 · Fast-changing items are marked “Check locally”.

opencode://quick-start

01

02

03

04

05

Tap a row to copy
175searchable entries
14task categories
2command builders
1 keyfocus search with /

01 / Start with intent

What do you need OpenCode to do?

Select an outcome to open a focused set of matching commands.

02 / Find anything

OpenCode command atlas

Search syntax, descriptions, examples, aliases, and keywords.

03 / Compose a run

Headless command builder

Choose the session, model, output, file, and server options you need, then copy a ready-to-edit command.
Generated command

    04 / Reuse good prompts

    Custom command workshop

    Generate a project command file. OpenCode uses the Markdown file name as the slash command name.
    .opencode/commands/review-tests.md

    Run it as /review-tests <arguments>. A project command can override a built-in command with the same name, so choose names deliberately.

    05 / Know what wins

    Configuration priority

    OpenCode merges configuration layers. Later layers override only conflicting keys.
    01
    Remote organization defaults.well-known/opencodeLowest priority
    02
    Global user configuration~/.config/opencode/opencode.jsonPersonal defaults
    03
    Custom config path$OPENCODE_CONFIGExplicit file override
    04
    Project configuration./opencode.jsonRepository settings
    05
    Project components.opencode/Agents, commands, skills, plugins
    06
    Inline configurationOPENCODE_CONFIG_CONTENTHighest priority

    06 / Put files in scope

    Path map

    Use global locations for personal defaults and project locations for repository behavior.
    Global configuration~/.config/opencode/opencode.json

    Models, providers, permissions, sharing, compaction, and server defaults for the current user.

    Global TUI settings~/.config/opencode/tui.json

    Theme, scrolling, diff style, and keybindings.

    Global instructions~/.config/opencode/AGENTS.md

    Instructions that apply across projects.

    Global commands~/.config/opencode/commands/

    Custom slash commands available across projects.

    Global skills~/.config/opencode/skills/

    Reusable skills available across projects.

    Global plugins~/.config/opencode/plugins/

    User-level plugins.

    Project instructions<project>/AGENTS.md

    Repository-specific context and working rules.

    Project configuration<project>/opencode.json

    Project settings that override conflicting global values.

    Project workspace<project>/.opencode/

    Project agents, commands, skills, and plugins.

    07 / Follow a reliable route

    Four practical workflows

    Select a workflow, then copy any step you need.

    First project

    Connect a provider, teach OpenCode the repository, and start with useful context.

    1. 01

      Launch in the intended repository.

    2. 02

      Add the provider and credentials you want to use.

    3. 03

      Create or update AGENTS.md after reviewing the project.

    4. 04

      Confirm the instructions are concise and accurate.

    08 / Use the leader layer

    Ctrl+X shortcut map

    The default leader is Ctrl+X. Change it in tui.json and use local help when a mapping differs.
    NNew session
    LOpen sessions
    CCompact context
    UUndo message and edits
    RRedo message and edits
    SShare session
    XExport session
    EOpen editor
    MPick model
    APick agent
    TPick theme
    HOpen help
    QExit
    DToggle tool details
    BToggle sidebar
    GOpen session timeline
    YCopy the latest message

    09 / Keep the vocabulary close

    OpenCode glossary

    Short definitions for the concepts behind the commands.
    TUI

    The interactive terminal interface launched by opencode.

    Headless run

    A non-interactive task launched with opencode run, useful in scripts and CI.

    Session

    Saved conversation history that can be reopened, continued, forked, exported, or shared.

    AGENTS.md

    Project or user instructions that give OpenCode durable context.

    Snapshot

    Git-backed state used by undo and redo for file changes.

    Compaction

    A summary of older conversation context that frees room for continued work.

    Agent

    A task-focused behavior and tool configuration.

    MCP

    Model Context Protocol, used to connect external tools and services.

    ACP

    Agent Client Protocol support over JSON-RPC for compatible clients and editors.

    10 / Install and launch

    Choose your installation route

    After installation, run opencode --version and opencode --help to confirm the local command surface.
    Install script · macOS / Linux
    npm
    Homebrew · macOS / Linux
    Chocolatey · Windows
    Scoop · Windows
    Docker

    11 / Before you run it

    Small checks prevent large surprises

    • Sharing: inspect the entire session before using /share or --share.
    • Remote servers: add authentication before binding beyond localhost; confirm firewall and network exposure.
    • Shell injection: both prompt !command and custom-command !`command` run with your user permissions.
    • Undo and redo: inspect git diff after snapshot restoration; unrelated manual changes may need separate care.
    • Credentials: use environment or protected file substitution instead of committing API keys into configuration.
    • Fast-changing features: confirm experimental variables, keybindings, flags, and model names locally.
    Fast local checks
    Official referenceOpenCode documentation ↗

    Use this cheatsheet for discovery and recall. Before production automation, security-sensitive changes, or network exposure, confirm syntax and behavior in the installed OpenCode version.