home / skills / bdambrosio / cognitive_workbench / fs-find
This skill finds files by glob pattern under scenarios/<world_name>/fs and returns a structured collection of matching notes.
npx playbooks add skill bdambrosio/cognitive_workbench --skill fs-findReview the files below or copy the command above to add this skill to your agents.
---
name: fs-find
type: python
description: "Find files by filename pattern (glob) under scenarios/<world_name>/fs and return a Collection."
schema_hint: {"pattern": "string (glob pattern)", "path": "string (relative)", "recursive": "bool", "max_results": "int"}
---
# fs-find
Find files by filename pattern (glob) within the filesystem sandbox for the current world.
## Input
- `pattern`: Glob pattern for filename matching (required, e.g., "*.txt", "Nan_*", "*Ar*")
- `path`: Directory to search (default: "." root)
- `recursive`: Whether to search subdirectories (default: true)
- `max_results`: Maximum files to return (default: 200)
## Pattern Matching
- Uses shell-style glob patterns (via Python `fnmatch`)
- Matches against **filename only** (not full path)
- Common patterns:
- `"*.txt"` - all .txt files
- `"Nan_*"` - files starting with "Nan_"
- `"*Ar*"` - files containing "Ar"
- `"Nan_Ar.txt"` - exact filename match
**Note:** Pattern cannot contain path separators (`/` or `\`). Use the `path` parameter to search in specific directories.
## Output
Success returns:
- `resource_id`: Collection ID containing matching file Notes
- Collection items are Notes (files) with same structure as `fs-list` file Notes
## Examples
```json
{"type":"fs-find","pattern":"*.txt","out":"$txt_files"}
{"type":"fs-find","pattern":"Nan_*","path":"bhagavan","recursive":false,"out":"$matches"}
{"type":"fs-find","pattern":"*Ar*","out":"$ar_files"}
```
This skill finds files by filename pattern (glob) inside the sandboxed filesystem for the current world and returns the results as a Collection of file Notes. It searches under scenarios/<world_name>/fs and supports simple shell-style filename patterns. Results are returned as a Collection resource ID containing Notes with the same structure as fs-list file Notes.
You provide a filename pattern (shell-style glob) and an optional path, recursion flag, and maximum result count. The skill walks the specified directory (default "." under the world fs), matches filenames (not full paths) using fnmatch-style patterns, and stops when max_results is reached. Matching files are wrapped as Notes and returned inside a Collection with a resource_id.
Can the pattern match directory names or only files?
The skill matches filenames only (not full paths). It returns file Notes for filesystem files; directories are not matched as filenames.
Can I include path separators in the pattern?
No. Patterns cannot contain '/' or '\'. Use the path parameter to search within specific directories or subdirectories.
What happens if no files match?
The skill returns an empty Collection resource (no file Notes) and a valid resource_id indicating zero matches.