Skip to content

cli: restore --agent (and --model) on the full-screen TUI in v2 #53728

Closed as not planned

Description

@eamonnotoole

Summary

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)
  • OS: Darwin 25.6.0 (arm64)
  • Terminal: TERM=xterm-256color, COLORTERM=truecolor
  • Shell: /bin/zsh
  • Install/channel: Homebrew, latest

Reproduction

  1. Define two primary agents in .opencode/agents/ (e.g. plan and build) with default_agent: plan.
  2. Run opencode --agent build --prompt "hello".
  3. 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.
  • Possibly related: tui: default_agent is ignored on startup in V2 #37225 (default_agent ignored on startup in V2) — if default_agent is unreliable, the launch flag matters even more.

Activity

  1. github-actions commented on Oct 7, 2026

    @github-actions
    Contributor

    This issue doesn’t fully meet our contributing guidelines.

    What needs to be fixed:

    • 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:

    If you believe this was flagged incorrectly, please let a maintainer know.

  2. opencode-agent commented on Oct 7, 2026

    @opencode-agent
    Contributor

    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.

  3. glmn commented on Oct 7, 2026

    @glmn

    +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.

  4. github-actions commented on Oct 10, 2026

    @github-actions
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions