← Back to glossary
+Suggest a term
Concept·Builder Tools·Added today

Codebase knowledge graph

Also known as: code graph, repo graph, code intelligence graph

A structured graph representation of a codebase where nodes are code entities (functions, classes, routes) and edges are relationships (calls, imports, dependencies). AI coding agents query the graph instead of reading raw files, making context retrieval far more token-efficient.

Standard RAG (retrieval-augmented generation, the technique of fetching relevant text chunks before asking a model a question) works well for prose but struggles with code. Code has structure: a function calls other functions, a class imports from other modules, an API route connects to a handler that connects to a database schema. A flat vector search over code chunks loses most of that relational signal.

A codebase knowledge graph preserves it. Tools like Gortex and codebase-memory-mcp (another trending project from mid-2026) parse a repo with a syntax-aware parser such as tree-sitter and store the result as a graph with typed edges. When a coding agent wants to understand 'what happens when this endpoint is called,' it can traverse the call graph rather than reading hundreds of files.

The practical benefit is token economy. Agents that navigate a graph instead of reading files can answer the same questions with far less context, which matters both for latency and cost. The pattern is increasingly treated as a foundational layer for production coding agents working on large codebases, and it sits at the intersection of traditional code intelligence (IDE features like go-to-definition) and LLM tooling.

This definition is AI-generated and refreshed weekly. It may contain inaccuracies. Use your own judgment, especially for production decisions.
Related terms
GortexCoding agentAgentic codingContext windowRAG