Persist default OpenCode model and agent settings#59
Open
JohnnyVicious wants to merge 1 commit intomainfrom
Open
Persist default OpenCode model and agent settings#59JohnnyVicious wants to merge 1 commit intomainfrom
JohnnyVicious wants to merge 1 commit intomainfrom
Conversation
Owner
Author
|
@codex review this PR |
There was a problem hiding this comment.
Pull request overview
Adds persisted, user-configurable defaults for OpenCode model and rescue agent selection via /opencode:setup, and applies those defaults across companion commands when corresponding runtime flags are omitted.
Changes:
- Introduces
/opencode:setup --default-model <provider/model|off>and--default-agent <build|plan|off>persisted understate.config.defaults. - Applies saved default model to
review,adversarial-review, andtaskwhen neither--modelnor--freeis provided; applies saved default agent totaskwhen--agentis omitted. - Updates setup rendering and documentation, and adds a focused unit test suite for the defaulting/precedence behavior.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/render.test.mjs | Extends setup rendering test expectations to include persisted defaults. |
| tests/defaults.test.mjs | Adds coverage for default normalization, parsing, and precedence resolution helpers. |
| tests/companion-cli.test.mjs | Verifies defaults persistence/clearing and safe-command forwarding for setup defaults. |
| README.md | Documents new setup flags and explains when defaults apply. |
| plugins/opencode/skills/opencode-runtime/SKILL.md | Updates runtime guidance to reflect companion-applied defaults when flags are omitted. |
| plugins/opencode/scripts/safe-command.mjs | Allows --default-model / --default-agent to be forwarded for setup. |
| plugins/opencode/scripts/opencode-companion.mjs | Implements persisted defaults reading/writing and applies defaults to model/agent selection logic. |
| plugins/opencode/scripts/lib/render.mjs | Renders default model/agent in setup output. |
| plugins/opencode/scripts/lib/defaults.mjs | Adds centralized helpers for defaults parsing/normalization and precedence rules. |
| plugins/opencode/commands/setup.md | Documents new setup flags and their effects. |
| plugins/opencode/commands/review.md | Clarifies --model overrides saved setup defaults. |
| plugins/opencode/commands/rescue.md | Clarifies runtime flags vs saved defaults for rescue/task. |
| plugins/opencode/commands/adversarial-review.md | Clarifies --model overrides saved setup defaults. |
| plugins/opencode/agents/opencode-rescue.md | Updates forwarding rules to mention companion-applied defaults. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
/opencode:setup --default-model <provider/model|off>and--default-agent <build|plan|off>backed bystate.config.defaults--modelor--freeflag is supplied--agentflag is supplied; review commands continue using the bundled read-only review agent to preserve current review behaviorCloses #20.
Test plan
npm test(182 passing)git diff --checknode --check plugins/opencode/scripts/opencode-companion.mjsnode --check plugins/opencode/scripts/lib/defaults.mjsnode --check plugins/opencode/scripts/safe-command.mjs