AI Assistants for Large Codebases

The Bigger the Codebase,
the More Your AI Assistant Guesses

On a large system, an AI coding assistant holds a narrow slice in its context window and confidently fills in the rest. We put a number on it: given only its own service, an assistant found roughly a third of an architecture answer. Given the same system as a live map over MCP, it found nearly all of it. Same repositories, same models — only the context changed.


Why AI Assistants Fail on Large Codebases

It is not the model. Four AI models from four companies each worked on a single service and were asked how the wider system fits together — which services call which, who publishes and reads each event, what stops working if a service goes down. They got about a third of the answer right. Nobody had told them what the rest of the system looks like.

A large system does not fit in a model’s context window, so the assistant works from whatever is in front of it and guesses at the far side. It will change a function signature without knowing that four other services call it. Many of those calls never appear as plain text in any file — they cross the network over HTTP, gRPC, or a message topic — so no amount of reading the open repository reveals them. This is the part it cannot reach by reading, and the part it will invent with confidence.

We Measured It: 3,300 Scored Answers

We asked twenty architecture questions about one system of sixty repositories, five different ways, on four frontier models from four vendors, and marked 3,300 answers against a key we wrote by hand. Every percentage is recall: how much of the correct answer the model found. Ask which services call a component; if ten of them do and the assistant names three, that is 30%.

The headline result

With only its own service and immediate neighbours on disk, each model found between 33% and 37% of the right answer. Connected to the same system over MCP, the same models found 90% to 97%. The only thing that changed between the two was whether the system map was connected.

Recall is easy to cheat — name every service and you name the right ones too — so we counted the other direction as well. Wrong services, names the assistant added that do not belong, fell from 40 per 100 answers to 8. Both numbers moved together, which is what makes the result worth something.

Every Fix, in the Order People Suggest Them

Cloning everything is the first thing people propose, so it deserves a measurement and not an opinion. Here is each approach to giving an AI assistant context on a large codebase, with what it scored.

Its own service and immediate neighbours the everyday case: five repositories on disk
33–37%

The starting point. The assistant sees the file in front of it and guesses at the rest of the system.

Clone every repository in the organisation the intuitive fix: all sixty on disk
73–84%

Better, but not enough — and it reads 33% more tokens to get there. More text was never the missing piece.

A system map, served over MCP same five repositories, Code Swan connected
90–97%

The structure the assistant cannot reach by reading one repository — who calls whom, who reads what, what breaks — delivered as a single call.

Density puts accuracy and cost in one number — how much of a correct answer you get per 100,000 tokens read. Without the map it is 24; with it, 94. That is 3.9 times more. You can score well on accuracy by reading everything, and well on cost by reading almost nothing. Neither trick works here.

What Changes When the Assistant Can See the Whole System

Four outcomes, measured on the same benchmark, once the map is connected.

Structure the Context Window Cannot Hold

A large system does not fit in a model’s context window. Code Swan builds a live map of how your services connect — APIs, dependencies, events, ownership — so the assistant reasons about the whole system instead of the one repository it can see.

Fewer Confident, Wrong Answers

The half of accuracy recall cannot see. In the benchmark, wrong services named — a caller claimed that never calls it — fell from 40 per 100 answers to 8 once the assistant could query the real system over MCP.

Cheaper Than Cloning Everything

Searching a codebase means listing folders, opening files, and paying for every token read. Asking over MCP is a single call. Answer density — how much of a correct answer you get per 100,000 tokens — went from 24 to 94, 3.9 times more.

In the Tools Your Engineers Already Use

Code Swan delivers its intelligence over the Model Context Protocol, the open standard modern assistants already speak. The same system map shows up inside Cursor, Claude, and GitHub Copilot, with no custom plugin required.

How Code Swan Gives AI Assistants the Whole Picture

Code Swan scans your source code to build a complete map of your APIs, cloud resource connections, service architecture, and domain ownership. That intelligence is exposed through a cloud-hosted MCP server. Engineers add the server URL to their AI tool’s settings — no code changes required — and their assistant immediately has full codebase context, whether or not the relevant repositories are checked out locally.

It connects to GitHub, GitLab, and Bitbucket, and unifies every repository across every connected source into one consistent picture. The connection is read-only and your code is never stored: it is scanned in memory, only metadata is kept, and that metadata is never used to train models.

Frequently Asked Questions

Why do AI assistants struggle with large codebases?

A large system does not fit in a model’s context window, so an assistant works from a narrow slice — usually the file it is editing and a few neighbours — and confidently proposes edits to code it cannot see the far side of. The structure it cannot reach by reading one repository (which services call which, who publishes and reads each event, what breaks if a service goes down) is exactly the part it will guess at with confidence. The gap is not intelligence; it is context.

How much more accurate is an AI assistant on a large codebase with the right context?

In a controlled benchmark of 3,300 recorded answers across four frontier models from four vendors, an assistant given only its own service and immediate neighbours found between 33% and 37% of the correct answer to an architecture question. Connected to the same 60-repository system over MCP, the same models found 90% to 97%. The repositories on disk, the model, and the number of tries stayed the same; the only thing that changed was whether the system map was connected.

Does cloning every repository fix it?

It helps, but not enough, and it costs more to run. In the benchmark, putting all sixty repositories on disk raised recall to 73–84% — still below the 90–97% reached over MCP — while reading about 33% more tokens to get there. Cloning everything loses on both axes: more text for less answer. The assistant already has plenty of text. What it lacks is something that says which text matters.

Which AI coding assistants does this work with?

Any assistant that speaks MCP, the open Model Context Protocol, including Cursor, Claude, and GitHub Copilot. Engineers add the MCP server URL to their tool’s settings, with no code changes required, and their assistant immediately has structured knowledge of the system’s APIs, architecture, and ownership.

How does Code Swan build the map of a large codebase?

Code Swan scans your source code with static analysis to build a complete, always-current model of your software: services, APIs, cloud resources, architecture boundaries, and team ownership. It connects to GitHub, GitLab, and Bitbucket, and unifies repositories across every connected source — including several organisations and a self-hosted instance at once — into one consistent picture, regardless of where the code lives.

Is our source code safe?

Access to your repositories is read-only, and your code is never stored. It is scanned in memory, only metadata about your system is kept, and that metadata is never used to train models. Every tenant is isolated at the database level, and agents receive only the scoped context a task needs.

See It on Your Own Large Codebase

Point Code Swan at your repositories and watch what a real change lights up — the callers, the events, and the teams your assistant could not see before.