anomalyco / anomalyco/opencode

[FEATURE]: Add a "Set as default" action to /models to persist the current model

Open
#49,713 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Feature hasn't been suggested before.
  • I have verified this feature I'm about to request hasn't been suggested before. (searched: "set default model", "persist model", "save selected model", "remember model selection"; the closest matches, #11209 and #28110, are related but different — see Additional context)
Summary

The /models selection is session-scoped by design — the models guide states "The selection applies to the current session and does not change your configuration" and "Switching a session's model does not rewrite the config file". So when the configured default is model A and I switch to model B in the TUI, there is no first-class way to make B the default for future sessions — the only option is to hand-edit opencode.json(c).

Describe the enhancement

Add a quick, discoverable way to persist the current model selection as the default, for example:

  • A "Set as default" action in the /models dialog, and/or
  • A command-palette command (e.g. model.set_default) that can be keybound, writing the selected provider/model to the user's global opencode.json (global rather than project-level, so personal model preferences don't get committed to shared repos)
Current behavior
  1. Set "model": "provider/a" in the global opencode.json
  2. Start the TUI, press /models, select provider/b
  3. Work, then quit OpenCode
  4. Start OpenCode again — new sessions fall back to provider/a again (occasionally a session instead resumes the last-used model, see Additional context), and there is no built-in shortcut to make provider/b the default
Expected behavior

A supported way to persist the current model as the default without manually editing the config file.

Environment
  • opencode version: 2.0.7 (channel: latest)
  • OS: Windows 11 Home (build 26200)
  • Terminal: mintty (xterm-256color, truecolor)
  • Shell: Git Bash (usr/bin/bash.exe)
  • Active plugins: none configured
Additional context
  • This is an explicit, opt-in "write it to config" action, not automatic remembering. #28110 (per-agent model remembering in the desktop app) and #11209 (per-agent defaults in opencode.json) both aim to change which model is picked automatically; this request is about letting the user commit their current selection as the default at a moment of their choosing.
  • Observed locally: some new sessions start with the last-used model (different from the configured default), which suggests the TUI keeps internal per-agent model state (also referenced in #28110). Explicit "Set as default" semantics would make the precedence between the config default and the remembered selection predictable.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the /models dialog and the command-palette entry point, then read the linked models guide to confirm the current session-only behavior and configuration boundaries. Trace how the selected provider/model and global opencode.json are represented; done means an explicit action writes the selected model globally and a new session uses it without changing project configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, developer-experience
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.