$npx -y skills add parcadei/Continuous-Claude-v3 --skill search-toolsSearch Tool Hierarchy
| 1 | # Search Tool Hierarchy |
| 2 | |
| 3 | When searching code, use this decision tree: |
| 4 | |
| 5 | ## Decision Tree |
| 6 | |
| 7 | ``` |
| 8 | Need CONCEPTUAL/SEMANTIC search? |
| 9 | (how does X work, find patterns, understand architecture) |
| 10 | → Use LEANN (/leann-search) - embedding-based semantic search |
| 11 | → PreToolUse hook auto-redirects semantic Grep queries |
| 12 | |
| 13 | Need to understand code STRUCTURE? |
| 14 | (find function calls, class usages, refactor patterns) |
| 15 | → Use AST-grep (/ast-grep-find) |
| 16 | |
| 17 | Need to find TEXT in code? |
| 18 | → Use Morph (/morph-search) - 20x faster |
| 19 | → If no Morph API key: fall back to Grep tool |
| 20 | |
| 21 | Simple one-off search? |
| 22 | → Use built-in Grep tool directly |
| 23 | ``` |
| 24 | |
| 25 | ## Tool Comparison |
| 26 | |
| 27 | | Tool | Best For | Requires | |
| 28 | |------|----------|----------| |
| 29 | | **LEANN** | Semantic search: "how does caching work", "error handling patterns", conceptual queries | Index built | |
| 30 | | **AST-grep** | Structural patterns: "find all calls to `foo()`", refactoring, find usages by type | MCP server | |
| 31 | | **Morph** | Fast text search: "find files mentioning error", grep across codebase | API key | |
| 32 | | **Grep** | Literal patterns, class/function names, regex | Nothing (built-in) | |
| 33 | |
| 34 | ## Examples |
| 35 | |
| 36 | **LEANN** (semantic/conceptual): |
| 37 | - "how does authentication work" |
| 38 | - "find error handling patterns" |
| 39 | - "where is rate limiting implemented" |
| 40 | |
| 41 | **AST-grep** (structural): |
| 42 | - "Find all functions that return a Promise" |
| 43 | - "Find all React components using useState" |
| 44 | - "Refactor all imports of X to Y" |
| 45 | |
| 46 | **Morph** (text search): |
| 47 | - "Find all files mentioning 'authentication'" |
| 48 | - "Search for TODO comments" |
| 49 | |
| 50 | **Grep** (literal): |
| 51 | - `class ProviderAdapter` |
| 52 | - `def __init__` |
| 53 | - Regex patterns |
| 54 | |
| 55 | ## LEANN Commands |
| 56 | |
| 57 | ```bash |
| 58 | # Search with semantic query |
| 59 | leann search opc-dev "how does blackboard communication work" --top-k 5 |
| 60 | |
| 61 | # List available indexes |
| 62 | leann list |
| 63 | |
| 64 | # Rebuild index (when code changes) |
| 65 | leann build opc-dev --docs dir1 dir2 --no-recompute --no-compact --force |
| 66 | ``` |