travsr ask
Search the indexed graph for symbols matching a query string. Results are ranked and packed into a token budget for use in prompts or scripts.
Synopsis
travsr ask "<query>" [flags]
Flags
| Flag | Default | Description |
|---|---|---|
--budget <n> | 4096 | Token budget; stops adding results once the cumulative token count would exceed this value |
--json | (none) | Output raw JSON instead of a table |
--repo <path> | cwd | Repository root |
How it works
travsr ask runs a three-stage retrieval pipeline:
- FTS5 full-text search: matches the query against symbol names, signatures, and docstrings using SQLite FTS5 trigram tokenisation.
- PPR (Personalized PageRank): re-ranks candidates by their graph centrality relative to the query symbols.
- Knapsack packing: selects the highest-scoring results that fit within
--budgettokens.
This is the same pipeline that backs the get_context MCP tool.
Output format
Results are printed as an ASCII table:
+----------+-----------------------------------+--------------------------------+-------+
| Kind | Signature | Path | Score |
+----------+-----------------------------------+--------------------------------+-------+
| class | PaymentService | src/services/PaymentService.ts | 0.94 |
| method | charge(amount: number): Receipt | src/services/PaymentService.ts | 0.91 |
| function | processPayment(req, res): void | src/routes/payment.ts | 0.83 |
| method | refund(id: string): Receipt | src/services/PaymentService.ts | 0.79 |
+----------+-----------------------------------+--------------------------------+-------+
4 nodes · ~847 tokens
The footer shows the number of nodes returned and the approximate token count.
Examples
# Symbol search
travsr ask "PaymentService"
# Broader concept search, synonym expansion applies
travsr ask "billing"
# Narrow to a specific file area
travsr ask "auth middleware"
# Increase budget for larger context
travsr ask "UserRepository" --budget 8192
Synonym expansion
If you have synonyms configured (e.g. payment → billing, invoice), travsr ask "billing" will also match nodes tagged with payment and invoice. See travsr synonym.
VS Code
The Ask Symbol panel (Cmd+Shift+A) runs the same query interactively in the sidebar.