You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: allow multiple shell setups and allow switching them at runtime via TUI command #4683
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
I'm using PowerShell on Windows and recently switched from Claude Code. While there are couple smaller bugs opencode works mostly fine and is definitely usable on Windows now.
However shell setup feels a bit messy. There is $SHELL env variable which seems to be respected by both Shell mode (!) and bash tool, but opencode defaults on Windows do not work well - cmd.exe is picked up for the bash tool and Shell mode doesn't seem to work.
Claude code solved it by using git bash path and it works great in most of the cases. The only problem with their approach I had is that long running processes via bash.exe (for ex. local http server npx serve) get orphaned, the cli can not terminate them, even when the cli gets closed. I confirm opencode behaves the same if I do $env:SHELL="C:\Program Files\Git\bin\bash.exe"; opencode.
I propose something like this:
config
{
"$schema": "https://opencode.ai/config.json",
"shell": {
// set the default"default": "cmd",
"cmd": {
"path": "{env:ComSpec}",
// optionally let llm know what shell is used (or make it possible via plugin hooks)"prompt": "you are running in cmd.exe Windows environment. you must follow the Windows cmd syntax"
},
"bash": {
"path": "C:\\Program Files\\Git\\bin\\bash.exe"
},
"pwsh": {
"path": "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
// optional"args": "-NoLogo -NoProfile",
// optional"enabled": false
}
}
}
allow switching shell at runtime with /shell command or something similar
win32: use cmd (env:ComSpec) as the default but recommend to setup git bash (C:\Program Files\Git\bin\bash.exe) in docs as CC does
Concerns:
Most of LLMs try to use shell syntax, is it possible to add the shell information to system prompt based on the shell? However workaround for this can be also configured in instructions separately by user.
Different shells might behave differently when it comes to stdout/exit codes. I would cover bash, cmd and pwsh with tests and let end users know the rest is not officially supported (for win32).
The orphaned bash.exe is really annoying, I'm not sure what's the problem here for both CC and opencode.
Yeah im gonna make windows better, there are some easy wins to do here that i can prolly do today as far as making it configurable in your opencode.json that may be a separate followup item.
Another idea here: present multiple shell/bash tools to the model, and let it pick when to use which one.
e.g. In my usage of opencode, I set the $SHELL env var to a custom script that runs in a docker container with a readonly view of my fs, so that I can set "bash": "allow" permissions and not have to approve all the random stuff the model wants to run. But, a big downside of this is the model can't run anything on my macos host machine (which I would gate with "bash": "ask"), like running xcodebuild to build my ios code, or fix weird environment issures, or whatever.
So maybe it'd open up some interesting use cases to support multiple shell tools (with appropriate descriptions for each: #4866).
Another idea here: present multiple shell/bash tools to the model, and let it pick when to use which one.
e.g. In my usage of opencode, I set the $SHELL env var to a custom script that runs in a docker container with a readonly view of my fs, so that I can set "bash": "allow" permissions and not have to approve all the random stuff the model wants to run. But, a big downside of this is the model can't run anything on my macos host machine (which I would gate with "bash": "ask"), like running xcodebuild to build my ios code, or fix weird environment issures, or whatever.
So maybe it'd open up some interesting use cases to support multiple shell tools (with appropriate descriptions for each: #4866).
@jdanbrown this is a cool idea, I think it'd be pretty easy to make your custom script be its own custom tool, and put instructions in the Agents.md file to use your custom tool for code-related commands, and bash for system-scope commands. That way you could put allow on your custom tool but ask on the bash tool.
Edit: I'd personally like to see that custom script, sounds pretty cool.
@joeskeen Here it is! It's pretty specific to my own dev needs (python, swift, fly, etc), but it's pretty small and simple so if you wanted to fork it into something that works for you then it should be pretty easy:
Activity
github-actions commentedon Nov 24, 2025
This issue might be a duplicate of or related to existing issues. Please check:
!) is broken on Windows Powershell #4671: Shell mode (!) is broken on Windows PowershellFeel free to ignore if none of these address your specific case.
nikitakot commentedon Nov 24, 2025
this is similar to #3228
but my request addresses windows problems
rekram1-node commentedon Nov 24, 2025
Yeah im gonna make windows better, there are some easy wins to do here that i can prolly do today as far as making it configurable in your opencode.json that may be a separate followup item.
nikitakot commentedon Nov 24, 2025
@rekram1-node btw can confirm CC doesn't have the orphaned bash.exe problem anymore, just tried, so it's def possible to fix properly
jdanbrown commentedon Dec 3, 2025
Another idea here: present multiple shell/bash tools to the model, and let it pick when to use which one.
e.g. In my usage of opencode, I set the
$SHELLenv var to a custom script that runs in a docker container with a readonly view of my fs, so that I can set"bash": "allow"permissions and not have to approve all the random stuff the model wants to run. But, a big downside of this is the model can't run anything on my macos host machine (which I would gate with"bash": "ask"), like runningxcodebuildto build my ios code, or fix weird environment issures, or whatever.So maybe it'd open up some interesting use cases to support multiple shell tools (with appropriate descriptions for each: #4866).
joeskeen commentedon Mar 5, 2026
@jdanbrown this is a cool idea, I think it'd be pretty easy to make your custom script be its own custom tool, and put instructions in the Agents.md file to use your custom tool for code-related commands, and bash for system-scope commands. That way you could put allow on your custom tool but ask on the bash tool.
Edit: I'd personally like to see that custom script, sounds pretty cool.
jdanbrown commentedon Mar 5, 2026
@joeskeen Here it is! It's pretty specific to my own dev needs (python, swift, fly, etc), but it's pretty small and simple so if you wanted to fork it into something that works for you then it should be pretty easy:
github-actions commentedon Jul 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.