Overview
Thequery tool performs hybrid search (BM25 keyword + semantic vector search) across the code knowledge graph, returning execution flows (processes) ranked by relevance. Unlike traditional grep or IDE search that returns file matches, query returns how code works together through call chains and relationships.
When to use: Understanding how code works together. Use when you need execution flows and relationships, not just file matches. Complements grep/IDE search.Next step: Use
context() on a specific symbol for 360-degree view (callers, callees, categorized refs).Parameters
Natural language or keyword search query describing what you’re looking forExamples:
"payment processing""user authentication flow""database connection setup"
What you are working on (e.g., “adding OAuth support”). Helps improve ranking by understanding your current task.
What you want to find (e.g., “existing auth validation logic”). Helps narrow results to your specific intent.
Maximum number of processes (execution flows) to returnRange: 1-20 recommended
Maximum number of symbols to include per processRange: 1-50 recommended
Include full source code for each symbol in results. Set to
true when you need implementation details.Repository name or path. Required when multiple repos are indexed. Omit if only one repo is available.
Response
Returns results grouped by process (execution flow):Ranked execution flows with relevance priority
All symbols participating in the returned processes
Standalone types/interfaces not participating in any process but matching the query
Example Usage
Basic Query
Query with Context and Goal
Query with Full Source Code
Multi-Repo Query
Example Response
Ranking Algorithm
query uses Reciprocal Rank Fusion (RRF) to combine:
- BM25 keyword search - Traditional text matching
- Semantic vector search - Meaning-based similarity using embeddings
Real-World Examples
Example 1: Understanding Payment Flow
Example 2: Finding Auth Logic
Best Practices
Use natural language queries
Use natural language queries
query understands concepts, not just keywords. Use descriptive phrases like “payment processing flow” instead of just “payment”.Provide task context
Provide task context
Adding
task_context and goal significantly improves ranking by helping the tool understand what you’re trying to accomplish.Start with defaults
Start with defaults
The default
limit: 5 and max_symbols: 10 work well for most queries. Only adjust if you need broader or narrower results.Follow up with context()
Follow up with context()
After identifying relevant symbols, use
context() for a deeper 360-degree view including all callers, callees, and process participation.Avoid include_content initially
Avoid include_content initially
Start without full source code to keep responses manageable. Enable
include_content: true only when you need implementation details.Use Cases
- Code exploration: “How does X work?”
- Feature location: “Where is the Y functionality?”
- Debugging: “What code handles Z errors?”
- Architecture understanding: “Show me the main components”
- Onboarding: Understanding unfamiliar codebases
Related Tools
- context - Deep dive on specific symbols from query results
- cypher - Custom graph queries for advanced use cases
- list_repos - Discover available repositories first
Related Resources
gitnexus://repo/{name}/processes- Browse all execution flowsgitnexus://repo/{name}/process/{name}- View full step-by-step trace