Case Study
Lask AI — Your Personal Coding Assistant
An AI coding assistant that understands your whole codebase — not just the open file
Demo video
What it is
Lask AI is a VS Code extension backed by a FastAPI inference service. It answers questions about a project with codebase-aware responses: instead of guessing from the open file alone, it retrieves the relevant functions, classes and their call relationships, then generates an answer grounded in that context.
The problem
Generic AI coding assistants only see what you paste or what sits in the active editor window. Real questions rarely live in one file — "where does this state get mutated?" or "why does this helper double-encode?" need cross-file context. I wanted an assistant that could navigate an entire repository the way a senior teammate would: follow the code, not the cursor.
How it works
AST-aware code indexing
The repository is parsed into an abstract syntax tree, and every meaningful symbol — functions, classes, methods — is extracted with its source, file path and signature. Parsing before embedding means retrieval operates on semantic units of code rather than arbitrary text chunks, which keeps functions intact and answers grounded in complete definitions.
Code RAG pipeline
Each symbol is embedded and indexed in a FAISS vector store, with MongoDB holding the symbol metadata and file mappings. At query time, the question is embedded, nearest neighbours are retrieved, and the matched source is reassembled into the prompt — classic retrieval-augmented generation, tuned for code instead of prose.
Gemini-powered generation
Retrieved context plus the user's question goes to Gemini Flash 1.5, chosen for its long context window and latency profile — both matter when you're stuffing several full source files into a prompt inside an interactive editor.
VS Code extension frontend
The extension communicates with the FastAPI backend over HTTP, streaming answers into a side panel so the assistant feels native to the editor rather than a browser tab users have to switch away from.
Challenges & solutions
Naive text chunking split functions mid-body, producing retrieval hits that were half a function — useless for explaining behaviour.
Switched to AST-based symbol extraction so every indexed unit is a complete, syntactically valid definition. Retrieval quality jumped immediately because embeddings describe whole functions, not fragments.
Large repositories mean thousands of symbols, and re-embedding everything on every change is slow.
Incremental indexing — only changed files are re-parsed and re-embedded, with metadata tracked in MongoDB so the FAISS index and the file tree stay in sync.
What I learned
- Retrieval quality dominates model quality for grounded code assistants — a cheap model with precise context beats a frontier model with fuzzy context.
- ASTs are the right unit of measure for code retrieval; text chunking is a hack that shows immediately.
- Editor UX is a latency product — answers that take more than a few seconds stop being used.