1---2name: code-search3description: Routes code search requests to semantic, structural, repo-discovery, or text-search workflows. Use when the user wants to find code, inspect repository layout, or search by meaning or syntax.4---56<objective>7Help the assistant choose the right code-search strategy for the task: start with repo discovery when needed, prefer osgrep for semantic search, use ast-grep for structural matching, and fall back to ripgrep for exact text search.8</objective>910<quick_start>11<default_order>121. If the repo layout is unclear, load `workflows/repo-discovery.md`.132. If the user wants "find code by meaning", load `workflows/semantic-search.md`.143. If the user wants a structural pattern, load `workflows/structural-search.md`.154. If the user wants a literal match, load `workflows/text-search.md`.16</default_order>1718<priority>19Default to the `osgrep` CLI for semantic code search. If the repo does not have a usable root index, create or refresh it with `osgrep index` before searching. Confirm availability with `osgrep --help`; if unavailable, fall back to ripgrep-based discovery. Never start the `osgrep mcp` or `osgrep serve` background processes — use the CLI commands directly.20</priority>21</quick_start>2223<intake>24What kind of code search do you want?25261. Find code by meaning or concept272. Find code by structure or AST shape283. Get the lay of the land in a repo294. Find exact text or identifier matches3031Wait for the answer, then follow the matching workflow.32</intake>3334<routing>35| Response | Workflow |36|----------|----------|37| 1, "meaning", "semantic", "concept", "osgrep" | `workflows/semantic-search.md` |38| 2, "structure", "ast", "ast-grep", "pattern" | `workflows/structural-search.md` |39| 3, "layout", "overview", "repo", "land" | `workflows/repo-discovery.md` |40| 4, "text", "literal", "identifier", "grep", "ripgrep" | `workflows/text-search.md` |41</routing>4243<reference_index>44<files>45- `references/tool-selection.md` - Tool priorities and fallback rules46- `references/osgrep.md` - Semantic search workflow and index expectations47- `references/ast-grep.md` - Practical ast-grep workflow, rewrites, and CLI usage48- `references/ast-grep-rules.md` - Detailed ast-grep rule syntax and metavariables49- `references/repo-discovery.md` - Layout discovery and repo mapping guidance50</files>51</reference_index>5253<workflows_index>54<files>55- `workflows/repo-discovery.md` - Find entry points, project shape, and candidate files56- `workflows/semantic-search.md` - Use osgrep to search by meaning after confirming index state57- `workflows/structural-search.md` - Use ast-grep to search by syntax, structure, and rewrites58- `workflows/text-search.md` - Use ripgrep for exact matches and lightweight fallback searches59</files>60</workflows_index>6162<success_criteria>63The right workflow is selected, the search strategy matches the task, and the assistant avoids using a heavier tool when a simpler one is enough.64</success_criteria>