Skip to content

[Tool] Add GlobTool - find files by glob pattern #232

Description

@omatheusmesmo

Motivation

The agent has listFiles which lists a single directory, but cannot find files by pattern across a project. Finding all Java files, locating test files, or discovering configuration files requires running find via ShellTool.

All three reference projects have a dedicated glob/file-finder tool.

What the tool should do

Find files matching a glob pattern (e.g. /*.java, src//tool/*.java).

Reference implementations

opencode (TypeScript)

  • Powered by ripgrep file discovery
  • Parameters: pattern (glob), path (directory), limit (default 100)

hermes-agent (Python)

  • Uses ripgrep (rg --files) when available, falls back to find
  • Parameters: pattern, path, target (content/files), file_glob, limit, offset

openclaw (TypeScript)

  • Uses fd (or custom glob operations)
  • Automatic fd download via ensureTool()
  • Respects .gitignore
  • Parameters: pattern (glob), path, limit (default 1000)

Requirements

  1. Glob pattern support - *, **, ?, character classes
  2. Path targeting - Search in specific directory (default: workspace root)
  3. Limit - Max number of results (default 500)
  4. Respect .gitignore - Skip ignored files
  5. Sorted output - Alphabetical order
  6. Workspace confinement - Must respect workspace root

Suggested location

client/runtime/src/main/java/dev/omatheusmesmo/qlawkus/tool/shell/GlobTool.java

Dependencies

  • fd (preferred) or fall back to Java NIO glob walking

Config properties

  • qlawkus.shell.glob.enabled (boolean, default true)
  • qlawkus.shell.glob.max-results (int, default 500)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttoolingTools and utilities

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions