You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cli: restore --agent (and --model) on the full-screen TUI in v2 #53728
In v2 the root opencode command (full-screen TUI) accepts --prompt but no longer accepts --agent or --model; those flags survive only on opencode mini and opencode run. Scripts that need to start an interactive session pinned to a specific primary agent are therefore forced into the minimal UI (mini) or headless run, which is a UX regression from v1 where opencode --agent <name> --prompt "..." opened the full TUI.
Environment
opencode version: 2.0.20 (also verified against the v2.0.24 tag: packages/cli/src/commands/commands.ts — the root spec defines only continue, session, prompt plus server/permission params, while mini and run define agent and model)
Define two primary agents in .opencode/agents/ (e.g. plan and build) with default_agent: plan.
Run opencode --agent build --prompt "hello".
Observe: unknown flag error. opencode mini --agent build --prompt "hello" and opencode run --agent build "hello" work.
Expected Behavior
opencode --agent <primary> [--model provider/model] --prompt "..." opens the full-screen TUI with that agent selected, as in v1.
Actual Behavior
The full TUI rejects --agent/--model; the only interactive way to pin the agent at launch is mini.
Additional Context
Use case: wrapper scripts (task review -- <PR#> style) that prepare a worktree and launch an interactive session as a specific orchestrator agent, which in turn dispatches a subagent. Subagents can't be top-level, and default_agent can't be changed per invocation, so an explicit launch flag is the only clean mechanism.
Workaround in use: widen the default agent's task permissions so the default agent can do the dispatch and launch with --prompt alone. Works, but couples permissions to a launcher concern.
Please use the Bug Report template and include its required Description field. The current body has substantive content under “Summary,” but does not include the required Description field.
Please edit this issue to address the above within 72 hours, or it will be automatically closed.
This issue might be a duplicate of an existing issue. Please check:
Thanks for the detailed report. I can reproduce this on v2.0.20:
opencode2 --agent build --prompt "hello" fails with Unrecognized flag: --agent in command opencode.
opencode2 --model <provider/model> --prompt "hello" fails the same way with Unrecognized flag: --model.
opencode2 mini and opencode2 run both accept --agent and --model.
The root (full-screen TUI) command currently defines only --continue, --session and --prompt, plus the server and permission flags, so you can't choose the agent or model at launch without switching to mini or run. I've passed this on to the maintainers.
+1 with one more use case: relaunching on an existing session with a different model. A desktop wrapper that runs OpenCode in terminal panes restarts it as opencode -s <id> --model <provider/model> when the user switches model or provider, keeping the conversation. On v2 this works today with opencode mini -s <id> --model … (verified on 2.0.24), but the full-screen interface rejects --model, so the only option is to drop to mini. Supporting --model (and --agent) on the root command together with -s would cover it — #48163 looks like the right shape for --model. Context: #53806.
Activity
github-actions commentedon Oct 7, 2026
This issue doesn’t fully meet our contributing guidelines.
What needs to be fixed:
Please edit this issue to address the above within 72 hours, or it will be automatically closed.
This issue might be a duplicate of an existing issue. Please check:
--modelis silently ignored on the default (TUI) entry path: an unresolvable id runs the configured default model with no warning #47172: Covers--modelhandling on the default TUI entry path; this report concerns the v2 root command rejecting the option outright.If you believe this was flagged incorrectly, please let a maintainer know.
opencode-agent commentedon Oct 7, 2026
Thanks for the detailed report. I can reproduce this on v2.0.20:
opencode2 --agent build --prompt "hello"fails withUnrecognized flag: --agent in command opencode.opencode2 --model <provider/model> --prompt "hello"fails the same way withUnrecognized flag: --model.opencode2 miniandopencode2 runboth accept--agentand--model.The root (full-screen TUI) command currently defines only
--continue,--sessionand--prompt, plus the server and permission flags, so you can't choose the agent or model at launch without switching tominiorrun. I've passed this on to the maintainers.glmn commentedon Oct 7, 2026
+1 with one more use case: relaunching on an existing session with a different model. A desktop wrapper that runs OpenCode in terminal panes restarts it as
opencode -s <id> --model <provider/model>when the user switches model or provider, keeping the conversation. On v2 this works today withopencode mini -s <id> --model …(verified on 2.0.24), but the full-screen interface rejects--model, so the only option is to drop tomini. Supporting--model(and--agent) on the root command together with-swould cover it — #48163 looks like the right shape for--model. Context: #53806.github-actions commentedon Oct 10, 2026
This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 72-hour window.
Feel free to open a new issue that follows our issue templates.