Skip to content

Conversation

@ariane-emory
Copy link
Contributor

@ariane-emory ariane-emory commented Nov 30, 2025

Resolves #4866

This PR adjusts the tool description of the Bash tool dynamically so that it advises the model what shell the command it's going to run will actually be run in.

I've played with this for a couple of days, and it does seem to significantly reduce the likely hood of the what I'll call 'the usual shell rediscovery' loop which can happen if you're running opencode in a non-bash shell such as fish:

The usual shell rediscovery loop proceeds as follows:

  1. The model will initially try to run a command with bash syntax, this will fail because we're actually running under fish.
  2. Deducing that we are running under fish from the error message, the model will proceed to re-run the command using fish syntax, which will succeed.
  3. The same thing will happen again on your next new session, because a model can't remember having discovered that it is running in a non-bash shell during a prior session

Benefits

  • Fewer requests to the provider needed, saving on both inference time and token costs (or usage limit caps in e.g., Claude or z.ai plans).
  • Fewer failed Bash tools containing errors cluttering up the model's context.

@ariane-emory ariane-emory changed the title feat: tool description of the Bash tool now advises model what shell it's actually in (resolves #4866) feat: tool description of the Bash tool now advises model as to what shell it's actually in (resolves #4866) Nov 30, 2025
@ariane-emory ariane-emory changed the title feat: tool description of the Bash tool now advises model as to what shell it's actually in (resolves #4866) feat: tool description of the Bash tool now advises model as to what the actual shell is (resolves #4866) Nov 30, 2025
@ariane-emory ariane-emory marked this pull request as draft November 30, 2025 08:48
@ariane-emory ariane-emory marked this pull request as ready for review November 30, 2025 08:50
@ariane-emory ariane-emory changed the title feat: tool description of the Bash tool now advises model as to what the actual shell is (resolves #4866) feat: tool description for the Bash tool now advises model as to what the actual shell is (resolves #4866) Dec 3, 2025
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]: Inform the model what shell it's running inside of in Bash tool's description

2 participants