A codebase feeding an agent, with a retrievable context layer alongside it supplying architecture, ownership, conventions, incidents, and policies.Knowledge held in a person's head on one side versus the same knowledge written into a retrievable store an agent can query on the other.A past decision, with its reasoning, being captured into the context store so the next agent or teammate can retrieve it rather than rediscover it.
Skip to content

Make the codebase and its context agent-ready

TL;DR: An agent can only reason about what it can retrieve, so the knowledge it needs has to be written down where the agent can reach it.

  • Give agents the surrounding context: architecture, ownership, conventions, past incidents, and compliance requirements, not just the diff.
  • Write down what lives only in people's heads and chat threads, and keep the context already in your delivery records connected to the code.
  • Capture the decisions and precedent behind the rules, not only the rules themselves.
  • Maintain context as part of the software lifecycle, the way you maintain tests and documentation.


An agent working in your codebase is only as good as the context it can get to. A human reviewer fills gaps with institutional memory, a hallway conversation, or years of intuition about how a system behaves. An agent has none of that to fall back on, so when the information it needs isn’t written down and retrievable, it guesses or stalls.1 This page is about making a codebase agent-ready: what agents need access to, how to move that knowledge out of people's heads, and why this is part of the work rather than overhead added later.

What agents need access to

A review or a change needs far more than the diff in front of it. To reason well, an agent needs the surrounding context: the repository’s structure and dependencies, the architectural constraints and service boundaries, the API contracts and backward-compatibility expectations, the coding standards and conventions, the history of incidents and postmortems, the earlier review comments and the trade-offs a team has already accepted, the security and compliance requirements, and the documentation that explains why a system behaves the way it does. Much of this a person carries implicitly; an agent needs it made explicit and retrievable.1

Get knowledge out of people’s heads

The knowledge agents need mostly exists already, but it lives in the wrong places: in people’s heads, in chat threads, in the habits of long-tenured reviewers. For an agent, that’s the same as not existing. Making a codebase agent-ready means writing that knowledge down in a structured form, close to the code and work it explains, so the environment holds operational knowledge and intent alongside the code itself.1 This is the same idea as making the work itself legible: once knowledge is written down, automation can act on it, and the bottleneck becomes the clarity of what you've captured rather than the supply of people who happen to know it.2

The knowledge that agents need falls into two groups. The first is knowledge that has never been written down: the reasoning behind a design, the unwritten rule a senior reviewer applies, or the reason a workaround exists. That knowledge has to be captured. The second already exists as a record of the work itself. This includes the issues that set out requirements, the merge requests and review threads that shaped the code, the pipeline and deployment history, incidents and postmortems, and security findings. For that context, the work is keeping it connected to the code it describes, so an agent can follow the thread from a line of code back to the requirement, review, or incident behind it. Copying those records into a separate store breaks the links, and the copy drifts from the source as soon as the work moves on.

Making organizational context available to agents in GitLab Well Architected covers how to find the information a task requires, connect it to maintained sources, and help agents spot missing access, conflicting facts, and untrusted instructions.

Design for small, separable units

Agents add complexity on the assumption they can always handle it, which holds until it doesn't. Structure is where people still contribute most: separating concerns so each part can be tested alone and then together. The fastest teams work in small units on a modular codebase so changes do not collide, and “small” applies to every dimension, including change size, module size, and test scope. A system generated in one shot leaves only end-to-end tests to check it. The modules that suit agents may be smaller than the ones people would choose.

Capture precedent and decisions, not just rules

Rules alone aren’t enough, because human reviewers don’t judge against rules alone. They judge against decisions the team has already made: why a similar approach was rejected six months ago, why a subsystem intentionally breaks a normal convention, why performance is prioritized over readability on one path. That reasoning needs to be captured next to the code or decision it explains, where an agent can reach it, or it stays a gap no amount of model capability can fill.1

Treat context as infrastructure built into the lifecycle

Making context available isn’t a one-time cleanup or overhead bolted on after you adopt agents. It’s part of the software lifecycle itself, maintained as the code changes, the same way tests and documentation are. In the agent era, the context you write down becomes infrastructure: the thing you capture to diagnose a problem is the thing you publish so it doesn’t recur, and the context an agent draws on is as load-bearing as the code it reasons about.34

Review and test agents need context that spans services. In a stack of 500 services with authentication, backends, and payments, an agent that decides which tests to run needs centralized context from earlier commits, comments, and pipelines, or the approach does not scale. One security team gave itself a workspace that can query every application repository, wrote what it cares about into skills, and let those skills flow into developers' workspaces and, eventually, into continuous integration. If requests are routed across models, rules such as payment card requirements must travel with whichever model is selected.

In practice: Turning a hard lesson into retrievable policy

One security company1 built its product with AI from the start and ran its own agentic review on every change, with agent-written code unable to merge until it was reviewed and approved. In beta, it hit the kind of problem that makes multi-tenant security concrete: customer data could be reached across tenant boundaries. In a multi-tenant product, tenant isolation and authorization aren’t implementation details, they’re part of the security contract, and a generic “does this diff look secure?” review would never reliably catch a violation of it.

The lesson from that incident couldn’t be left in memory, Slack threads, or the habits of whoever happened to review a change. It had to become context the review system could reach: how authentication should work, where authorization checks must happen, how tenant context is enforced, and how customer data stays separated, encoded as policy the system checks every time the code changes. What made the review valuable wasn’t a smarter model; it was turning what the organization had already learned into part of the verification path, in a form that stays stable even as the underlying models and agents change.1

Try this. Give an agent one real task in your codebase, something small but genuine, and watch where it reaches for context that isn't written down: an ownership boundary, a convention, a past decision, a compatibility rule. Each gap it hits is a candidate to capture in retrievable form. For each gap, note whether the knowledge was never written down or already exists in an issue, review thread, or incident record the agent couldn't reach. The first calls for writing it down, and the second calls for connecting it.

// References

  1. Davis, Zach, and Michelle Gill, Elisabeth Hendrickson, Angie Jones, Sha Ma, Randy Shoup, and James Wickett. "Agentic AI and Code Reviews: Toward a Pattern Language for Code Reviews in the Age of Agentic AI." Enterprise Technology Leadership Journal 3, no. 2 (Fall 2026). https://itrevolution.com/product/agentic-ai-and-code-reviews/.
  2. Eslick, Ian, and Collin Fox, Amanda Graham, Suzette Johnson, Chuck Lafferty, Tom Kilcommons, Rosalind Radcliffe, Cat Swetel, Annie Vella, Sam Yeats, and Robin Yeman. "The Sociotechnical Architecture of AI-Enabled Enterprises: Principles, Patterns, and Practices for Human-Governed AI." Enterprise Technology Leadership Journal 3, no. 2 (Fall 2026). https://itrevolution.com/product/sociotechnical-architecture-of-ai-enabled-enterprises/.
  3. Cochran, Timothy, and Bryan Finster, Tim Ottersburg, Scott Prugh, and Amy Willard. "When Coding Is Free, Where Is the Bottleneck? A Guide for Leaders Building Agent-Ready Delivery Systems." Enterprise Technology Leadership Journal 3, no. 2 (Fall 2026). https://itrevolution.com/product/when-coding-is-free/.
  4. Cockcroft, Adrian, and Jeremy Eder, Joseph Enochs, Jenn Spykerman, and Brian Wald. "When Agents Decide: Continuous Decision Intelligence and the Substrate Beneath It." Enterprise Technology Leadership Journal 3, no. 2 (Fall 2026). https://itrevolution.com/product/when-agents-decide/.

/ Go deeper on this topic

Governing and scaling