Design the Context for a Coding Assistant
The interviewer asksYour coding assistant has a large context window. Design what goes into the context when a developer asks it to fix a bug.
AI Product EngineerAI Platform PMForward Deployed Engineer (secondary)AdvancedSystem design roundRepresentative10 min
On this page
The 30-second version
- Bigger windows don't mean "send everything": cost, latency and missed details all grow.
- Include: the developer's request, the error and stack trace, the files involved, related definitions, and project conventions.
- Select relevant code by search and by following references, not by dumping the repository.
- Order it: instructions and the task first and last, supporting code in between.
- Measure: fix success rate, plus how often the needed file was in the context.
What it's really testing
- Context engineering
- Retrieval for code
- Cost and quality trade-offs
How to structure your answer
- Requirements.
- What to include.
- How to select it.
- How to measure it.
The interview, played out
- InterviewerYour coding assistant has a large context window. Design what goes into the context when a developer asks it to fix a bug.
- CandidateHow big are the repositories, and what do bug-fix requests usually include?
- Revealed when askedUp to a few million lines. Requests usually include an error message.
- CandidateThen sending everything is impossible, and even sending a lot is slow, costly, and makes the model miss details. So the context should be selected.
- CandidateIn order: the instructions and the developer's request; the error and stack trace; the files the stack trace points to; definitions those files call; recent changes to those files; and the project's conventions, like test commands. The request goes again at the end.
- Strong moveBuilds the context from the evidence the bug provides.
- InterviewerHow do you pick related files?
- CandidateFollow the stack trace and references in the code, plus search for related names. Keep the total to what's needed.
- InterviewerHow would you know the design works?
- CandidateFix success rate on a set of real past bugs.
- Missed signalShould also measure retrieval: was the file that needed changing in the context?
The strong answer, distilled
- Principle: select, don't dump; large windows still cost time, money and attention.
- Contents: request, error and stack trace, implicated files, called definitions, recent changes, conventions.
- Selection: follow the stack trace and code references; search for related names.
- Order: task first and repeated at the end; supporting code between.
- Measure: fix success on real past bugs, and whether the file needing the change was in context.
This is one strong answer, not the only one.
How it's scored
| Dimension | Weak (2) | Passable (3) | Strong (5) |
|---|---|---|---|
| Principle | Send everything | Some selection | Selection with reasons |
| Contents | The file | File and error | Layered evidence and conventions |
| Measurement | None | Fix rate | Fix rate and context relevance |
Round scorecard: FDE: AI system design round, filled in for the mock candidate
| Dimension | Weak | Passable | Strong | The mock candidate |
|---|---|---|---|---|
| Requirements | Assumes them. | Asks about scale. | Users, data, scale, latency, cost and risk, before drawing anything. | Strong. Asked about repository size and what developers usually ask. |
| Architecture | One component. | A reasonable flow. | Full skeleton, then depth on the parts this system depends on. | Strong. Layered context: task, relevant files, errors, conventions. |
| Quality and evals | None. | Mentions testing. | Evals per component and end to end, and how they're built. | Passable. Measured fix success but not context relevance. |
| Failure and cost | Ignored. | Mentions one. | Fallbacks, guardrails, latency and cost levers, tied to requirements. | Strong. Explained cost and latency of stuffing the window. |
How the answer changes by role
| Role | What to emphasise |
|---|---|
| AI Product Engineer | The selection logic and evaluation |
| AI Platform PMProduct Manager. Decides what a product should do, for whom, and why. Read the full explanation | What context tools the platform should offer developers |
| Forward Deployed EngineerForward Deployed Engineer. An engineer embedded with customers who scopes, builds and ships AI solutions into production. Read the full explanation | Adapting it to a customer's codebase |
Common mistakes
- Filling the window because it's there
- No way to tell if the right code was included
- Ignoring latency
More follow-ups to practise
- "The bug is in a file not mentioned anywhere in the error." Hint: search, and let the agent explore with tools.
- "Conversations get long." Hint: summarise earlier steps.
Go deeper
- Module: Prompting and context engineering
- Framework: AI System Design Framework
- Framework: Opening Any Interview Answer
- Lesson: Context engineering
- Also tests: RAG and retrieval
- Also tests: AI numbers: serving, cost and latency
Sources
Representative question: written to match system design rounds for AI product roles, not a specific reported interview.