Add List Tool Back to Stop Unwanted Grep/Find Usage #4026

Open
opened 2026-02-16 17:42:20 -05:00 by yindo · 2 comments
Owner

Originally created by @heimoshuiyu on GitHub (Dec 31, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

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 f397c92ddf

OpenCode version

v1.0.218

Steps to reproduce

  1. cd to opencode source code
  2. start opencode v1.0.218
  3. ask explain this project to trigger opencode using ls to explore the project
  4. ask explain /compact command (or explain other things), opencode will trigger a lots of grep

Screenshot and/or share link

explain this project

Image

after that, explain /compact command

Image

After adding the List tool back

explain this project

Image

explain /compact command use Grep tool correctly

Image

Operating System

linux

Terminal

Alacritty

Originally created by @heimoshuiyu on GitHub (Dec 31, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description 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 f397c92ddfb09a6eee1e84563547b833f62af6c8 ### OpenCode version v1.0.218 ### Steps to reproduce 1. cd to `opencode` source code 2. start opencode v1.0.218 3. ask `explain this project` to trigger opencode using `ls` to explore the project 4. ask `explain /compact command` (or explain other things), opencode will trigger a lots of `grep` ### Screenshot and/or share link explain this project <img width="794" height="787" alt="Image" src="https://github.com/user-attachments/assets/7ba6ed48-fc0a-48e0-ba04-509a86488456" /> after that, `explain /compact command` <img width="816" height="875" alt="Image" src="https://github.com/user-attachments/assets/a45133ad-1a4c-4b3c-8f10-953268c83f75" /> --- **After adding the `List` tool back** `explain this project` <img width="815" height="901" alt="Image" src="https://github.com/user-attachments/assets/cb13107e-6339-4a81-89d5-a63b39d58020" /> `explain /compact command` use `Grep` tool correctly <img width="815" height="901" alt="Image" src="https://github.com/user-attachments/assets/a63ca909-d7ce-4554-800d-07ce3a457c9b" /> ### Operating System linux ### Terminal Alacritty
yindo added the bug label 2026-02-16 17:42:20 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 31, 2025):

This issue might be a duplicate of or related to existing issues. Please check:

  • #5715: "The problem of overly long bash description" - Related to bash tool description issues that may prevent models from using tools properly
  • #2541: "Make the directory listing limit configurable in the system prompt" - Related to directory listing context that affects tool behavior
  • #4483: "[BUG]: Subagents inappropriately inherit main agent instructions from CLAUDE.md/AGENTS.md" - Related to system prompt instruction leakage that may interfere with tool selection

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.

@github-actions[bot] commented on GitHub (Dec 31, 2025): This issue might be a duplicate of or related to existing issues. Please check: - #5715: "The problem of overly long bash description" - Related to bash tool description issues that may prevent models from using tools properly - #2541: "Make the directory listing limit configurable in the system prompt" - Related to directory listing context that affects tool behavior - #4483: "[BUG]: Subagents inappropriately inherit main agent instructions from CLAUDE.md/AGENTS.md" - Related to system prompt instruction leakage that may interfere with tool selection 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.
Author
Owner

@ry2009 commented on GitHub (Jan 2, 2026):

https://github.com/sst/opencode/pull/6675 put it back here with test to not remove list in later pr's

@ry2009 commented on GitHub (Jan 2, 2026): https://github.com/sst/opencode/pull/6675 put it back here with test to not remove list in later pr's
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4026