scry_grep
Search file contents with full-text queries, filtering by doc kind, status, or path glob. Returns ranked matches with highlighted snippets.
Instructions
Full-text search over all indexed file bodies (scry__file_fts).
Complements scry_sql: use this when you want broad full-text search across file content, not just curated marker fields.
Returns one hit per file (highest BM25-ranked match).
Args: query: FTS5 query string — plain words, phrases ("foo bar"), boolean (foo AND bar, foo OR bar, NOT foo). Accepts standard FTS5 syntax. kind: Optional: filter to files whose associated doc has this kind (e.g. 'design', 'lesson', 'pattern'). Files without a doc marker are excluded when this filter is set. status: Optional: filter by doc status (e.g. 'active', 'draft'). Files without a doc marker are excluded when set. path_glob: Optional: GLOB pattern on file path, e.g. 'agent/design/' or '.py'. Applied before FTS. limit: Max number of results to return (default 20).
Returns JSON: { "hits": [ { "path": "agent/design/...", "doc_id": "design.foo~abcd1234" | null, "snippet": "...text with matches highlighted...", "score": 12.4, "match_count": 3 } ], "total_matches": 47, "query": "...", "filters_applied": { "kind": null, "status": null, "path_glob": null } }
Tips:
Combine with scry_sql: get doc IDs from scry_grep, then JOIN to scry__doc_tag or scry__doc for richer metadata.
Use path_glob to scope to a subtree: 'agent/design/*'
scry__file is populated during scry_surface; call that first if results are empty on a fresh DB.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | No | ||
| limit | No | ||
| query | Yes | ||
| status | No | ||
| path_glob | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |