Ask Your Codebase Questions with vg ask
vg ask queries your code map in natural language using hybrid lexical, structural, and semantic search, returning a budget-bounded context block ready for any AI assistant — offline after first use.
vg ask lets you query the code map in plain English. It uses hybrid lexical + structural + semantic search and returns a budget-bounded context block you can paste straight into any AI assistant. After the first run it works fully offline.
Prerequisites
- A built code graph from
vg build
Steps
1. Build the graph
vg build
2. Ask a question
vg "how does authentication work in this codebase"
You can also use the explicit subcommand:
vg ask
Vibgrate searches the graph and assembles the most relevant nodes.
3. Understand the context block
vg ask returns a budget-bounded context block — it fits a token budget so it stays paste-ready. The block combines lexical matches, structural relationships, and semantic similarity, so it surfaces relevant code even when your wording does not match identifiers exactly.
4. Precompute embeddings for speed
To make the next vg ask instant, precompute the semantic index:
vg embed
The local ONNX model downloads once into a shared cache and then runs fully offline.
5. Use the context with an AI assistant
Paste the returned context block into your AI assistant as grounding, then ask your real question. Because the context is scoped to relevant code, the assistant answers with far less hallucination.
Verification
Confirm vg ask returns a context block referencing real nodes from your repository. If results are thin, rebuild with vg build and run vg embed to enable semantic ranking.
Next Steps
- Precompute the semantic index with
vg embed - Serve the graph to your AI assistant with
vg serve - Explain a specific result with
vg show
Prerequisites
- A built code graph (vg build)
Steps
- 1Build the graph
- 2Ask a question
- 3Understand the context block
- 4Precompute embeddings for speed
- 5Use the context with an AI assistant