Start typing to search the documentation.

CLI navigation

Settings

CLI settings control the terminal clients only. They are separate from the server and project settings in opencode.json(c).

Press Ctrl+P, then select Open settings to change common settings from the TUI.

OpenCode TUI settings dialog

Configuration file

OpenCode stores CLI settings in one global file:

~/.config/opencode/cli.json

When $XDG_CONFIG_HOME is set, OpenCode uses:

$XDG_CONFIG_HOME/opencode/cli.json

There is no project-local CLI settings file. Add the published JSON Schema for validation and autocomplete:

cli.json
{
  "$schema": "https://opencode.ai/v2/cli.json"
}

OpenCode adds $schema when it creates or migrates this file. Unknown settings are rejected, and valid edits reload while the TUI is running.

Inline config

Set OPENCODE_CLI_CONFIG_CONTENT to apply CLI settings from inline JSON:

OPENCODE_CLI_CONFIG_CONTENT='{"tabs":{"mode":"off"}}' opencode

OpenCode merges the inline settings over the global cli.json. Nested objects are merged, while arrays and scalar values from the environment replace global values. Inline settings remain authoritative while the variable is set.

Appearance

Choose a theme, control interface motion, and override the terminal cursor:

cli.json
{
  "theme": {
    "name": "tokyonight",
    "mode": "system"
  },
  "animations": true,
  "cursor": {
    "style": "block",
    "blinking": true
  }
}
SettingValuesDescription
theme.namestringSelects a built-in, custom, or terminal-derived theme.
theme.modesystem, dark, or lightFollows the terminal appearance or locks the theme to one color mode.
animationsbooleanEnables interface animations.
cursor.styleblock, underline, line, defaultSets the cursor shape. default preserves the terminal’s cursor shape.
cursor.blinkingbooleanControls cursor blinking. It has no effect when the style is default.

See Theme for selecting and creating themes.

Input

Configure mouse capture, scrolling, editor context, pastes, and prompt image previews:

cli.json
{
  "mouse": true,
  "scroll": {
    "speed": 3,
    "acceleration": false
  },
  "prompt": {
    "editor": true,
    "paste": "compact",
    "image_preview": false
  }
}
SettingValuesDescription
mousebooleanEnables terminal mouse capture.
scroll.speednumber, at least 0.001Sets the fixed distance per scroll input tick.
scroll.accelerationbooleanAccelerates repeated scrolling. When enabled, it takes precedence over speed.
prompt.editorbooleanIncludes the active editor file or selection as prompt context.
prompt.pastecompact or fullShows large pastes as compact placeholders or as full text.
prompt.image_previewbooleanShows image attachment previews above the prompt input.

Sessions

Configure how full-screen TUI sessions are presented and where new sessions start:

cli.json
{
  "session": {
    "sidebar": "auto",
    "scrollbar": false,
    "thinking": "hide",
    "grouping": "auto",
    "image_preview": false,
    "tps": true,
    "markdown": "rendered",
    "new_location": "launch",
    "permissions": "prompt"
  }
}
SettingValuesDescription
session.sidebarauto or hideShows the sidebar when space permits or always hides it.
session.scrollbarbooleanShows the transcript scrollbar.
session.thinkingshow or hideShows or hides model reasoning by default.
session.groupingauto or noneGroups related transcript items or renders each item separately.
session.image_previewbooleanShows user attachment and tool-result images in the transcript.
session.tpsbooleanShows output tokens per second in assistant footers.
session.markdownsource or renderedShows Markdown syntax markers or conceals them in rendered content.
session.new_locationlaunch or inheritStarts in the TUI launch directory or inherits the active session location.
session.permissionsprompt or autoacceptPrompts for permission requests or accepts every request automatically.

Tabs

Configure the persistent session tab strip:

cli.json
{
  "tabs": {
    "mode": "auto",
    "scope": "cwd",
    "layout": "horizontal",
    "indicators": "status"
  }
}

The legacy boolean tabs.enabled setting remains supported: true is on and false is off. OpenCode reads it without rewriting the config file.

SettingValuesDescription
tabs.modeauto, on, or offUses tabs automatically, always, or never. Auto hides them inside Herdr.
tabs.scopecwd or globalKeeps separate tabs per working directory or shares them globally.
tabs.layouthorizontal or verticalPlaces tabs in a horizontal strip or a vertical sidebar.
tabs.indicatorsstatus or numbersShows status icons or always shows tab numbers.

Number indicators retain status colors and background animations. Ctrl+number shortcuts switch tabs in either indicator mode.

Diffs

Configure the initial diff scope and presentation:

cli.json
{
  "diffs": {
    "source": "branch",
    "wrap": "word",
    "tree": true,
    "single": false,
    "view": "auto"
  }
}
SettingValuesDescription
diffs.sourcebranch, committed, working, or turnSets the initial review scope.
diffs.wrapword or noneWraps long lines at words or leaves them unwrapped.
diffs.treebooleanShows the diff file tree.
diffs.singlebooleanShows only the selected file patch.
diffs.viewauto, split, or unifiedSets the layout. auto chooses from the available width.

branch shows All branch and local changes, committed shows branch commits only, and working shows staged, unstaged, and untracked changes. turn shows Last turn, the files the session changed in its latest turn; it refreshes when the session finishes a turn and falls back to branch when /diff is not opened from a session.

In /diff, press d to change the scope or choose a comparison branch from Base. These in-view choices last until the TUI exits and do not change cli.json.

Alerts

Enable system notifications and attention sounds independently:

cli.json
{
  "attention": {
    "notifications": true,
    "sound": true,
    "volume": 0.4,
    "sound_pack": "opencode.default",
    "sounds": {
      "permission": "/home/me/sounds/permission.wav"
    }
  }
}
SettingValuesDescription
attention.notificationsbooleanShows system notifications, normally when the terminal is not focused.
attention.soundbooleanPlays attention sounds.
attention.volumenumber from 0 to 1Sets sound volume.
attention.sound_packstringSelects the active sound pack ID.
attention.soundsobjectOverrides sound files for default, question, permission, error, done, or subagent_done.

An invalid or unreadable override falls back to the built-in sound for that event.

Terminal

Configure terminal integration:

cli.json
{
  "terminal": {
    "title": true,
    "copy": "select"
  }
}
SettingValuesDescription
terminal.titlebooleanUpdates the terminal window title.
terminal.copymanual or selectCopies manually or immediately after selection. The platform default is manual on Windows and select elsewhere.

Mini

The mini group controls opencode mini, the minimal interactive interface:

cli.json
{
  "mini": {
    "thinking": "show",
    "tools": "hide",
    "shell_output": "hide",
    "turn_summary": "show",
    "footer": "show",
    "splash": "show",
    "work_spinner": "block-soft-slide",
    "mono": false,
    "replay": true,
    "replay_limit": 200
  }
}
SettingValuesDescription
mini.thinkingshow or hideShows or hides model reasoning.
mini.toolsshow or hideShows or hides tool calls and the assistant text that precedes them.
mini.shell_outputshow or hideShows or hides raw shell tool output.
mini.turn_summaryshow or hideShows or hides the agent, model, and duration summary in scrollback.
mini.footershow or hideShows or hides persistent activity, model, usage, and context details.
mini.splashshow or hideShows or hides entry and exit splash banners.
mini.work_spinnerspinner IDSelects the work animation in the footer.
mini.monobooleanUses monochrome ASCII output.
mini.replaybooleanRestores session history on resume and terminal resize.
mini.replay_limitpositive integerLimits replay to the newest messages. The default limit is 200.

Available spinner IDs are:

block-soft-slide  block-soft-sweep  block-low-comet  block-low-duet
block-shuttle     block-bridge      block-squeeze    small-toggle
square-toggle     grow-shrink       quadrant-orbit   crosshatch
density-wave      seed

Command-line mini replay flags override these settings for that invocation.

Keybinds

Override a command binding and the leader-key timeout:

cli.json
{
  "keybinds": {
    "leader": "ctrl+x",
    "app.exit": ["ctrl+c", "ctrl+d", "<leader>q"],
    "prompt.paste": {
      "key": "ctrl+v",
      "event": "press",
      "preventDefault": false,
      "fallthrough": false
    },
    "help.show": false
  },
  "leader": {
    "timeout": 2000
  }
}
SettingValuesDescription
keybinds.leaderbinding valueSets the key referenced by <leader> in other bindings.
keybinds.<command>binding valueOverrides the binding for one command ID.
keybinds.*.keykey string or descriptorSelects the key for an object binding.
keybinds.*.eventpress or releaseLimits an object binding to one key event.
keybinds.*.preventDefaultbooleanControls whether the terminal’s default key behavior is prevented.
keybinds.*.fallthroughbooleanAllows lower-priority handlers to receive the same event.
leader.timeoutpositive integerSets how many milliseconds to wait after the leader key.

A binding value can be a string, an array of alternatives, or an object. Use "none" or false to disable a binding. See Keybinds for accepted key syntax, every command ID, and every default binding.

Plugins

Load terminal-only plugins in order:

cli.json
{
  "plugins": [
    "-opencode.notifications",
    {
      "package": "./plugins/status",
      "options": {
        "compact": true
      }
    }
  ]
}
SettingValuesDescription
pluginsarrayDeclares ordered enablement directives and external plugins.
plugins[].packagestringSets a package name, local path, or file URL.
plugins[].optionsobjectPasses plugin-specific options to that plugin.

See Plugins for package forms, local discovery, wildcards, and disable directives.

Debug and experimental

Enable diagnostics or opt in to a currently available experiment:

cli.json
{
  "debug": {
    "devtools": false,
    "timing": false,
    "turn_tokens": "verbose"
  },
  "experimental": {}
}
SettingValuesDescription
debug.devtoolsbooleanShows the DevTools debug bar.
debug.timingbooleanShows time-to-first-draw diagnostics in the debug bar.
debug.turn_tokensboolean or verboseShows per-turn token usage; verbose also includes tool call inputs.
experimentalobject of feature IDs to booleansEnables or disables experiments that may change or be removed without notice.

Only use feature IDs currently listed by the TUI’s Experiments dialog. Unknown IDs have no effect.