Sometimes you do not know the exact node name — you just have a question. vg ask lets you query the code graph in plain language and returns a context block you can read directly or paste into an AI assistant.
What vg ask does
vg ask uses hybrid search — combining lexical, structural, and semantic signals — to find the most relevant parts of your code map for your question. It returns a budget-bounded context block: a focused, size-limited slice of your code that answers the question without overwhelming an AI assistant's context window.
After the first use it works fully offline, so it is fast and private.
Prerequisites
Build the graph first:
vg build
Ask a question
You can use the explicit subcommand or the shorthand quoted form:
vg ask
vg "…"
Replace the quoted text with your actual question, such as where authentication is handled or how a request flows through the app.
Why the context block matters
When you paste a vg ask result into Claude, Cursor, or another assistant, you give it accurate, structurally-relevant context instead of asking it to guess. Because the block is budget-bounded, it fits comfortably and keeps the assistant focused on the code that matters.
Tips for good questions
- Ask about behavior and relationships, not just names — "how does X talk to Y" works well.
- If you already know the node, prefer
vg showfor a precise single-node view. - Re-run
vg buildfirst if your code changed, so answers reflect current structure.
Offline and private
Graph queries, including vg ask, run locally. Nothing is uploaded for the query, which makes it safe for sensitive codebases. If you want a persistent local context server for your AI assistant, Vibgrate AI Context (via vg serve) serves the code map, drift, and version-correct library docs offline.
Related
See the articles on exploring a single node with vg show and on Vibgrate AI Context for serving context to assistants continuously.