Skip to content

[Refactor] Simplify rg tool permission: one tool = one permission #107

@randomm

Description

@randomm

Problem

The rg tool currently uses two different permission names internally:

  • "glob" permission for file listing mode (files_only: true)
  • "grep" permission for content search mode

This is confusing because:

  1. Naming collision: You might deny grep* in bash permissions, but must allow "grep" permission for the rg tool. Same word, different meanings.
  2. Hidden mapping: You have to read source code to know that calling rg requires "grep" permission. Not discoverable.
  3. Misleading names: There's no grep or glob tool. When you see "grep": "deny" in config, you'd think grep is denied — but actually it means content search via rg is denied.

Desired State

One tool = one permission.

// Before (confusing)
ctx.ask({ permission: params.files_only ? "glob" : "grep" })

// After (simple)
ctx.ask({ permission: "rg" })

Agent config becomes:

{
  "rg": "allow"
}

Requirements

  1. Change rg.ts to use single permission name "rg"
  2. Update any agent configs that reference "glob" or "grep" permissions
  3. Review and align the rg tool's system prompt so agents know how to use it correctly
  4. Update any documentation referencing the old permission names

Files

  • packages/opencode/src/tool/rg.ts — Permission check (~line 42-52)
  • Agent config files with permission mappings
  • Tool system prompts (if any exist for rg)

Acceptance Criteria

  • rg tool uses single "rg" permission
  • Agent configs updated
  • System prompt aligned with tool usage
  • No references to glob/grep as permission names for this tool

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions