home / skills / bdambrosio / cognitive_workbench / fs-grep
This skill searches text files under scenarios/<world_name>/fs for a regex pattern and returns matching snippets as notes.
npx playbooks add skill bdambrosio/cognitive_workbench --skill fs-grepReview the files below or copy the command above to add this skill to your agents.
---
name: fs-grep
type: python
description: "Search text files under scenarios/<world_name>/fs and return match snippets."
schema_hint: {"path": "string (relative)", "pattern": "string", "recursive": "bool", "max_matches": "int", "context": "int", "case_insensitive": "bool"}
---
# fs-grep
Search text files for a regex pattern and return match snippets as Notes.
## Input
- `path`: Relative path under `scenarios/<world_name>/fs` (default: root)
- `pattern`: Regex pattern to search for (required)
- `recursive`: Recurse into subdirectories (default: true)
- `max_matches`: Max matches to return (default: 20)
- `context`: Context lines before/after each match (default: 0)
- `case_insensitive`: Case-insensitive regex (default: false)
## Output
Success returns:
- `resource_id`: Collection ID of match Notes
## Examples
```json
{"type":"fs-grep","path":"src","pattern":"TODO","recursive":true,"out":"$todos"}
{"type":"fs-grep","pattern":"error","context":2,"out":"$errors"}
```
This skill searches text files under scenarios/<world_name>/fs for a regex pattern and returns matching snippets as Notes. It is designed to quickly surface code comments, errors, TODOs, or any text matches within a scenario filesystem. Results are returned as a collection resource you can reference in workflows.
You provide a relative path under scenarios/<world_name>/fs (or leave root) and a regex pattern. The skill walks files (optionally recursively), applies the pattern with optional case-insensitivity, and captures match snippets with configurable context lines. Matches are converted into Note objects and grouped into a collection; the collection ID is returned on success.
What does the skill return?
It returns a collection ID (resource_id) that groups Note objects containing each match snippet and file context.
Can I search non-recursively?
Yes — set recursive to false to restrict the search to the specified directory only.
How do I control the number of results?
Use max_matches to cap returned matches. The default is 20 to keep results manageable.