code0Vörr AIContactDocs
Book a Demo
← Back to blogProduct

How CodeZero Finds the Right Context Across 10K Files and 1M Functions

How CodeZero Finds the Right Context Across 10K Files and 1M Functions




Give an AI more code, and eventually the context itself becomes the problem.

Across 10,000 files and millions of functions, there will always be something that looks relevant - another similarly named function, an outdated reference, a README mentioning the same concept, or a completely different implementation of the same pattern.

The challenge is not getting more code into the model. It is finding the small amount of code that actually matters before the model starts reasoning.

CodeZero does that retrieval first.

Scale scenario used for explanation; not presented here as a published benchmark.

1. Repository Indexing

An AI should not start every question by rediscovering the codebase from scratch.

Once repositories are connected, CodeZero indexes them into a structured catalogue containing the information needed to navigate the system:

  • files and repository structure
  • functions, classes, and types
  • definitions and references
  • imports and dependencies
  • HTTP routes
  • queues and service surfaces
  • repository and commit state

Exact source remains searchable, while structural information makes it possible to answer questions such as:

Where is this function defined?

What depends on this class?

without forcing the model to inspect thousands of unrelated files first.

Each repository index is also associated with a specific commit.

The codebase is organised for retrieval before the first question arrives.

2. Retrieval Layers

One search method is rarely enough to understand code.

Imagine asking:

How does payment recovery work?

There may be a function called recoverPayment. Or the implementation may live inside PaymentFailureWorker, behind an API route, or inside a queue consumer with no obvious use of the word recovery.

CodeZero therefore searches through several layers.

LayerWhat it finds
Exact searchIdentifiers, strings, API paths, configuration names, and literal matches
Structural retrievalDefinitions, references, imports, symbols, callers, and related code
Service surfacesRoutes, queues, data access, and configuration references
Cross-repository relationshipsConnections when a flow continues somewhere else

The question stays the same. The evidence can come from several different parts of the system.

3. Evidence Ranking

Finding matches is easy.

Finding the right match is harder.

Suppose a search returns:

Function definition
Function reference
README mention
Test fixture
Documentation example

All five contain the same term. They should not carry the same weight.

A real definition is usually stronger evidence than a documentation mention. A caller or reference tells you more about behaviour than a similar-looking snippet sitting elsewhere in the repository.

Definition        -> Strong signal
Real reference    -> Strong signal
Source match      -> Useful signal
Documentation     -> Supporting signal

This helps stop an incidental match from becoming the foundation of the model's answer.

Matching code is useful. Relevant evidence is what matters.

4. Cross-Repo Graph

Large systems are not difficult only because they contain more files.

They are difficult because one feature can cross several repositories.

Frontend Repo
      |
      v
Checkout API Repo
      |
      v
Payment Service Repo
      |
      v
payment.completed
      |
      v
Invoice Worker Repo

To the developer, that is one feature. To ordinary repository search, it is several separate codebases.

CodeZero uses signals such as routes, outbound calls, service references, queues, imports, and other code relationships to connect those repositories into an organisation-level graph.

Now a question can follow the feature instead of stopping at whichever repository happened to be open.

What else changes if I modify this API response?

The answer may not live in the repository containing the API.

5. Context Retrieval

Large context windows make it possible to send more code to an AI.

That does not mean more code should be sent.

Without retrieval

Large codebase
      |
      v
Model searches available context
      |
      v
Reasoning

With CodeZero

Large codebase
      |
      v
Search + structure + relationships
      |
      v
Relevant code and references
      |
      v
Model reasoning

For one engineering question, the useful evidence may only be a few definitions, several references, and code from two or three repositories.

Everything else is noise.

So CodeZero narrows the system first, then gives Claude, Codex, or another coding agent the pieces worth reasoning over.

The objective is not to make the AI read everything. It is to make sure it sees what matters.

6. Coverage & Freshness

Retrieval becomes dangerous when an empty result is treated as proof that something does not exist.

Consider:

This function is not used anywhere.

That is a much stronger statement than:

I couldn't find a reference in the code currently available to me.

CodeZero keeps track of the state behind the result:

  • which repository was searched
  • which commit was indexed
  • whether the repository has been indexed
  • whether the result was truncated
  • whether indexed information may be stale
  • which file and line produced the evidence

That allows the agent to check whether it actually had enough coverage to make a negative claim.

"I couldn't find it" does not automatically become "it doesn't exist."

That is an important distinction when the codebase is too large for any developer - or model - to verify manually.

7. 1M Functions -> The Right Few

CodeZero does not handle a million functions by trying to push a million functions into an LLM.

It makes them searchable, connected, ranked, and traceable first.

Which files matter? → Which symbols connect? → Which repos participate? → Which evidence is strong enough?

Once those questions are answered, the model is no longer reasoning across an entire organisation's source code. It is reasoning across the part of the system that actually matters.

The goal isn't a bigger context window. It's getting the right context before the AI starts coding.


Explore CodeZero

See how CodeZero gives your coding agent the right context across your codebase before the first edit.

Explore CodeZero →

Related in this series: How CodeZero Gives Claude Code and Codex Cross-Repository Context.

SU
Shivam Upadhyay · Frigga
More posts by Shivam →
Engineering insights from the Frigga team.
New posts twice a month. No spam, unsubscribe any time.