$npx -y skills add parcadei/Continuous-Claude-v3 --skill leann-searchSemantic search across codebase using LEANN vector index
| 1 | # LEANN Semantic Search |
| 2 | |
| 3 | Use LEANN for meaning-based code search instead of grep. |
| 4 | |
| 5 | ## When to Use |
| 6 | |
| 7 | - **Conceptual queries**: "how does authentication work", "where are errors handled" |
| 8 | - **Understanding patterns**: "streaming implementation", "provider architecture" |
| 9 | - **Finding related code**: code that's semantically similar but uses different terms |
| 10 | |
| 11 | ## When NOT to Use |
| 12 | |
| 13 | - **Exact matches**: Use Grep for `class Foo`, `def bar`, specific identifiers |
| 14 | - **Regex patterns**: Use Grep for `error.*handling`, `import.*from` |
| 15 | - **File paths**: Use Glob for `*.test.ts`, `src/**/*.py` |
| 16 | |
| 17 | ## Commands |
| 18 | |
| 19 | ```bash |
| 20 | # Search the current project's index |
| 21 | leann search <index-name> "<query>" --top-k 5 |
| 22 | |
| 23 | # List available indexes |
| 24 | leann list |
| 25 | |
| 26 | # Example |
| 27 | leann search rigg "how do providers handle streaming" --top-k 5 |
| 28 | ``` |
| 29 | |
| 30 | ## MCP Tool (in Claude Code) |
| 31 | |
| 32 | ``` |
| 33 | leann_search(index_name="rigg", query="your semantic query", top_k=5) |
| 34 | ``` |
| 35 | |
| 36 | ## Rebuilding the Index |
| 37 | |
| 38 | When codebase changes significantly: |
| 39 | |
| 40 | ```bash |
| 41 | cd /path/to/project |
| 42 | leann build <project-name> --docs src tests scripts \ |
| 43 | --file-types '.ts,.py,.md,.json' \ |
| 44 | --no-recompute --no-compact \ |
| 45 | --embedding-mode sentence-transformers \ |
| 46 | --embedding-model all-MiniLM-L6-v2 |
| 47 | ``` |
| 48 | |
| 49 | ## How It Works |
| 50 | |
| 51 | 1. LEANN uses sentence embeddings to understand *meaning* |
| 52 | 2. Searches find conceptually similar code, not just text matches |
| 53 | 3. Results ranked by semantic similarity score (0-1) |
| 54 | |
| 55 | ## Grep vs LEANN Decision |
| 56 | |
| 57 | | Query Type | Tool | Example | |
| 58 | |------------|------|---------| |
| 59 | | Natural language | LEANN | "how does caching work" | |
| 60 | | Class/function name | Grep | "class CacheManager" | |
| 61 | | Pattern matching | Grep | `error\|warning` | |
| 62 | | Find implementations | LEANN | "rate limiting logic" | |