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
Add List Tool Back to Stop Unwanted Grep/Find Usage #6506
I recently noticed that OpenCode often uses command-line (bash) tools like grep and find, specifically with the glm-4.7 model.
I tried modifying the descriptions of the bash and grep tools to emphasize avoiding command-line searches for files, but the model still doesn’t comply.
Using command-line tools frequently leads to issues like searching through node_modules or bundled JavaScript, which fills the context with garbage structures.
This tends to occur especially in long-context scenarios.
After some informal ablation experiments, I found that reintroducing the List tool alleviates this problem.
I suspect this is because the presence of the List tool encourages the model to use the provided tools for browsing the codebase. If the List tool is absent, the model resorts to using ls commands to explore the codebase. Once it starts doing this, the model seems to assume that shell-based exploration is the correct approach and ends up invoking a series of find and grep commands.
I’d also like to know why the List tool was removed from the registry. Perhaps we should consider adding it back. Commit is f397c92
OpenCode version
v1.0.218
Steps to reproduce
cd to opencode source code
start opencode v1.0.218
ask explain this project to trigger opencode using ls to explore the project
ask explain /compact command (or explain other things), opencode will trigger a lots of grep
Screenshot and/or share link
explain this project
after that, explain /compact command
After adding the List tool back
explain this project
explain /compact command use Grep tool correctly
Operating System
linux
Terminal
Alacritty
Reacted by Arsham Shirvani, Andrew Austin, Ishaan Mehta, Manuel Olguín Muñoz, Ph.D., LuncyBloont, zinga666, Andrey Grishchenko and Maciej
The core issue here is about how system prompts and tool descriptions influence model behavior. Issues #4483 and #5715 suggest that system prompt configuration and tool description size can prevent models from following instructions properly, which aligns with your observation that modifying tool descriptions doesn't reliably prevent bash/grep usage.
I was going to comment on the commit itself f397c92dd , but yeah this is still relevant.
I think some clarity on why the list tool was removed from the registry (packages/opencode/src/tool/registry.ts) is much appreciated. the docs and system prompts still mention that this builtin tool exists.
maybe I'm bad at this but I cannot tie the commit back to a pull request to read the rationale for this breaking change, and I could not find a deprecation notice or period.
some examples of system prompts in the repo:
1. packages/opencode/src/session/prompt/default.txt (line 42):
assistant: [use the ls tool to list the files in the current directory, then read docs/commands in the relevant file to find out how to watch files]
2. packages/opencode/src/session/prompt/trinity.txt (line 34):
assistant: [use the ls tool to list the files in the current directory, then read docs/commands in the relevant file to find out how to watch files]
3. packages/opencode/src/session/prompt/gemini.txt (line 77)
model: [tool_call: ls for path '/path/to/project']
I feel like it's relevant for me to say that I don't care one way or another if the tool needs to be removed. But the communication about this removal and workarounds is still needed even now.
Activity
github-actions commentedon Dec 31, 2025
This issue might be a duplicate of or related to existing issues. Please check:
The core issue here is about how system prompts and tool descriptions influence model behavior. Issues #4483 and #5715 suggest that system prompt configuration and tool description size can prevent models from following instructions properly, which aligns with your observation that modifying tool descriptions doesn't reliably prevent bash/grep usage.
remove list tool
ry2009 commentedon Jan 2, 2026
#6675 put it back here with test to not remove list in later pr's
thdxr commentedon Mar 25, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.
heimoshuiyu commentedon Mar 25, 2026
Yes still don't know why list tool getting removed
samerbahri98 commentedon Apr 7, 2026
I was going to comment on the commit itself f397c92dd , but yeah this is still relevant.
I think some clarity on why the list tool was removed from the registry (packages/opencode/src/tool/registry.ts) is much appreciated. the docs and system prompts still mention that this builtin tool exists.
maybe I'm bad at this but I cannot tie the commit back to a pull request to read the rationale for this breaking change, and I could not find a deprecation notice or period.
some examples of system prompts in the repo:
I feel like it's relevant for me to say that I don't care one way or another if the tool needs to be removed. But the communication about this removal and workarounds is still needed even now.
heimoshuiyu commentedon Apr 28, 2026
Wrote a very simple plugin https://github.com/heimoshuiyu/opencode-bash-guard-plugin to address this issue. Works well. Closing this issue.