Skip to content

Conversation

@elithrar
Copy link
Contributor

@elithrar elithrar commented Dec 20, 2025

This PR supports defining a default_agent in opencode config (TUI, CLI, desktop, GitHub) so that opencode uses that from the outset. It also expands existing cases where users can provide an --agent flag to warn if their specified agent isn't found and fall back to "build" (existing behaviour, just not explicit to a user).

Changes

  • adds default_agent field to config schema (Config.Info)
  • adds default field to Agent.Info schema so clients (TUI, desktop) know which agent is the default
  • adds Agent.defaultAgent() helper that resolves the configured default agent
  • updates all hardcoded "build" fallbacks to use Agent.defaultAgent()
  • updates TUI to select the default agent on initialization (was just picking first agent)
  • adds agent input to GitHub Action for per-workflow override
  • updates documentation for config and GitHub Action
  • regenerates SDK types

Validation

  • only primary agents can be set as the default (not subagents like explore)
  • can be a built-in agent (build, plan) or a custom agent defined in config
  • invalid/missing agents log a warning: default agent "{name}" not found. Falling back to "build"

Usage

{
  "$schema": "https://opencode.ai/config.json",
  "default_agent": "plan"
}
# GitHub Action
- uses: sst/opencode/github@latest
  with:
    model: anthropic/claude-sonnet-4-20250514
    agent: docs  # overrides the config default

- Add 'default' field to Agent.Info schema
- Mark the default agent when building agent list in state()
- Simplify Agent.defaultAgent() to use the default flag
- Update TUI to select default agent on initialization
- Regenerate SDK types
@elithrar
Copy link
Contributor Author

works in the TUI (default_agent: "triage")

image

@elithrar
Copy link
Contributor Author

somehow I missed #5313 - I think I’ve implicitly superseded that PR here though as I covered all API surfaces (incl. github)

@rekram1-node rekram1-node merged commit 21bee38 into anomalyco:dev Dec 20, 2025
2 checks passed
rekram1-node pushed a commit that referenced this pull request Dec 20, 2025
#5843)

Co-authored-by: observerw <observerw@users.noreply.github.com>
@elithrar elithrar deleted the support-default-agent branch December 20, 2025 18:00
@observerw
Copy link
Contributor

sweet!

rekram1-node pushed a commit that referenced this pull request Dec 27, 2025
#5843)

Co-authored-by: observerw <observerw@users.noreply.github.com>
shuv1337 added a commit to Latitudes-Dev/shuvcode that referenced this pull request Jan 4, 2026
Look for agent with default:true instead of always using first agent.
This aligns with upstream fix (anomalyco#5843).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants