Repository navigation
feat: add a default agent setting for new chats and sessions - #47
Closed
YunFeng0817 wants to merge 1 commit into
Closed
YunFeng0817 wants to merge 1 commit into
YunFeng0817 wants to merge 1 commit into
Conversation
YunFeng0817
force-pushed
the
feat/chat-default-agent
branch
from
October 26, 2026 22:44
35b2bf7 to
8572320
Compare
New chats and sessions always started with the Build agent, so anyone who works with a custom primary agent from opencode.json, or in Plan, had to reselect it every time. varro.chat.defaultAgent names the primary agent those surfaces start with. An empty value keeps the current behaviour: Build, or the first primary agent when no Build is configured. An unknown, removed, hidden, or subagent name is ignored, so a typo cannot leave the picker on something that is not selectable. New drafts used to restore the stored agent selection. 98be168 replaced that with a Build default, and the tests it added ("defaults fresh drafts to build even when ask was persisted") are the only record of why; its consolidated message does not mention agents. The likely reason is read-only agents: Plan, or the built-in Ask agent, which denies editing tools, so a restored selection can silently make a new chat read-only. This change keeps that Build default and makes a different starting agent an explicit, application-scoped choice, so nothing changes for anyone who does not opt in. The setting is application scoped. An OpenCode agent determines its own permissions, and a repository already influences agent definitions through opencode.json, so a checked-in settings.json should not decide which agent runs the chat.
YunFeng0817
force-pushed
the
feat/chat-default-agent
branch
from
October 26, 2026 22:45
8572320 to
5885b72
Compare
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.
Why
I use a custom primary agent defined in
opencode.json, and it is the agent I want for essentially every chat. Varro starts each new chat and session with Build, so I re-select my agent every single time. Models and per-session choices are already remembered; the agent for new chats is not.This adds a setting for it.
varro.chat.defaultAgentnames the primary agent that new chats and sessions start with, so a custom agent can simply be the default.What it does
A session's own agent and an explicit pick in the composer still win where they did before, so nothing about existing sessions changes.
Relationship to the existing Build default
New drafts used to restore the stored agent selection.
98be1681replaced that with a Build default and added tests for it (defaults fresh drafts to build even when ask was persisted); its consolidated message does not mention agents, so the test names are the only record of the intent.The likely reason is read-only agents: Plan, and the built-in Ask agent, which denies editing tools. A restored selection can therefore make a new chat read-only without anyone asking for it.
This PR does not restore the old behaviour. It keeps Build as the default and adds an explicit way to name a different starting agent, so nothing changes unless you opt in.
Why application scope
An agent determines its own permissions and prompt, and a repository can already influence agent definitions through
opencode.json. A checked-insettings.jsonshould not also decide which agent runs your chat, so the setting followspromptCompletionModelandfollowupsEnabledrather than the window-scopeddefaultPermissionMode.Implementation notes
reconcileLoadedAgentstakes a newdefaultAgentargument; an empty string falls through the existing candidate predicate untouched, which is why the default path is behaviour-identical.startNewChatDraft,resolveDefaultAgent) insert the configured name ahead of Build and keep their existing chains behind it.ExtensionConfigState,readExtensionConfigState, webview initial state,config/updateparsing, app state, and the config-change listener.docs/usage.mdlists the setting under Chat view.Testing
npm run test- 411 files, 10835 tests passnpm run typecheckandnpm run typecheck:suggestionsnpm run lint,npm run fmt