opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat: switch mode tool

Open Leka74 opened this issue 1 month ago • 4 comments

What does this PR do?

Adds a new modeswitch tool which allows the LLM to request the mode to be changed. So instead of the user having to switch to the build mode manually and ask the LLM to continue with the implementation, the LLM will request that itself and if approved, it will start implementing the plan.

image image

How did you verify your code works?

Tested it locally through the TUI and Desktop app.

Closes https://github.com/anomalyco/opencode/issues/7627

Leka74 avatar Jan 10 '26 11:01 Leka74

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

github-actions[bot] avatar Jan 10 '26 11:01 github-actions[bot]

The following comment was made by an LLM, it may be inaccurate:

The searches show PR #7626 (the current PR) but no other duplicate or related PRs that are addressing the same "switch mode tool" feature.

No duplicate PRs found

github-actions[bot] avatar Jan 10 '26 11:01 github-actions[bot]

+1 for this - I currently have the model asking me if it should switch from plan to build mode, which I approve, but then it just implements the code changes in plan mode (I have a different model selected for build mode).

niallobrien avatar Jan 10 '26 19:01 niallobrien

+1

kdcokenny avatar Jan 11 '26 01:01 kdcokenny

I'm unsure if this would be the right way of going about it. I may be a little CC pilled but I feel like they nailed the entire plan mode thing where you get a plan, review it, accept/reject and it auto-switches on accept and I believe it should be a behavior that should be replicated in OC aswell. I believe a feature like this would come bundled in another PR with other plan mode improvements instead of being a standalone thing as I think there are gonna be a lot of things that would have to work together which this would kind of "lock down". Just my two cents on the topic though

KibbeWater avatar Jan 12 '26 07:01 KibbeWater

I'm unsure if this would be the right way of going about it. I may be a little CC pilled but I feel like they nailed the entire plan mode thing where you get a plan, review it, accept/reject and it auto-switches on accept and I believe it should be a behavior that should be replicated in OC aswell. I believe a feature like this would come bundled in another PR with other plan mode improvements instead of being a standalone thing as I think there are gonna be a lot of things that would have to work together which this would kind of "lock down". Just my two cents on the topic though

I'm thinking that something like this can already be done using plugins setting the tool to an "ask" mode

kdcokenny avatar Jan 12 '26 15:01 kdcokenny