Ask the AI to explain one behavior in the repository, identify the files that implement it, and trace the path from its entry point to its output. Open those files as you read and check each connection. Start with an explanation-only task; leave code changes until you can describe the successful path, an error path, and the parts you still can't verify.
Choose one question and the right checkout
I would start with a visible behavior: how a form saves a record, how a command finds its configuration, or how a request gets authorized. “Explain this whole repository” encourages a directory tour before you've found the code you need.
Record the repository root, current branch or commit, and the application you're investigating. A monorepo can contain several frontends, APIs, examples, and older implementations. Keep any local uncommitted changes visible in your notes: a commit identifier alone won't describe those changes.
Read the README and the relevant package or project manifest for orientation. Ask the assistant to connect their startup description to the source that registers the route, command, or application. A filename such as main or index is a clue to investigate, not enough evidence to name the entry point.
Keep exploration within your access and permissions
Use an assistant your organization permits for this code. Leave credentials, production records, private keys, and sensitive logs out of the request. If only selected excerpts may be shared, send those excerpts with their real relative paths and tell the assistant which surrounding files are unavailable.
For an unfamiliar download, VS Code's Restricted Mode limits automatic execution and disables agents. Review the project before changing its trust state. You can begin by reading source; installing dependencies or starting the application isn't required for the first investigation.
In an already approved VS Code Copilot workspace, open Chat > Open Chat and start a new chat. Check the selected session target and permissions. Manual permissions doesn't require a prompt for every action: runtime rules and previously saved approvals can allow actions automatically. A sentence saying “don't edit” also doesn't enforce read-only access.
Use an actual read-only environment or an approved configuration restricted to reading and search when you need that guarantee. If you can't establish that boundary, use an approved chat with selected excerpts and no repository tools. In either route, keep the task limited to explanation and review any proposed tool action before accepting it.
Give the assistant sources it can point back to
Type # in the chat input to choose files, folders, or symbols, or use Add Context. Attach the relevant README, project manifest, and a known entry point if you have one. Confirm that the intended attachments appear before sending.
#codebase entry requests semantic search. Attach a specific file when you already know which source matters. Open the full-size picker.An index helps Copilot find relevant snippets; it doesn't put the whole workspace into every model request. Agents can search automatically. Adding #codebase requests semantic search explicitly, while text search, file search, and language navigation can work without a semantic index.
Before enabling indexing for a repository outside the supported hosted-index route, check the data flow. VS Code's external ingest uploads indexable workspace files to GitHub and depends on account policy and workspace settings. An indexing problem isn't a reason to enable a new upload route without approval; attach permitted files or use the available text-search tools instead.
Don't use an ignore file as the security boundary. VS Code documents that an open file or selected text can bypass .gitignore exclusions. Copilot content exclusion has its own scope and limitations, including indirect access and third-party tools. Keep secrets outside the material the session can access.
Ask for a small map before a detailed explanation
Replace the bracketed fields below with your real scope. This is a request format, not a description of an existing application's architecture.
Explain how [one behavior] works in [application/package] in this checkout.
Do not edit files, install dependencies, run project code, or start services.
First identify the entry point, implementation, configuration, and relevant tests.
For each item, give its existing relative path, symbol, and role.
Use source references I can open. Do not read or reveal secret values.
Separate observed source facts, inferences, and missing information.
If you cannot access a file, say which connection remains unverified.
Read the first answer beside the Explorer. Check that each path exists in this checkout and that each cited symbol appears in its file. Then ask why each file belongs to your chosen behavior. Drop unrelated directories from the investigation.
A useful map gives you a reading order: registration, handler, supporting logic, storage or external interface, and relevant assertions. The exact order follows the application's design. Some behaviors never reach a database; others continue asynchronously in another process.
Follow one input across the actual connections
Choose a real input the application accepts. For a form, name the action and fields; for an API, name its documented route and parameters. Keep example values non-sensitive. Then ask for a connected trace:
Trace [specific input/action] through the files we identified.
For each step, show the caller, called symbol, input, and output.
Point to the call site or registration that connects this step to the next.
Include validation, state changes, error handling, and external boundaries.
Distinguish direct calls from events, queued work, or framework routing.
Mark any connection you cannot verify. Do not edit files or run project code.
I would check the connections before polishing the explanation. Two real functions can still be joined by an invented story. Open the caller and look for the import, invocation, route registration, event subscription, or configuration that supports the claimed relationship.
Use Go to Definition, Go to Implementation, and reference navigation where the language service supports them. Search the exact symbol or route when navigation can't resolve it. Dynamic imports, reflection, dependency injection, and external services can leave a source-only trace incomplete; record that boundary rather than filling the gap with a likely implementation.
If an event consumer or service lives in another repository, name that repository and the matching message schema or API contract. Continue the trace only with permitted access to the matching implementation. A sender's payload establishes what it sends; the receiving service still needs its own evidence.
| Claim in the explanation | Evidence to open |
|---|---|
| “This is the entry point.” | The application or command registration and the relevant manifest/configuration. Confirm the implementation belongs to your selected application. |
| “The handler calls this service.” | The handler's actual call site, the imported symbol, and the implementation it resolves to. |
| “This value is validated before storage.” | The validation condition, the value passed onward, and the path taken on failure. |
| “The operation saves data or sends a message.” | The write or publish call and its boundary. Note transaction handling, queued work, or an unavailable external implementation. |
| “The test covers the error.” | The test setup, input, and assertion that checks the error. A descriptive test name isn't sufficient. |
Ask for one successful path and one meaningful failure or boundary path. For example, follow a rejected input far enough to see whether the application returns an error, retries, or continues with a default. Inspecting the source shows the implemented path; confirming what happens in a deployed environment requires separate runtime evidence.
Check completeness as well as plausible wording
A map can look coherent while omitting files. In Gao and colleagues' CodeMap evaluation, file-based map accuracy reached 99% for a 130-file Python project but 27% for a 668-file Python project after five refinement rounds with GPT-4.1 and a LangChain retrieval pipeline. The metric compares files represented in a generated map with the project's file inventory; it doesn't establish that every described relationship or business rule is correct.
These are two project results from one prototype study, so I wouldn't average them into an “AI accuracy” score or apply them to today's Copilot. Their practical lesson is to check both the files named and the relevant files missing from an explanation. Increasing the context window alone doesn't establish complete coverage.
The same paper's small observational study involved nine experienced and six novice developers. It examined comprehension processes and tool use, rather than establishing a current product ranking. A clear map can help you decide what to read next; source evidence still decides whether a particular connection belongs in your notes.
Repair a missing or contradictory explanation
The assistant names a file you can't find
Search the exact relative path and symbol in the selected application. Check for a different branch, renamed file, generated copy, or example directory. Ask the assistant to show the source it used. If the path doesn't exist, have it retract the claim and trace the behavior from a confirmed entry point. Don't create a file or install a package merely to make the explanation fit.
The answer sees one file but misses its caller
Attach the known registration or caller and ask for the specific missing connection. Check search exclusions and indexing status if broader discovery fails. With no usable semantic index, use exact text/file search or attach permitted files explicitly. Rebuilding an index won't override an organization's policy.
The explanation still describes the previous branch
Confirm the checkout and attachments, then start a fresh chat with the current sources. State which earlier claims must be rechecked. Where indexing is available and approved, VS Code provides Build Codebase Semantic Index to rebuild it on demand. Don't reuse a saved architectural summary as evidence for code that has changed.
A dependency or runtime setting is unavailable
Mark the local interface and the point where evidence ends. Distinguish what the caller requests from what the external component guarantees. Check the dependency's matching version and approved documentation, or ask its maintainer. Never paste a credential to fill a context gap.
Finish with a checked reading map
Open the relevant tests and compare their assertions with the trace. Keep “test inspected” separate from “test executed”: reading a test doesn't show that it passes in this checkout. Microsoft's codebase exploration workflow makes that distinction explicit and recommends resolving important unknowns before editing.
Keep a compact task note with the repository state, chosen behavior, linked entry point, connected implementation path, relevant assertions, and unresolved questions. Add the source location for each important claim and enough context to recognize the symbol after line numbers shift. Review the note before promoting it into shared project documentation.
You're ready to plan a change when you can explain where the behavior starts, how a concrete input reaches its result, where failure is handled, and what evidence is still missing. Use those findings to write a bounded coding brief with the expected behavior and constraints. Keep the investigation's unknowns in that brief so the first edit doesn't silently assume them away.

