From df61aa801b97eb6b73a5dd3bf8a1e6e4644c15da Mon Sep 17 00:00:00 2001 From: Kenn Costales Date: Sun, 14 Sep 2025 21:53:50 +0800 Subject: [PATCH] fix: fix wrong tool references `LS` and `Agent` (#2466) --- packages/opencode/src/tool/bash.txt | 6 +++--- packages/opencode/src/tool/glob.txt | 2 +- packages/opencode/src/tool/grep.txt | 2 +- packages/opencode/src/tool/task.txt | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/opencode/src/tool/bash.txt b/packages/opencode/src/tool/bash.txt index 342073b9b..67c54677f 100644 --- a/packages/opencode/src/tool/bash.txt +++ b/packages/opencode/src/tool/bash.txt @@ -3,8 +3,8 @@ Executes a given bash command in a persistent shell session with optional timeou Before executing the command, please follow these steps: 1. Directory Verification: - - If the command will create new directories or files, first use the LS tool to verify the parent directory exists and is the correct location - - For example, before running "mkdir foo/bar", first use LS to check that "foo" exists and is the intended parent directory + - If the command will create new directories or files, first use the List tool to verify the parent directory exists and is the correct location + - For example, before running "mkdir foo/bar", first use List to check that "foo" exists and is the intended parent directory 2. Command Execution: - Always quote file paths that contain spaces with double quotes (e.g., cd "path with spaces/file.txt") @@ -21,7 +21,7 @@ Usage notes: - You can specify an optional timeout in milliseconds (up to 600000ms / 10 minutes). If not specified, commands will timeout after 120000ms (2 minutes). - It is very helpful if you write a clear, concise description of what this command does in 5-10 words. - If the output exceeds 30000 characters, output will be truncated before being returned to you. - - VERY IMPORTANT: You MUST avoid using search commands like `find` and `grep`. Instead use Grep, Glob, or Task to search. You MUST avoid read tools like `cat`, `head`, `tail`, and `ls`, and use Read and LS to read files. + - VERY IMPORTANT: You MUST avoid using search commands like `find` and `grep`. Instead use Grep, Glob, or Task to search. You MUST avoid read tools like `cat`, `head`, `tail`, and `ls`, and use Read and List to read files. - If you _still_ need to run `grep`, STOP. ALWAYS USE ripgrep at `rg` (or /usr/bin/rg) first, which all opencode users have pre-installed. - When issuing multiple commands, use the ';' or '&&' operator to separate them. DO NOT use newlines (newlines are ok in quoted strings). - Try to maintain your current working directory throughout the session by using absolute paths and avoiding usage of `cd`. You may use `cd` if the User explicitly requests it. diff --git a/packages/opencode/src/tool/glob.txt b/packages/opencode/src/tool/glob.txt index 3873a4761..2cf16a05f 100644 --- a/packages/opencode/src/tool/glob.txt +++ b/packages/opencode/src/tool/glob.txt @@ -2,5 +2,5 @@ - Supports glob patterns like "**/*.js" or "src/**/*.ts" - Returns matching file paths sorted by modification time - Use this tool when you need to find files by name patterns -- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead +- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Task tool instead - You have the capability to call multiple tools in a single response. It is always better to speculatively perform multiple searches as a batch that are potentially useful. diff --git a/packages/opencode/src/tool/grep.txt b/packages/opencode/src/tool/grep.txt index 3caef001a..d964a3d1f 100644 --- a/packages/opencode/src/tool/grep.txt +++ b/packages/opencode/src/tool/grep.txt @@ -5,4 +5,4 @@ - Returns file paths with at least one match sorted by modification time - Use this tool when you need to find files containing specific patterns - If you need to identify/count the number of matches within files, use the Bash tool with `rg` (ripgrep) directly. Do NOT use `grep`. -- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead +- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Task tool instead diff --git a/packages/opencode/src/tool/task.txt b/packages/opencode/src/tool/task.txt index 27e7bc5de..2be3819f0 100644 --- a/packages/opencode/src/tool/task.txt +++ b/packages/opencode/src/tool/task.txt @@ -5,13 +5,13 @@ Available agent types and the tools they have access to: When using the Task tool, you must specify a subagent_type parameter to select which agent type to use. -When to use the Agent tool: -- When you are instructed to execute custom slash commands. Use the Agent tool with the slash command invocation as the entire prompt. The slash command can take arguments. For example: Task(description="Check the file", prompt="/check-file path/to/file.py") +When to use the Task tool: +- When you are instructed to execute custom slash commands. Use the Task tool with the slash command invocation as the entire prompt. The slash command can take arguments. For example: Task(description="Check the file", prompt="/check-file path/to/file.py") -When NOT to use the Agent tool: -- If you want to read a specific file path, use the Read or Glob tool instead of the Agent tool, to find the match more quickly +When NOT to use the Task tool: +- If you want to read a specific file path, use the Read or Glob tool instead of the Task tool, to find the match more quickly - If you are searching for a specific class definition like "class Foo", use the Glob tool instead, to find the match more quickly -- If you are searching for code within a specific file or set of 2-3 files, use the Read tool instead of the Agent tool, to find the match more quickly +- If you are searching for code within a specific file or set of 2-3 files, use the Read tool instead of the Task tool, to find the match more quickly - Other tasks that are not related to the agent descriptions above