CLI commands and flags
Full referenceEvery command, subcommand, option and positional argument the opencode CLI declares in its yargs command modules (68 commands, 115 options and arguments), with the help text it shows. Default commands are named after the module that declares them.
opencode
opencode [project]
start opencode tui
Source: opencode/src/cli/cmd/tui.ts:73
opencode --agent
agent to use. Type: string.
Source: opencode/src/cli/cmd/tui.ts:104
opencode --auto
auto-approve permissions that are not explicitly denied (dangerous!). Type: boolean.
Source: opencode/src/cli/cmd/tui.ts:108
opencode --continue
continue the last session. Alias: [. Type: boolean.
Source: opencode/src/cli/cmd/tui.ts:86
opencode --dangerously-skip-permissions
Option --dangerously-skip-permissions of opencode . Type: boolean.
Source: opencode/src/cli/cmd/tui.ts:118
opencode --demo
Option --demo of opencode . Type: boolean.
Source: opencode/src/cli/cmd/tui.ts:140
opencode --fork
fork the session when continuing (use with --continue or --session). Type: boolean.
Source: opencode/src/cli/cmd/tui.ts:96
opencode --mini
start the minimal interactive interface. Type: boolean.
Source: opencode/src/cli/cmd/tui.ts:123
opencode --model
model to use in the format of provider/model. Alias: [. Type: string.
Source: opencode/src/cli/cmd/tui.ts:81
opencode --no-replay
disable mini session history replay on resume and after resize. Type: boolean.
Source: opencode/src/cli/cmd/tui.ts:132
opencode --prompt
prompt to use. Type: string.
Source: opencode/src/cli/cmd/tui.ts:100
opencode --replay
Option --replay of opencode . Type: boolean.
Source: opencode/src/cli/cmd/tui.ts:128
opencode --replay-limit
cap visible mini replay to the newest N messages. Type: number.
Source: opencode/src/cli/cmd/tui.ts:136
opencode --session
session id to continue. Alias: [. Type: string.
Source: opencode/src/cli/cmd/tui.ts:91
opencode --yolo
Option --yolo of opencode . Type: boolean.
Source: opencode/src/cli/cmd/tui.ts:113
opencode <project> (argument)
path to start opencode in. Type: string.
Source: opencode/src/cli/cmd/tui.ts:77
opencode acp
opencode acp
start ACP (Agent Client Protocol) server
Source: opencode/src/cli/cmd/acp.ts:10
opencode acp --cwd
working directory. Type: string.
Source: opencode/src/cli/cmd/acp.ts:13
opencode agent
opencode agent
manage agents
opencode agent create
opencode agent create
create a new agent
Source: opencode/src/cli/cmd/agent.ts:34
opencode agent create --description
what the agent should do. Type: string.
Source: opencode/src/cli/cmd/agent.ts:42
opencode agent create --mode
agent mode. Type: string.
Source: opencode/src/cli/cmd/agent.ts:46
opencode agent create --model
model to use in the format of provider/model. Alias: [. Type: string.
Source: opencode/src/cli/cmd/agent.ts:56
opencode agent create --path
directory path to generate the agent file. Type: string.
Source: opencode/src/cli/cmd/agent.ts:38
opencode agent create --permissions
comma-separated list of permissions to allow (default: all). Available: "${AVAILABLE_PERMISSIONS.join(", ")}". Alias: [. Type: string.
Source: opencode/src/cli/cmd/agent.ts:51
opencode agent list
opencode agent list
list all available agents
opencode attach
opencode attach <url>
attach to a running opencode server
Source: opencode/src/cli/cmd/attach.ts:8
opencode attach --continue
continue the last session. Alias: [. Type: boolean.
opencode attach --dir
directory to run in. Type: string.
opencode attach --fork
fork the session when continuing (use with --continue or --session). Type: boolean.
opencode attach --mini
start the minimal interactive interface. Type: boolean.
opencode attach --no-replay
disable mini session history replay on resume and after resize. Type: boolean.
opencode attach --password
basic auth password (defaults to OPENCODE_SERVER_PASSWORD). Alias: [. Type: string.
opencode attach --replay
Option --replay of opencode attach. Type: boolean.
opencode attach --replay-limit
cap visible mini replay to the newest N messages. Type: number.
opencode attach --session
session id to continue. Alias: [. Type: string.
opencode attach --username
basic auth username (defaults to OPENCODE_SERVER_USERNAME or 'opencode'). Alias: [. Type: string.
opencode attach <url> (argument)
http://localhost:4096. Type: string.
opencode console
opencode console
log in to console
opencode db
opencode db
database tools
Source: opencode/src/cli/cmd/db.ts:55
opencode db [query]
open an interactive sqlite3 shell or run a query
Source: opencode/src/cli/cmd/db.ts:9
opencode db --format
Output format. Type: string.
Source: opencode/src/cli/cmd/db.ts:18
opencode db <query> (argument)
SQL query to execute. Type: string.
Source: opencode/src/cli/cmd/db.ts:14
opencode db path
opencode db path
print the database path
Source: opencode/src/cli/cmd/db.ts:46
opencode debug
opencode debug
debugging and troubleshooting tools
opencode debug agent
opencode debug agent <name>
show agent configuration details
opencode debug agent --params
Tool params as JSON or a JS object literal. Type: string.
opencode debug agent --tool
Tool id to execute. Type: string.
opencode debug agent <name> (argument)
Agent name. Type: string.
opencode debug config
opencode debug config
show resolved configuration
opencode debug diagnostics
opencode debug diagnostics <file>
get diagnostics for a file
opencode debug diagnostics <file> (argument)
Positional argument <file> of opencode debug diagnostics. Type: string.
opencode debug diff
opencode debug diff <hash>
show diff for a snapshot hash
opencode debug diff <hash> (argument)
hash. Type: string.
opencode debug document-symbols
opencode debug document-symbols <uri>
get symbols from a document
opencode debug document-symbols <uri> (argument)
Positional argument <uri> of opencode debug document-symbols. Type: string.
opencode debug file
opencode debug file
file system debugging utilities
opencode debug files
opencode debug files
list files using ripgrep
opencode debug files --glob
Glob pattern to match files. Type: string.
opencode debug files --limit
Limit number of results. Type: number.
opencode debug files --query
Filter files by query. Type: string.
opencode debug info
opencode debug info
show debug information
opencode debug list
opencode debug list <path>
list files in a directory
opencode debug list <path> (argument)
File path to list. Type: string.
opencode debug lsp
opencode debug lsp
LSP debugging utilities
opencode debug patch
opencode debug patch <hash>
show patch for a snapshot hash
opencode debug patch <hash> (argument)
hash. Type: string.
opencode debug paths
opencode debug paths
show global paths (data, config, cache, state)
opencode debug read
opencode debug read <path>
read file contents as JSON
opencode debug read <path> (argument)
File path to read. Type: string.
opencode debug rg
opencode debug rg
ripgrep debugging utilities
opencode debug scrap
opencode debug scrap
list all known projects
opencode debug search
opencode debug search <pattern>
search file contents using ripgrep
opencode debug search <query>
search files by query
opencode debug search --glob
File glob patterns. Type: array.
opencode debug search --limit
Limit number of results. Type: number.
opencode debug search <pattern> (argument)
Search pattern. Type: string.
opencode debug search <query> (argument)
Search query. Type: string.
opencode debug skill
opencode debug skill
list all available skills
opencode debug snapshot
opencode debug snapshot
snapshot debugging utilities
opencode debug startup
opencode debug startup
print startup timing
opencode debug symbols
opencode debug symbols <query>
search workspace symbols
opencode debug symbols <query> (argument)
Positional argument <query> of opencode debug symbols. Type: string.
opencode debug track
opencode debug track
track current snapshot state
opencode debug v2
opencode debug v2
debug v2 catalog and built-in plugins
opencode debug wait
opencode debug wait
wait indefinitely (for debugging)
opencode export
opencode export [sessionID]
export session data as JSON
opencode export --sanitize
redact sensitive transcript and file data. Type: boolean.
opencode export <sessionID> (argument)
session id to export. Type: string.
opencode generate
opencode generate
CLI command generate.
opencode github
opencode github
manage GitHub agent
opencode github install
opencode github install
install the GitHub agent
Source: opencode/src/cli/cmd/github.ts:8
opencode github run
opencode github run
run the GitHub agent
opencode github run --event
GitHub mock event to run the agent for. Type: string.
opencode github run --token
GitHub personal access token (github_pat_********). Type: string.
opencode import
opencode import <file>
import session data from JSON file or URL
opencode import <file> (argument)
path to JSON file or share URL. Type: string.
opencode login
opencode login [url]
server URL
opencode login <url> (argument)
server URL. Type: string.
opencode logout
opencode logout [email]
account email to log out from
opencode logout <email> (argument)
account email to log out from. Type: string.
opencode mcp
opencode mcp
manage MCP (Model Context Protocol) servers
Source: opencode/src/cli/cmd/mcp.ts:96
opencode mcp add
opencode mcp add [name]
add an MCP server
Source: opencode/src/cli/cmd/mcp.ts:430
opencode mcp add --env
environment variable for a local MCP server (KEY=VALUE). Type: string.
Source: opencode/src/cli/cmd/mcp.ts:442
opencode mcp add --header
HTTP header for a remote MCP server (KEY=VALUE). Type: string.
Source: opencode/src/cli/cmd/mcp.ts:447
opencode mcp add --url
URL for a remote MCP server. Type: string.
Source: opencode/src/cli/cmd/mcp.ts:438
opencode mcp add <name> (argument)
name of the MCP server. Type: string.
Source: opencode/src/cli/cmd/mcp.ts:434
opencode mcp auth
opencode mcp auth [name]
authenticate with an OAuth-enabled MCP server
Source: opencode/src/cli/cmd/mcp.ts:171
opencode mcp auth <name> (argument)
name of the MCP server. Type: string.
Source: opencode/src/cli/cmd/mcp.ts:175
opencode mcp debug
opencode mcp debug <name>
debug OAuth connection for an MCP server
Source: opencode/src/cli/cmd/mcp.ts:660
opencode mcp debug <name> (argument)
name of the MCP server. Type: string.
Source: opencode/src/cli/cmd/mcp.ts:663
opencode mcp list
opencode mcp list
list MCP servers and their status
Source: opencode/src/cli/cmd/mcp.ts:110, opencode/src/cli/cmd/mcp.ts:307
opencode mcp logout
opencode mcp logout [name]
remove OAuth credentials for an MCP server
Source: opencode/src/cli/cmd/mcp.ts:337
opencode mcp logout <name> (argument)
name of the MCP server. Type: string.
Source: opencode/src/cli/cmd/mcp.ts:340
opencode models
opencode models [provider]
list all available models
Source: opencode/src/cli/cmd/models.ts:9
opencode models --refresh
refresh the models cache from models.dev. Type: boolean.
opencode models --verbose
use more verbose model output (includes metadata like costs). Type: boolean.
opencode models <provider> (argument)
provider ID to filter models by. Type: string.
opencode open
opencode open
CLI command open.
opencode orgs
opencode orgs
CLI command orgs.
opencode plugin
opencode plugin <module>
install plugin and update config
Source: opencode/src/cli/cmd/plug.ts:179
opencode plugin --force
replace existing plugin version. Alias: [. Type: boolean.
Source: opencode/src/cli/cmd/plug.ts:194
opencode plugin --global
install in global config. Alias: [. Type: boolean.
Source: opencode/src/cli/cmd/plug.ts:188
opencode plugin <module> (argument)
npm module name. Type: string.
Source: opencode/src/cli/cmd/plug.ts:184
opencode pr
opencode pr <number>
fetch and checkout a GitHub PR branch, then run opencode
Source: opencode/src/cli/cmd/pr.ts:9
opencode pr <number> (argument)
PR number to checkout. Type: number.
Source: opencode/src/cli/cmd/pr.ts:12
opencode providers
opencode providers
manage AI providers and credentials
opencode providers list
opencode providers list
list providers and credentials
opencode providers login
opencode providers login [url]
log in to a provider
opencode providers login --method
login method label (skips method selection). Alias: [. Type: string.
opencode providers login --provider
provider id or name to log in to (skips provider selection). Alias: [. Type: string.
opencode providers login <url> (argument)
opencode auth provider. Type: string.
opencode providers logout
opencode providers logout [provider]
log out from a configured provider
opencode providers logout <provider> (argument)
provider id or name to log out from. Type: string.
opencode run
opencode run [message..]
run opencode with a message
Source: opencode/src/cli/cmd/run.ts:127
opencode run --agent
agent to use. Type: string.
Source: opencode/src/cli/cmd/run.ts:170
opencode run --attach
attach to a running opencode server (e.g., http://localhost:4096). Type: string.
Source: opencode/src/cli/cmd/run.ts:190
opencode run --auto
auto-approve permissions that are not explicitly denied (dangerous!). Type: boolean.
Source: opencode/src/cli/cmd/run.ts:242
opencode run --command
the command to run, use message for args. Type: string.
Source: opencode/src/cli/cmd/run.ts:143
opencode run --continue
continue the last session. Alias: [. Type: boolean.
Source: opencode/src/cli/cmd/run.ts:147
opencode run --dangerously-skip-permissions
Option --dangerously-skip-permissions of opencode run. Type: boolean.
Source: opencode/src/cli/cmd/run.ts:252
opencode run --demo
enable direct interactive demo slash commands; pass one as the message to run it immediately. Type: boolean.
Source: opencode/src/cli/cmd/run.ts:257
opencode run --dir
directory to run in, path on remote server if attaching. Type: string.
Source: opencode/src/cli/cmd/run.ts:204
opencode run --file
file(s) to attach to message. Alias: [. Type: string.
Source: opencode/src/cli/cmd/run.ts:180
opencode run --fork
fork the session before continuing (requires --continue or --session). Type: boolean.
Source: opencode/src/cli/cmd/run.ts:157
opencode run --format
format: default (formatted) or json (raw JSON events). Type: string.
Source: opencode/src/cli/cmd/run.ts:174
opencode run --interactive
run in direct interactive split-footer mode. Alias: [. Type: boolean.
Source: opencode/src/cli/cmd/run.ts:236
opencode run --mini
Option --mini of opencode run. Type: boolean.
Source: opencode/src/cli/cmd/run.ts:220
opencode run --model
model to use in the format of provider/model. Alias: [. Type: string.
Source: opencode/src/cli/cmd/run.ts:165
opencode run --password
basic auth password (defaults to OPENCODE_SERVER_PASSWORD). Alias: [. Type: string.
Source: opencode/src/cli/cmd/run.ts:194
opencode run --port
port for the local server (defaults to random port if no value provided). Type: number.
Source: opencode/src/cli/cmd/run.ts:208
opencode run --replay
replay interactive session history on resume and after resize (use --no-replay to disable). Type: boolean.
Source: opencode/src/cli/cmd/run.ts:225
opencode run --replay-limit
cap visible interactive replay to the newest N messages. Type: number.
Source: opencode/src/cli/cmd/run.ts:231
opencode run --session
session id to continue. Alias: [. Type: string.
Source: opencode/src/cli/cmd/run.ts:152
opencode run --share
share the session. Type: boolean.
Source: opencode/src/cli/cmd/run.ts:161
opencode run --thinking
show thinking blocks. Type: boolean.
Source: opencode/src/cli/cmd/run.ts:216
opencode run --title
title for the session (uses truncated prompt if no value provided). Type: string.
Source: opencode/src/cli/cmd/run.ts:186
opencode run --username
basic auth username (defaults to OPENCODE_SERVER_USERNAME or 'opencode'). Alias: [. Type: string.
Source: opencode/src/cli/cmd/run.ts:199
opencode run --variant
model variant (provider-specific reasoning effort, e.g., high, max, minimal). Type: string.
Source: opencode/src/cli/cmd/run.ts:212
opencode run --yolo
Option --yolo of opencode run. Type: boolean.
Source: opencode/src/cli/cmd/run.ts:247
opencode run <message> (argument)
message to send. Type: string.
Source: opencode/src/cli/cmd/run.ts:137
opencode serve
opencode serve
starts a headless opencode server
Source: opencode/src/cli/cmd/serve.ts:7
opencode session
opencode session
manage sessions
opencode session delete
opencode session delete <sessionID>
delete a session
opencode session delete <sessionID> (argument)
session ID to delete. Type: string.
opencode session list
opencode session list
list sessions
opencode session list --format
output format. Type: string.
opencode session list --max-count
limit to N most recent sessions. Alias: n. Type: number.
opencode stats
opencode stats
show token usage and cost statistics
Source: opencode/src/cli/cmd/stats.ts:50
opencode stats --days
show stats for the last N days (default: all time). Type: number.
Source: opencode/src/cli/cmd/stats.ts:54
opencode stats --models
show model statistics (default: hidden). Pass a number to show top N, otherwise shows all
Source: opencode/src/cli/cmd/stats.ts:62
opencode stats --project
filter by project (default: all projects, empty string: current project). Type: string.
Source: opencode/src/cli/cmd/stats.ts:65
opencode stats --tools
number of tools to show (default: all). Type: number.
Source: opencode/src/cli/cmd/stats.ts:58
opencode switch
opencode switch
CLI command switch.
opencode uninstall
opencode uninstall
uninstall opencode and remove all related files
opencode uninstall --dry-run
show what would be removed without removing. Type: boolean.
opencode uninstall --force
skip confirmation prompts. Alias: f. Type: boolean.
opencode uninstall --keep-config
keep configuration files. Alias: c. Type: boolean.
opencode uninstall --keep-data
keep session data and snapshots. Alias: d. Type: boolean.
opencode upgrade
opencode upgrade [target]
upgrade opencode to the latest or a specific version
opencode upgrade --method
installation method to use. Alias: m. Type: string.
opencode upgrade <target> (argument)
version to upgrade to, for ex '0.1.48' or 'v0.1.48'. Type: string.
opencode web
opencode web
start opencode server and open web interface
Source: opencode/src/cli/cmd/web.ts:32