Using AI to Onboard Developers to a New Codebase
Dropping a new engineer into a 400,000-line codebase used to mean weeks of confusion and constant 'where does X happen?' questions. A code-aware AI assistant collapses that into days — if you ground it in the actual repo instead of letting it guess. Here's how to build one.
Onboarding Is a Search Problem in Disguise
The hardest part of joining a mature team isn't writing code — it's figuring out where the code already lives. A new developer spends their first week asking the same questions over and over: Where is auth handled? Why is this wrapped in a transaction? What calls this function, and what breaks if I change it? Every answer is buried somewhere in the repo, the git history, or a senior engineer's head. Tribal knowledge doesn't scale, and interrupting a teammate ten times a day is expensive for everyone.
AI shortens this dramatically — but only if it can actually read your codebase. A generic chatbot will happily invent a folder structure that doesn't exist. The fix is to give the model the real source as context and force it to answer from that. The rest of this guide walks through building a code-aware assistant on top of Vincony, where every model is one key away, and a first-week playbook to put it to work.
What AI Is Genuinely Good at Here
- • Architecture overviews — "Summarize how this service is structured and name the main entry points" turns a wall of folders into a one-paragraph mental model.
- • "Explain this module" — paste a file and ask what it does, what it depends on, and what depends on it. Faster than reading top to bottom cold.
- • Tracing a request path — "Follow a POST /checkout from the route handler to the database write" gives you the call chain without manually grepping.
- • Finding where X happens — "Where do we validate coupon codes?" returns candidate files and functions to verify, instead of a blind search.
- • Answering "why" — feed in git blame and commit messages and ask why a piece of code exists. Intent that lives only in PR history becomes queryable.
Build a Code-Aware Assistant with RAG
The reliable pattern is retrieval-augmented generation: chunk the repo, embed each chunk, and at query time retrieve only the snippets relevant to the question and hand them to a large-context model as grounding. The model answers from real source, not training-data memory. (If RAG is new to you, our RAG implementation guide covers the fundamentals.)
import vincony, pathlib
client = vincony.Client(api_key="YOUR_KEY")
# 1. Index: chunk the repo by file (or by function for big files)
chunks = []
for f in pathlib.Path("./src").rglob("*.py"):
text = f.read_text()
chunks.append({"path": str(f), "text": text})
embeddings = client.embeddings.create(
model="text-embedding-3-large",
input=[c["text"] for c in chunks],
)
index = list(zip(chunks, embeddings.data)) # store in your vector DB
# 2. Retrieve: pull the chunks relevant to the question
def ask(question: str):
q_vec = client.embeddings.create(
model="text-embedding-3-large", input=[question]
).data[0]
top = nearest(index, q_vec, k=8) # your similarity search
context = "\n\n".join(f"# {c['path']}\n{c['text']}" for c, _ in top)
# 3. Ground: answer ONLY from retrieved source
return client.chat(
model="claude-opus-4.5", # large context, careful reasoning
messages=[
{"role": "system", "content":
"Answer using ONLY the provided source files. "
"Cite file paths. If it's not in the context, say so."},
{"role": "user", "content": f"{context}\n\nQ: {question}"},
],
).text
print(ask("Where do we validate coupon codes, and what calls that function?"))Two model choices matter. For retrieval-grounded answers over many files, a large-context model lets you stuff more relevant source into the prompt. And because different questions favor different models — fast/cheap for "what does this file do," heavyweight for "trace this whole flow" — let the Smart Model Router pick per request instead of hard-coding one model name.
Prompts That Actually Work
Vague prompts get vague answers. Anchor the model to a task and demand citations so you can verify:
- • "Give me a 5-bullet architecture overview of this repo and the file where execution starts."
- • "Explain `payments/charge.py` to a new engineer: responsibilities, key dependencies, and what calls it. Cite line ranges."
- • "Trace a `GET /orders/:id` request from route to response and list every function it passes through."
- • "Based on this git log, why was the retry wrapper added around `sendEmail`? Quote the relevant commit."
- • "List the 3 files I'd most likely need to touch to add a new notification channel, and why."
For multi-step questions — "explain the auth flow, then tell me how to add SSO to it" — chain the calls: answer the first, feed that answer into the second. Our prompt chaining guide shows the pattern.
Know the Limits — and Verify
A code-aware assistant is a fast guide, not an oracle. Two failure modes bite newcomers most. Stale embeddings: if you indexed the repo last month, the assistant confidently describes deleted code. Re-index on a schedule or on merge to main. Hallucinated APIs: a model will sometimes cite a function signature that doesn't exist — which is exactly why the system prompt above forces file-path citations. If the answer claims something lives in auth/session.py, open that file before you trust it.
Long-context models reduce hallucination by letting you include more real source rather than relying on the model to fill gaps from memory, and routing helps you escalate a shaky answer to a stronger model automatically. The same caution applies when the assistant suggests fixes — pair it with our AI debugging workflow and run the tests.
A First-Week Onboarding Playbook
- Day 1 Index the repo and ask for the architecture overview. Read the entry points the assistant names, in the real files.
- Day 2 Pick one core user flow (login, checkout, the main job) and have the assistant trace it end to end. Follow the trace by hand to calibrate trust.
- Day 3 Ship a tiny, safe change — a log line, a copy fix. Ask the assistant which files to touch, then do it for real.
- Day 4 Use git-history prompts on the area you'll own to learn the "why" behind its weirdest decisions.
- Day 5 Take a real ticket. Let the assistant find where X happens, but write and test the change yourself.
Wire the whole thing — embeddings, retrieval, and grounded chat — through one key with the Developer API, or start free and have a code-aware onboarding assistant running this afternoon.
FAQ
Do I need a vector database to start?
No. For a small or medium repo you can embed every file and do a brute-force cosine search in memory. Reach for a vector DB once retrieval latency or repo size becomes a problem.
RAG over the repo, or just a long-context model?
For repo-wide questions, RAG is cheaper and more precise because you only send relevant chunks. For deep single-flow questions where you can fit the files, a large-context model with the source pasted in is often simpler and more accurate.
How do I stop it from inventing functions?
Force citations and "say so if it's not in the context" in the system prompt, then verify the cited file exists. Re-index often so the assistant is grounded in current code, not last month's.
Can the same assistant help with debugging later?
Yes — once the index exists, the same retrieval layer powers "why is this failing?" questions. Combine it with a multi-model review pass for high-stakes fixes.
Try It Free — 100 API Credits
Start using these tools today with Vincony's free Developer plan.
Get Free API Key