Skip to content

Persist default OpenCode model and agent settings#59

Open
JohnnyVicious wants to merge 1 commit intomainfrom
issue-20-defaults
Open

Persist default OpenCode model and agent settings#59
JohnnyVicious wants to merge 1 commit intomainfrom
issue-20-defaults

Conversation

@JohnnyVicious
Copy link
Copy Markdown
Owner

Summary

  • add /opencode:setup --default-model <provider/model|off> and --default-agent <build|plan|off> backed by state.config.defaults
  • apply the saved default model to review, adversarial-review, and rescue/task when no --model or --free flag is supplied
  • apply the saved default agent to rescue/task when no --agent flag is supplied; review commands continue using the bundled read-only review agent to preserve current review behavior
  • update README, slash-command docs, rescue agent/runtime docs, setup rendering, and safe-command forwarding

Closes #20.

Test plan

  • npm test (182 passing)
  • git diff --check
  • node --check plugins/opencode/scripts/opencode-companion.mjs
  • node --check plugins/opencode/scripts/lib/defaults.mjs
  • node --check plugins/opencode/scripts/safe-command.mjs

@JohnnyVicious JohnnyVicious requested a review from Copilot April 13, 2026 08:06
@JohnnyVicious
Copy link
Copy Markdown
Owner Author

@codex review this PR

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 under state.config.defaults.
  • Applies saved default model to review, adversarial-review, and task when neither --model nor --free is provided; applies saved default agent to task when --agent is 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.

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.

Feature: persist default model/agent via /opencode:setup

2 participants