Design a code assistant that answers questions over a large private codebase with a 2-second latency budget.
Quick-fire answer from the Awesome Generative AI Guide (MIT)
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
Ingest the repo with code-aware chunking (by function, class, or file with symbol metadata) and index both dense embeddings and a symbol or keyword index, because exact identifier matches matter as much as semantic similarity, so hybrid retrieval is the default. At query time, retrieve and rerank the most relevant code plus its immediate context, keep the prompt tight to hit the latency budget, stream the answer, and cache the stable system prompt and common repo context. Handle freshness with incremental re-indexing on commits, and refuse or flag when the answer is not supported by retrieved code. The tight budget pushes you toward a fast model, aggressive caching, and precise retrieval over a big context stuff.
Full worked answer
Ingest the repo with code-aware chunking (by function, class, or file with symbol metadata) and index both dense embeddings and a symbol or keyword index, because exact identifier matches matter as much as semantic similarity, so hybrid retrieval is the default. At query time, retrieve and rerank the most relevant code plus its immediate context, keep the prompt tight to hit the latency budget, stream the answer, and cache the stable system prompt and common repo context. Handle freshness with incremental re-indexing on commits, and refuse or flag when the answer is not supported by retrieved code. The tight budget pushes you toward a fast model, aggressive caching, and precise retrieval over a big context stuff.
Learn more: Harness engineering guide
What a good answer covers
- Ingest the repo with code-aware chunking (by function, class, or file with symbol metadata) and index…
- At query time, retrieve and rerank the most relevant code plus its immediate context, keep the prompt…
- Handle freshness with incremental re-indexing on commits, and refuse or flag when the answer is not…
- The tight budget pushes you toward a fast model, aggressive caching, and precise retrieval over a big…
Key terms: Learn more
In the glossary: Chunking
Quick-fire answer from the Awesome Generative AI Guide (MIT) · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep