What is code context for an AI coding agent?
The short answer
Code context is the source code and related information an AI coding agent receives so it can understand and perform a software-development task. Code context may include files, functions, classes, types, imports, callers, dependencies, documentation, configuration, tests and repository structure.
Context, as an agent receives it
Not a file and not a summary: spans of real code with their path and line, so the agent can cite what it is telling you.
Categories of code context
"Code context" is a broad term. It's useful to break it down into distinct categories, since different tasks lean on different kinds of context and not every system that provides code context covers all of them.
Textual context
The actual source code itself: the literal text of a file, function or class, as it would appear in an editor.
Structural context
The functions, classes, files and modules that make up a repository, and how they are organized, independent of any single relationship between them.
Relational context
The explicit relationships between structural elements: which functions call which, which modules import which, which dependencies a package declares, and which classes inherit from which.
Historical context
Git history, prior commits, and how a piece of code has changed over time, where that history is available.
Operational context
Runtime configuration, environment variables, and infrastructure details that affect how code actually behaves when it runs.
Business context
Requirements, tickets, and product knowledge that explain why a piece of code exists and what it's meant to do, context that typically lives outside the repository itself.
What CodeMesh covers today
CodeMesh's structural graph covers textual, structural and relational context: it parses functions, classes, imports and calls, and resolves the relationships between them, alongside the source text those entities are drawn from.
Historical, operational and business context are real categories of code context, but they are outside CodeMesh's current structural-graph scope: CodeMesh does not claim to index git history, runtime environments or product/ticket data today.
See what structural code context looks like
CodeMesh retrieves the textual, structural and relational context a coding agent needs, directly from your repository.