Onboarding Onto An Unfamiliar Codebase With An Assistant
The service nobody left notes for
You’ve inherited a service. The engineer who wrote most of it moved teams, or left the company. The README describes a setup from several versions ago. Your first ticket is small on paper: change how invoice totals are rounded for one currency. To do it safely you need to know where totals are computed, what else reads them, and whether there are two places that compute them slightly differently.
This is one of the best uses of an AI coding assistant, and one of the least discussed. Most of the talk about assistants is about writing code: completions, agents that open pull requests, generated tests. Reading code you didn’t write is a different job. The output is understanding rather than a diff, and understanding is much harder to check than a diff, because there’s no test suite for whether your mental model of a codebase is correct.
That’s the risk in one sentence. An assistant will explain an unfamiliar repository fluently, in a confident voice, with plausible structure. Much of what it says will be right. Some of it will be a reasonable guess dressed as fact: a middleware layer that the framework usually has, a function that its name suggests does one thing and actually does another, a call path that would exist in a typical project of this kind and doesn’t exist in this one. When you’re new to the code, you can’t tell which parts are which by reading the explanation.
So the approach here is to use the assistant as a fast, tireless guide who has to show you the evidence for everything it says. Ask questions that produce checkable answers, check them against the code, and keep track of what you’ve verified. Done that way, a few days with an assistant can replace weeks of wandering through files. Done carelessly, it produces a confident mental model that’s partly fiction, which is worse than knowing you don’t know.
What the assistant can actually see
Before asking anything, get clear on what the tool has in front of it, because that determines what its answers can be based on.
A chat assistant sees only what you paste. If you paste one file and ask how the system works, it’ll describe a system inferred from one file, and it’ll fill the gaps with what’s typical. Editor-integrated assistants usually see the open file, sometimes neighbouring files, and some can search the workspace. Agentic tools that run in a terminal or an editor can list directories, search with tools like grep, and open files on their own, which makes them much better at this job because they can go and look instead of guessing.
Even the most capable agent has limits you should keep in mind. It usually doesn’t see your production configuration, environment variables or feature flag settings, which often decide which code path actually runs. It doesn’t see runtime data. It may not look at git history unless you ask it to. In a large repository it won’t read everything; it reads what its searches turn up, and it may read only part of a long file.
The practical consequence: when an assistant explains something, the explanation is only as grounded as the files it actually opened. Many agentic tools show which files they read or which commands they ran. Look at that list. If it explains the payment flow after opening two files, its account of the other five steps came from somewhere other than your code.
If your tool doesn’t show what it read, ask directly: which files did you open to answer that? It’s a simple question, and the answer tells you a lot about how much to trust what came before it.
Start with a map you can check
“Explain this codebase” is the question everyone asks first, and it produces the least useful answer: a pleasant summary that mixes facts with assumptions and gives you nothing specific to verify.
Ask for a map instead, and ask for it in a form that points at files. What are the entry points: the main function, the HTTP server setup, the job workers, the command line tools, the scheduled tasks? For each top-level directory, what’s in it, with one or two example files? What are the external dependencies it talks to, such as databases, queues and third-party APIs, and where in the code is each client created?
Tell the assistant to cite a file path for every item and to mark anything it’s inferring rather than reading. Something like: for each entry, give the file that shows it, and say “inferred” if you haven’t opened a file that confirms it. Models follow that instruction reasonably well, and the inferred markers are exactly where you should look first.
Then check the map. It doesn’t take long. Open each cited file and confirm the thing is there. Run a directory listing and see whether any top-level folder was left out. Search for common entry point patterns yourself, such as the server start call, the job registration or the command definitions, and compare with the assistant’s list.
What you’re building is a skeleton you trust. Directory purposes, entry points, external systems, each with a file you’ve personally looked at. Everything later hangs off it. When the assistant later says a request goes through the auth module, you’ll already know where the auth module is and whether it exists.
Ask for call paths from a real starting point
Once you have the skeleton, the most productive question is a trace: starting from a specific entry point, what happens, step by step?
Pick something concrete and relevant to your work. For the invoice ticket: when a POST request hits the invoice creation endpoint, which function handles it, what does that function call, and in what order, until the total is written to the database? Ask for each step as a function name with a file path and ideally a line number, plus one sentence on what it does.
A trace is a much better question than a summary because every step is a claim you can verify, and because the steps have to connect. If step three calls a function, step four has to be that function. Gaps and jumps are visible. When the assistant says “then the total is calculated by the pricing service” without naming the function, that’s a gap, and gaps are where invented structure tends to live.
Ask it to follow the path through indirection explicitly. If the handler calls a method on an interface, which implementation is used, and where is that decided? If there’s an event published, who subscribes? If a decorator or middleware wraps the handler, what does it do? These are the points where reading code is genuinely hard for humans, and where assistants either save you a lot of time or quietly guess.
Do a few traces for the flows that matter to you, not for everything. Two or three verified paths through the code you’re about to change are worth more than an architectural overview of the whole system. They also teach you the repository’s habits, such as how it structures handlers, where it puts validation and how it talks to the database, which makes the next trace faster to read and to check.
Check every claim against the code
Verification is the part that makes this approach work, and it’s less tedious than it sounds if you make it mechanical.
Every function and file the assistant names should exist. That’s a quick search. Grep for the function name. If it’s not found, or found only in a test, the explanation is wrong at that point, and you should say so to the assistant and ask it to look again. A surprising amount of invented structure fails this simplest check: a plausible function name that isn’t in the repository.
Every call the assistant claims should be visible. If it says create_invoice calls apply_rounding, open create_invoice and find the call. If it’s not there, maybe it happens through a helper, or maybe it doesn’t happen. Either way you’ve found something worth knowing.
Every behaviour claim should be checked against the body of the function, not its name. “This validates the currency” is a description of what the function is called. What it does might be narrower, broader, or not a validation at all. Names drift from behaviour over years, and a model reading names is especially prone to trusting them.
Keep a simple record as you go. A running notes file where each statement is marked verified, with the file and line you checked, or unverified. It sounds bureaucratic. In practice it takes seconds per item, and it’s the only way to know a week later which parts of your understanding came from the code and which came from a fluent paragraph you read on Tuesday.
When a claim turns out wrong, tell the assistant and show it the code. Its next answers in that session usually improve, and you’ll learn which kinds of question it tends to get wrong in this particular repository.
Where assistants invent structure
It helps to know the specific situations where an assistant is most likely to describe structure that isn’t there, because those are where your checking should be most careful.
Framework conventions are the biggest source. A model has seen a huge number of projects built on popular frameworks, and it knows where things usually live. When your project follows the convention, that knowledge is a shortcut. When your project deviates, and inherited projects often do, the model tends to describe the convention rather than the code. It’ll say authentication is handled in middleware because that’s typical, when this project does it in a decorator on each handler.
Indirection is the next. Dependency injection containers, plugin registries, routing tables built from configuration, reflection, dynamic imports, code generated at build time, monkeypatching in test setup: all of these break the simple chain from caller to callee. An assistant reading static code has to guess which implementation is used, and it often picks the most obvious one without saying it guessed.
Names are a third. A function called send_email that actually enqueues a job, a module called legacy that’s still on the main path, a class called Cache that also writes to the database. Explanations built from names inherit every misleading name in the codebase.
Partial reading is the fourth. In a long file, a tool may have read the first part. Its description of what the file does can be accurate for the top half and invented for the rest.
None of this means the assistant is unreliable in general. It means its reliability is uneven, and the unevenness is predictable. When an explanation passes through framework magic, configuration-driven wiring or a very long file, slow down and look for yourself.
Dead code and parallel versions
Inherited codebases often contain more than one version of the same thing. A v1 and a v2 handler. An old pricing module and a new one, with a feature flag deciding which runs. A migration that was half finished, so some callers use the new path and some the old.
An assistant reading the code can see both versions, and it usually can’t tell which one actually runs in production. That’s decided by routing configuration, environment variables, feature flags or deployment settings that may not be in the repository at all. The model will often describe whichever version it found first, or the one whose name sounds current, with no hint that another exists.
Ask directly. Are there multiple implementations of this? What decides which one is used? Where is that decision made? A good assistant will search for other definitions and for the configuration that selects between them. It may still not be able to see the actual flag value, and it should say so. If it doesn’t mention the possibility, search yourself for similar names: another class implementing the same interface, another handler registered for a similar route, a function with the same name in a different module.
Then check outside the code. Look at the production configuration or feature flag settings if you have access. Look at logs or traces for the function names in question, which tell you which path real requests take. Ask a teammate who’s worked near the service. This is one of the places where a short conversation with a person beats an hour with any tool.
Dead code deserves the same treatment. An assistant will explain a function in detail without knowing whether anything calls it. Ask who calls it, check the answer with a search, and keep in mind that dynamic calls can hide callers from a plain text search.
Tests and history as ground truth
Two sources in the repository are especially valuable for checking an assistant’s explanations, because they record behaviour and intent rather than structure.
Tests describe what the code is expected to do, at least as of when they were written. Ask the assistant to find the tests that cover the function you care about and summarise what they assert. Then read those tests yourself. A test that asserts totals are rounded half-up for one currency tells you more about intended behaviour than any explanation of the rounding function’s name. Tests also expose edge cases the original author worried about, which are often exactly the cases your change might break.
Be careful with the assumption that tests are right. They can be outdated, skipped or testing a path that no longer runs. Check whether the test suite passes today before relying on it, and check whether the tests you’re reading are actually executed in CI.
Version history explains why. Ask the assistant to look at the commits that touched a file or function, and summarise what changed and what the commit messages say. Many agentic tools can run git commands directly. git log and git blame on the rounding logic might show that it was changed three times in response to specific bugs, which is exactly what you need to know before changing it a fourth time. Linked pull request descriptions and ticket references, where they exist, often explain decisions that the code alone can’t.
History is also where assistants are least likely to invent things, as long as they actually run the commands. A commit message is a fact. Ask for the commit hashes alongside any summary, so you can check the summary against the originals.
Running the code beats reading it
Reading, whether by you or an assistant, produces a model of what the code does. Running it tells you what it actually does. When the two disagree, running wins.
Use the assistant to help you run things, not just to explain them. Ask it how to start the service locally, which dependencies need to be up and what configuration is required. It’ll often get this partly wrong for an old project, since setup instructions rot faster than anything else, but its attempts, combined with the error messages, usually get you running faster than the outdated README.
Once it runs, verify the traces you built. Set a breakpoint at the entry point and step through the path. Or add temporary log lines at each step the assistant named and send a request. If execution goes somewhere the trace didn’t mention, you’ve found a gap in your understanding, and you’ve found it with evidence rather than argument.
Ask the assistant to write small, throwaway scripts that exercise one path: call this function with these inputs and print the result. That’s a good use of generation even when your goal is reading, because the script is short, easy to check, and its output is a fact about the code rather than a claim about it.
Run the existing test suite early, too. A suite that passes tells you the baseline. A suite with failures tells you something is already broken, and you want to know that before your change, not after.
None of this replaces reading. It anchors reading. Every explanation that survives a debugger session is one you can build on. Every one that doesn’t is a mistake you caught before it reached a pull request.
Questions that get useful answers
The shape of your question changes the quality of the answer more than the choice of tool does. Some patterns reliably produce checkable, useful responses.
Ask where, not what. “Where is the decision made about which tax rate applies?” produces a location you can open. “How does tax work here?” produces an essay.
Ask for the evidence in the answer. File paths, function names and line numbers, every time. Make it a standing instruction at the start of the session.
Ask about uncertainty explicitly. “Which parts of that explanation are you least sure about?” or “What would you need to look at to confirm this?” Models answer these questions surprisingly honestly, and the answers point straight at what you should check first.
Ask about what could prove it wrong. “If this explanation were wrong, what would I see in the code?” That turns a narrative into a test.
Ask for alternatives. “Is there anywhere else in the codebase that also computes invoice totals?” Assistants are better at finding a second instance when you ask for it than at volunteering it.
Avoid leading questions. “The rounding happens in the pricing module, right?” invites agreement. Models have a noticeable tendency to go along with the framing they’re given. Ask neutrally, and if you have a hypothesis, ask the assistant to check it by searching, not by confirming.
Keep sessions focused. A long session covering the whole repository accumulates summaries of summaries, and later answers drift from the code. Starting a fresh session for each area, with your verified notes as the starting context, keeps answers closer to the files.
Large repositories and context limits
In a small repository an agent can read most of what matters. In a large one it can’t, and the way it copes affects how far you can trust its explanations.
Agents in big codebases search, open a subset of files and build a picture from what they found. When the conversation gets long, many tools compress earlier parts of it into summaries to stay inside the context window. Each of those steps loses detail. An explanation late in a long session may rest on a summary of a file the agent read an hour ago, which itself was only partly read.
You can work with that. Scope questions to one area at a time: the billing module, the job workers, the auth layer. Tell the agent which directories are relevant so its searches start in the right place. Ask it to re-open a file before making claims about its details rather than relying on what it remembers. Start fresh sessions for new areas instead of stretching one session across the whole repository.
Monorepos add another wrinkle. The same function or type name can exist in several packages, and a search can return the wrong one. When the assistant names something, make sure the path it gives is in the package you care about.
Indexing features, where the tool pre-indexes the repository for semantic search, help find relevant files quickly. They don’t change the basic rule. A file surfaced by search still needs to be opened and read before anything it contains is treated as fact, by the assistant or by you.
Write down what you verified
The most durable output of an onboarding week is a set of notes that someone, including you in three months, can trust.
Keep them simple. A short architecture section: entry points, directories, external systems, each with a file path. A few traced flows for the areas you work on, step by step with file references. A list of surprises: the two pricing modules, the feature flag that decides between them, the function whose name lies about what it does. A list of open questions you haven’t been able to answer.
Mark what’s verified. Anything you confirmed in the code, by running it or by reading the actual function, gets marked with where you checked. Anything the assistant said that you haven’t checked stays marked unverified, or doesn’t go in at all. Notes that mix the two without saying which is which are how inherited fiction gets passed to the next person.
Put the notes in the repository, next to the code, where they’ll be found and updated. Many teams now keep an instruction file for their coding assistants at the root of the repo. Your verified notes are good raw material for it: the next session with the assistant starts from facts you checked instead of from the model’s assumptions about what a project like this usually looks like. Keep that file short and focused on things that are true and non-obvious, since everything in it is sent on every relevant request.
Share the surprises with the team. If you found two implementations of the same logic, others probably don’t know either.
Be careful what you send
Using an assistant on a codebase means sending that code to wherever the model runs, unless you’re using a locally hosted model. For a company repository, that’s a decision with policy implications, and it’s worth settling before your first session rather than after.
Check whether your organisation has approved specific tools and plans for use with its code. Many providers offer business terms that differ from consumer terms on retention and on whether inputs are used for training. Which terms apply depends on the plan and settings, so check the current documentation and your company’s agreements rather than assuming.
Old repositories are especially likely to contain secrets: API keys in configuration files, credentials in test fixtures, connection strings in scripts nobody has touched in years. An agent that reads the repository freely will read those too, and they’ll end up in the conversation. Before pointing an agent at an inherited codebase, run a secret scanner over it. If it finds anything, that’s worth fixing regardless, since a secret committed years ago is still exposed to anyone with repository access.
Configure the tool’s permissions for the job. For onboarding, you mostly need reading and searching. There’s no reason to give an agent write access or the ability to run arbitrary commands against shared environments while you’re just trying to understand the code. Many tools support read-only or ask-before-acting modes; use them.
Keep production data out of the session. Pasting real customer records to explain a bug is a fast way to create a data handling problem.
A first-week routine
Day one: settle the policy question and scan for secrets. Get the service running locally, with the assistant’s help on setup. Run the tests and note what passes.
Then build the map. Ask for entry points, directory purposes and external systems, each with a file path and inferred items marked. Check each one. Write the verified skeleton into your notes.
For the change you actually need to make, do a trace from a real entry point to where the relevant logic lives. Ask about indirection at every step: which implementation, who subscribes, what the decorator does. Verify each step by opening the function and finding the call. Then run the path with a breakpoint or log lines and confirm execution goes where the trace says.
Ask whether there’s anywhere else the same logic lives, and what decides which version runs. Check configuration, logs and, if possible, a teammate. Look at the tests that cover the logic and the history of changes to it, with commit hashes you can check.
Keep your notes marked verified or unverified throughout, and put them in the repository when you’re done. Start fresh sessions for new areas, with those notes as context.
By the end of the week you’ll have a map of the code you need, a few paths you’ve watched execute, and a clear list of what you still don’t know. That’s a better starting point for your first change than any explanation, however fluent, that you took on trust.
For more breakdowns of how AI tools behave on real workloads, and what they cost once they’re running, head back to the AI Tool Gazette homepage.