feat(agent): add order field for configurable agent cycling order#19127
Open
kuitos wants to merge 3 commits intoanomalyco:devfrom
Open
feat(agent): add order field for configurable agent cycling order#19127kuitos wants to merge 3 commits intoanomalyco:devfrom
order field for configurable agent cycling order#19127kuitos wants to merge 3 commits intoanomalyco:devfrom
Conversation
Add an optional `order` field to the agent config schema that controls agent sorting in the Tab cycle. Agents with lower order values appear first. Agents without an explicit order fall back to alphabetical sorting, preserving backward compatibility. This allows plugins and users to control the exact ordering of agents in the Tab cycle without relying on name-based alphabetical sorting. Closes anomalyco#7372
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
kuitos
added a commit
to kuitos/oh-my-openagent
that referenced
this pull request
Mar 25, 2026
…cycling Inject an explicit `order` field (1-4) into the four core agents (Sisyphus, Hephaestus, Prometheus, Atlas) via reorderAgentsByPriority(). This pre-empts OpenCode's alphabetical agent sorting so the intended Tab cycle order is preserved once OpenCode merges order field support (anomalyco/opencode#19127). Refs anomalyco/opencode#7372
Author
|
@thdxr @rekram1-node Could you pls take a look at this PR when you have time? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #7372
Type of change
What does this PR do?
Adds an optional
orderfield to agent config so users/plugins can control Tab cycling order instead of being forced into alphabetical sort.Currently
Agent.list()sorts agents alphabetically by name (after default agent). This breaks plugins that define multiple agents with a specific intended order. For example, oh-my-opencode defines Sisyphus → Hephaestus → Prometheus → Atlas, but alphabetical sort produces Atlas → Hephaestus → Prometheus → Sisyphus.The fix adds
order: number(optional) to bothConfig.AgentandAgent.Info. Sorting becomes:orderascending (new) — agents withoutordergetInfinitynameascending (unchanged fallback)Fully backward compatible — configs without
orderbehave exactly as before.Changes:
packages/opencode/src/config/config.ts: AddordertoConfig.Agentschema +knownKeyspackages/opencode/src/agent/agent.ts: AddordertoAgent.Info, propagate from config, add tosortByHow did you verify your code works?
Tested locally with oh-my-opencode plugin — agents with
order1-4 now cycle in the correct order instead of alphabetically. Verified that agents withoutorderstill sort alphabetically as before.Screenshots / recordings
N/A — no UI changes, only sorting logic.
Checklist