Serena Semantic Navigation
Token-Efficient Reading Pattern
Instead of reading entire files:
- •Get overview first:
get_symbols_overview(file)- See all functions/classes - •Locate specific symbol:
find_symbol(name)- Get exact location - •Read targeted section:
read_file(path, start_line, end_line)- Only what's needed
This pattern saves 90%+ tokens on large files.
Tool Selection Guide
| Task | Tool |
|---|---|
| See file structure | get_symbols_overview(file_path) |
| Find definition | find_symbol(name) |
| Find all usages | find_referencing_symbols(symbol_name) |
| Search text/comments | search_for_pattern(pattern) |
Example Workflow: Understanding Code
code
1. get_symbols_overview("src/services/payment.py")
→ See PaymentProcessor class with all methods
2. find_symbol("process_payment")
→ Get exact location and signature
3. find_referencing_symbols("process_payment")
→ Find all call sites
4. read_file("src/services/payment.py", start_line=45, end_line=80)
→ Read only the relevant method
When to Use Text Search
Use search_for_pattern for:
- •String literals and comments
- •Configuration values
- •Non-code patterns
Memory Integration
Check existing project knowledge:
code
list_memories()
read_memory("architecture_overview")
Save discoveries:
code
write_memory(key="architecture_overview", content="...")