BlogAI & ML

How to Test Whether AI Agents Understand a Codebase

A codebase question answering benchmark asks AI agents real questions about real code. What our 700 questions showed about where agents stop too early.

Nomos Insights
Updated 7 min read

Most people test coding agents by asking them to fix a bug. Benchmarks like SWE-bench: Can Language Models Resolve Real-World GitHub Issues?, a test set built from real GitHub issues, work this way: you hand the agent a real issue, it changes some code, and the tests tell you if it worked. That is useful. It also misses a big part of what engineers actually do all day, which is reading. You open a codebase you have never seen, someone asks you a question, and you work out the answer by tracing the code.

A codebase question answering benchmark tests that reading skill directly. An AI agent gets a real software project it has never seen and a question written the way an engineer would ask it. The agent explores the code and writes an answer, which is graded against a list of facts that experts have already verified by running the code.

Our team spent several months building one. We wrote around 700 questions about large, real open source codebases written in Go, C, TypeScript and Python. The AI agent, a model that can run commands and read files on its own, gets a read-only copy of the code in a sandbox, a step limit and a question. It cannot reach the internet. At the end it writes an answer, and a judge model (a separate AI model used as a grader) scores that answer against a list of facts our engineers wrote down and verified.

Key Takeaways
  • We wrote around 700 questions about real open source codebases in Go, C, TypeScript and Python.
  • When a question named a case, the strongest model usually caught it. When the same case was covered but not named, it missed it most of the time.
  • Most misses were not wrong claims. They were cases the agent never reached because it stopped early.
  • Every fact in a scoring list was checked by running code, and a reference answer was only accepted once it matched that verified list perfectly.

What makes a good codebase question?

One that sounds like a real person asking for help, and that cannot be answered by searching for its own words. It usually describes one problem someone ran into, sometimes includes a wrong guess from a colleague, and then asks about the bigger picture. So instead of "what does function X do", the question might say that a customer saw a strange result after a restart and ask which other cases could behave the same way.

We never name the file or the function. If the words in the question lead straight to the answer with a simple search, the task is not testing anything. We had a blunt rule for this: if you can search for the symptom and land on the answer file, throw the question away and find a better one.

About half of our questions were about architecture and system design. The rest covered code onboarding, root cause analysis, security and API integration.

Where did the agents get lost?

The most useful part of the project was reading agent answers against our fact lists and seeing the same mistakes over and over across hundreds of questions. A few patterns stood out to our team:

  • Cases the question covers but does not name. When a question named a case directly, the strongest model we tested usually handled it. When the question covered the same case without naming it, the same model missed it most of the time.
  • Inputs nobody showed. Empty values, odd line endings, unusual casing, missing fields. Models rarely invent awkward inputs on their own.
  • Behavior decided by a library or the operating system. Agents often assume the simple behavior instead of checking what the dependency really does.
  • Long chains. When the answer needed three or more places in the code, agents tended to explain the first break and stop.

What surprised us was how often the model failed by silence. Most misses were not wrong claims. They were cases the agent never reached. It found the main story, wrote a confident answer and stopped. That is the gap our engineers write questions to test: describe one symptom, leave the other affected cases unnamed, and put those cases in the fact list. We dug into that pattern in more detail in Why AI Agents Miss Edge Cases Nobody Mentions.

How do you keep a hard question fair?

Prove every fact in running code before it goes on the list, and give credit for facts, never for methods. Making a question hard is easy. Making it hard and fair at the same time is the real work. Our experts wrote every question and every scoring list. Every fact in a scoring list had to be reachable from the question. Every fact had to be checked by actually running code, not by reading it and guessing. And we graded the fact itself, never the method the agent used to find it, the approach we explain in How to Write a Fair Grading Rubric for AI Answers.

The reference answer had to clear the same bar. Strong models attempted each task, and an attempt was only considered if it scored perfectly against our list. Because our experts had already verified every fact on that list in the code, a perfect score meant every fact in the answer was verified too. Finally, the reference was scored again to make sure the judge agreed. If an attempt contained something true that we had not listed, our engineers confirmed it in the code and went back and fixed the list.

What we took away

Reading code is a skill current agents are still building. They are fast and confident, but they stop early, they trust the obvious path, and they skip the strange inputs a careful engineer would try. Our engineers aim each question at exactly those gaps, and check every fact hard enough that nobody can argue with the grade. Bug fixing work shows a similar habit. When our annotators studied agent trajectories step by step, most failed runs went wrong at the diagnosis, before any code was written. How we kept a project this size moving day to day is in How to Run a Large AI Evaluation Data Project.

Quick answers

What is a codebase Q&A benchmark? A set of questions about real software projects. An AI agent explores the code in a sandbox and writes an answer, which is graded against a list of verified facts.

How is it different from bug fixing benchmarks? Bug fixing checks if the agent can change code so tests pass. Codebase Q&A checks if the agent truly understands how the code behaves, including cases nobody mentioned.

Why do strong models fail these questions? In the answers our team read, mostly because they stop early. They explain the main path and never reach the edge cases, the second consumer, or the behavior that depends on a library.

Can the agent change the code during a codebase Q&A task? No. In our setup the agent works on a read-only copy in a sandbox with no internet access. It can run commands and read files, but its job is to explain the code, not to patch it.


Need Codebase Questions Your Agent Cannot Shortcut?

Our Model Evaluation and Rubrics team writes codebase questions and fact lists for AI labs and model teams, and checks every fact by running the code. If you need a set like this built to a strict quality bar and delivered in time for your next evaluation round, we can take it on.

Get in Touch
Filed underCodebase Q&AAI Coding AgentsAgentic EvaluationBenchmarks