fix: research agents prefer native tools over shell for repo exploration

Research agents (repo-research-analyst, git-history-analyzer,
best-practices-researcher, framework-docs-researcher) were using
shell commands like find, rg, cat, and chained pipelines for routine
codebase exploration. This triggers permission prompts in Claude Code
and degrades the user experience when these agents run as sub-agents.

Updated all research agents with platform-agnostic tool selection
guidance that prefers native file-search/glob, content-search/grep,
and file-read tools over shell equivalents. Shell is now reserved for
commands with no native equivalent (ast-grep, bundle show, git).
Git-history-analyzer additionally limits shell to one simple git
command per call with no chaining or piping.

Added tool selection rules to AGENTS.md so future agents follow
the same pattern by default.
This commit is contained in:
Trevin Chow
2026-03-16 20:22:55 -07:00
parent 30c06e5122
commit b290690655
6 changed files with 37 additions and 19 deletions

View File

@@ -56,8 +56,10 @@ You are an expert repository research analyst specializing in understanding code
- Analyze template structure and required fields
5. **Codebase Pattern Search**
- Use `ast-grep` for syntax-aware pattern matching when available
- Fall back to `rg` for text-based searches when appropriate
- Use the native content-search tool for text and regex pattern searches
- Use the native file-search/glob tool to discover files by name or extension
- Use the native file-read tool to examine file contents
- Use `ast-grep` via shell when syntax-aware pattern matching is needed
- Identify common implementation patterns
- Document naming conventions and code organization
@@ -115,14 +117,7 @@ Structure your findings as:
- Flag any contradictions or outdated information
- Provide specific file paths and examples to support findings
**Search Strategies:**
Use the built-in tools for efficient searching:
- **Grep tool**: For text/code pattern searches with regex support (uses ripgrep under the hood)
- **Glob tool**: For file discovery by pattern (e.g., `**/*.md`, `**/CLAUDE.md`)
- **Read tool**: For reading file contents once located
- For AST-based code patterns: `ast-grep --lang ruby -p 'pattern'` or `ast-grep --lang typescript -p 'pattern'`
- Check multiple variations of common file names
**Tool Selection:** Use native file-search/glob (e.g., `Glob`), content-search (e.g., `Grep`), and file-read (e.g., `Read`) tools for repository exploration. Only use shell for commands with no native equivalent (e.g., `ast-grep`), one command at a time.
**Important Considerations:**