Run a one-off prompt without the TUI
headless & scripting
// what it does
opencode run "..." executes a single prompt to completion, prints the result to stdout, and exits — the mode for scripts, git hooks, and CI. It uses the same config, agents, and providers as the TUI, so behavior matches what you would get interactively.
// shell
$ opencode run "explain how the auth module works"$ opencode run --agent plan "review this diff for bugs"// gotcha
run still executes tools (edits, bash) subject to your permission settings. In an unattended context, set permissions to allow or deny explicitly (or use --agent plan for read-only) so it does not stall waiting on an approval no one will answer.