Skip to content

Add opencode model variant customization - #739

Open
nhojb wants to merge 2 commits into
xenodium:mainfrom
nhojb:f/opencode-model-variant
Open

Add opencode model variant customization#739
nhojb wants to merge 2 commits into
xenodium:mainfrom
nhojb:f/opencode-model-variant

Conversation

@nhojb

@nhojb nhojb commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Opencode does not currently support setting a persistent model variant via the opencode config json - or at least it does not work when running via acp. So this PR adds:

  1. Support for setting the default-thought-level-id via agent-shell-make-agent-config
  2. A new agent-shell-opencode-default-model-variant defcustom

Note: if the variant is not supported by the current model, then the user will see an error when loading the session

Screenshot 2026-07-29 at 14 07 13 Screenshot 2026-07-29 at 13 52 40

Checklist

  • I agree to communicate (PR description and comments) with the author myself (not AI-generated).
  • I've reviewed all code in PR myself and will vouch for its quality.
  • I've read and followed the Contributing guidelines.
  • I've filed a feature request/discussion for a new feature.
  • I'm making visual changes, so I'm including screenshots so you can view and discuss.
  • I've added tests where applicable.
  • I've updated documentation where necessary.
  • I've run M-x checkdoc and M-x byte-compile-file.

@xenodium

xenodium commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Thanks for the PR!

I'm wondering if you'd be keen to steer the PR towards a more generic mechanism? Instead of adding agent-shell-opencode-default-model-variant, we add something like:

(defcustom agent-shell-opencode-default-config-options
  '(("model"         . "anthropic/claude-opus-4-5")
    ("thought_level" . "high")
    ("mode"          . "plan"))
  "Default OpenCode config options, applied at session start.
Keys are config-option categories advertised by the agent; see
the \"Available config options\" section in your shell."
  :type '(alist :key-type string :value-type string))

I know we haven't done this before in project, but it would enable us to set precedence for moving towards a more scalable mechanism for users to set whatever option is supported by their agent without requiring additional agent-shell changes.

To support this path, I've just submitted 95c700a which enables users to know exactly what is and isn't supported by their agents.

image

@nhojb
nhojb force-pushed the f/opencode-model-variant branch from cab379d to e2c31cf Compare August 3, 2026 14:23
@nhojb

nhojb commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

I'm wondering if you'd be keen to steer the PR towards a more generic mechanism?

Sounds good to me. I will also mark the old agent-shell-opencode-default-model-id as deprecated and fallback if the new config does not exist.

christian-smith pushed a commit to christian-smith/agent-shell that referenced this pull request Aug 4, 2026
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.

2 participants