feat: switch mode tool
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.
How did you verify your code works?
Tested it locally through the TUI and Desktop app.
Closes https://github.com/anomalyco/opencode/issues/7627
Thanks for your contribution!
This PR doesn't have a linked issue. All PRs must reference an existing issue.
Please:
- Open an issue describing the bug/feature (if one doesn't exist)
- Add
Fixes #<number>orCloses #<number>to this PR description
See CONTRIBUTING.md for details.
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
+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).
+1
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 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