Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Search Tool Hierarchy
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-16 | ✗→✓ | ▲ Improved | -2% | 0% |
| case-03 | ✓→✗ | ▼ Worse | -79% | 0% |
| case-10 | ✓→✗ | ▼ Worse | -28% | 0% |
| case-11 | ✓→✗ | ▼ Worse | -7% | 0% |
| case-12 | ✓→✗ | ▼ Worse | -33% | 0% |
Use the most token-efficient search tool for each query type.
Query Type?
├── STRUCTURAL (code patterns)
│ → AST-grep (~50 tokens output)
│ Examples: "def foo", "class Bar", "import X", "@decorator"
│
├── SEMANTIC (conceptual questions)
│ → LEANN (~100 tokens if path-only)
│ Examples: "how does auth work", "find error handling patterns"
│
├── LITERAL (exact identifiers)
│ → Grep (variable output)
│ Examples: "TemporalMemory", "check_evocation", regex patterns
│
└── FULL CONTEXT (need complete understanding)
→ Read (1500+ tokens)
Last resort after finding the right file| Tool | Output Size | Best For | |------|-------------|----------| | AST-grep | ~50 tokens | Function/class definitions, imports, decorators | | LEANN | ~100 tokens | Conceptual questions, architecture, patterns | | Grep | ~200-2000 | Exact identifiers, regex, file paths | | Read | ~1500+ | Full understanding after finding the file |
The grep-to-leann.sh hook automatically:
bash# STRUCTURAL → AST-grep ast-grep --pattern "async def $FUNC($$$):" --lang python # SEMANTIC → LEANN leann search opc-dev "how does authentication work" --top-k 3 # LITERAL → Grep Grep pattern="check_evocation" path=opc/scripts # FULL CONTEXT → Read (after finding file) Read file_path=opc/scripts/z3_erotetic.py
1. AST-grep: "Find async functions" → 3 file:line matches
2. Read: Top match only → Full understanding
3. Skip: 4 irrelevant files → 6000 tokens savedOther measured skills in the registry, with their headline benchmark lift.