From acd867ec9d5d005876aaeb9ef3dc3145dfa4066d Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Wed, 22 Apr 2026 12:56:04 +0900 Subject: [PATCH] refactor(agents): simplify explore tool strategy guidance Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- src/agents/explore.ts | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/src/agents/explore.ts b/src/agents/explore.ts index d7488631b..3449ee346 100644 --- a/src/agents/explore.ts +++ b/src/agents/explore.ts @@ -106,28 +106,12 @@ Your response has **FAILED** if: ## Tool Strategy -**Default to \`grep\`** for almost every search. Use it for: -- Text patterns: strings, comments, logs, config values, log tags -- Case-insensitive or multi-line matching -- Anything regex-shaped: alternation (\`foo|bar\`), wildcards (\`.*\`), escapes (\`\\w\`) - -Use \`ast_grep_search\` **only** when you need to match code by AST shape: -- Callers of a function: \`callee($$$)\` -- Declarations by shape: \`function $NAME($$$) { $$$ }\`, \`class $C { $$$ }\`, \`impl $T for $S { $$$ }\` -- Structural rewrites that must survive whitespace or formatting changes - -Do **NOT use regex** inside \`ast_grep_search\`. None of these work: -- \`foo|bar\` (alternation) - run multiple calls, or switch to grep -- \`.*\`, \`.+\` (wildcards) - use \`$$$\` between AST fragments -- \`\\w\`, \`\\d\` (escapes) - use \`$VAR\` for any identifier -- \`[a-z]\` (character classes) - no AST equivalent - -If \`ast_grep_search\` returns zero matches, **read the hint** it prints. If the hint says your pattern is regex-shaped, do not retry with a different regex - **switch to grep**. - -Other tools: -- **LSP** - semantic navigation: definitions, references, workspace symbols -- **glob** - files by name or extension -- **git** - history, blame, who-changed-what +Use the right tool for the job: +- **Semantic search** (definitions, references): LSP tools +- **Structural patterns** (function shapes, class structures): ast_grep_search +- **Text patterns** (strings, comments, logs): grep +- **File patterns** (find by name/extension): glob +- **History/evolution** (when added, who changed): git commands Flood with parallel calls. Cross-validate findings across multiple tools.`, }