Skip to content

Explore subagent should prefer dedicated read/search tools over Bash #37177

Description

@sflandergan

Description

The native Explore subagent sometimes uses Bash commands such as ls and rg for basic repository exploration even though the dedicated list, glob, grep, and read tools are available and allowed.

This creates unnecessary approval prompts for users who deliberately configure Bash as ask while allowing read-only tools.

Reproduction

Using OpenCode 1.17.20, configure:

{
  "permission": {
    "bash": {
      "*": "ask"
    },
    "read": {
      "*": "allow"
    }
  },
  "agent": {
    "explore": {
      "model": "opencode-go/mimo-v2.5"
    }
  }
}

Delegate repository investigation to the native Explore agent. During ordinary file discovery and content search, Explore may invoke shell ls and rg, requiring manual approval.

Expected behavior

For ordinary read-only exploration, the native Explore agent should prefer:

  • list or glob instead of shell ls
  • grep instead of shell rg
  • read instead of shell readers

Bash should remain available for operations that genuinely require a shell, subject to the configured Bash permission. Users should not need to grant unrestricted Bash access merely to avoid prompts during file search.

Permission context

This is not caused by parent allow rules failing to propagate. deriveSubagentSessionPermission intentionally carries only parent deny and external_directory rules. The approval occurs because Explore chooses the Bash tool, which is independently subject to the configured Bash policy.

The native Explore definition already allows the dedicated read/search tools. Updating PROMPT_EXPLORE to explicitly prefer them and avoid Bash for listing, searching, and reading files would likely address the issue without weakening permissions.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions