search-hierarchy▌
parcadei/continuous-claude-v3 · updated Apr 8, 2026
Use the most token-efficient search tool for each query type.
Search Tool Hierarchy
Use the most token-efficient search tool for each query type.
Decision Tree
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
Token Efficiency Comparison
| 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 |
Hook Enforcement
The grep-to-leann.sh hook automatically:
- Detects query type (structural/semantic/literal)
- Blocks and suggests AST-grep for structural queries
- Blocks and suggests LEANN for semantic queries
- Allows literal patterns through to Grep
DO
- Start with AST-grep for code structure questions
- Use LEANN for "how does X work" questions
- Use Grep only for exact identifier matches
- Read files only after finding them via search
DON'T
- Use Grep for conceptual questions (returns nothing)
- Read files before knowing which ones are relevant
- Use Read when AST-grep would give file:line
- Ignore hook suggestions
Examples
# 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
Optimal Flow
1. AST-grep: "Find async functions" → 3 file:line matches
2. Read: Top match only → Full understanding
3. Skip: 4 irrelevant files → 6000 tokens saved
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.6★★★★★53 reviews- ★★★★★Hana Martin· Dec 16, 2024
search-hierarchy fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Aarav Abebe· Dec 16, 2024
Solid pick for teams standardizing on skills: search-hierarchy is focused, and the summary matches what you get after install.
- ★★★★★Anika Mensah· Dec 12, 2024
search-hierarchy reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Chaitanya Patil· Dec 8, 2024
Useful defaults in search-hierarchy — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Ama Reddy· Dec 8, 2024
We added search-hierarchy from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Sakura Jain· Dec 4, 2024
search-hierarchy has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Piyush G· Nov 27, 2024
search-hierarchy is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Mia Dixit· Nov 27, 2024
search-hierarchy reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Hiroshi Sethi· Nov 7, 2024
Registry listing for search-hierarchy matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Ama Singh· Nov 3, 2024
Solid pick for teams standardizing on skills: search-hierarchy is focused, and the summary matches what you get after install.
showing 1-10 of 53