Codebase-Memory: Tree-Sitter-Based Knowledge Graphs for LLM Code Exploration via MCP
On the map: LLM agents and tool use → Software engineering coding agents
Abstract (arXiv)
Large Language Model (LLM) coding agents typically explore codebases through repeated file-reading and grep-searching, consuming thousands of tokens per query without structural understanding. We present Codebase-Memory, an open-source system that constructs a persistent, Tree-Sitter-based knowledge graph via the Model Context Protocol (MCP), parsing 66 languages through a multi-phase pipeline with parallel worker pools, call-graph traversal, impact analysis, and community discovery. Evaluated across 31 real-world repositories, Codebase-Memory achieves 83% answer quality versus 92% for a file-exploration agent, at ten times fewer tokens and 2.1 times fewer tool calls. For graph-native queries such as hub detection and caller ranking, it matches or exceeds the explorer on 19 of 31 languages.
Key facts. Cited by 6 papers in the map (data through 14 Oct 2026). Placed in Software engineering coding agents, one of 16 directions in LLM agents and tool use. Builds on 23 of its 37 references that are in the map. First posted on arXiv 28 Mar 2026.
Builds on
23 of 37 references.
Closest ancestors · 7
Same direction, newest first
- 2026Repository Intelligence Graph: Deterministic Architectural Map for LLM Code Assistants15 Jan
- 2025LoCoBench-Agent: An Interactive Benchmark for LLM Agents in Long-Context Software Engineering17 Nov
- 2025GraphCodeAgent: Dual Graph-Guided LLM Agent for Retrieval-Augmented Repo-Level Code Generation14 Apr
- 2025LocAgent: Graph-Guided LLM Agents for Code Localization12 Mar
- 2024OpenHands: An Open Platform for AI Software Developers as Generalist Agents23 Jul
- 2024Agentless: Demystifying LLM-based Software Engineering Agents1 Jul
- 2024SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering6 May
Other references · 16
- 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,455
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,373
- 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 367
- 2024LLMLingua-2: Data Distillation for Efficient and Faithful Task-Agnostic Prompt Compressioncited by 348
- 2023LLMLingua: Compressing Prompts for Accelerated Inference of Large Language Modelscited by 287
- 2024AutoCodeRover: Autonomous Program Improvementcited by 278
- 2022DocPrompting: Generating Code by Retrieving the Docscited by 153
- 2022ReACC: A Retrieval-Augmented Code Completion Frameworkcited by 119
- 2024RepoGraph: Enhancing AI Software Engineering with Repository-level Code Graphcited by 91
- 2024CodexGraph: Bridging Large Language Models and Code Repositories via Code Graph Databasescited by 65
- 2025Enhancing repository-level software repair via repository-aware knowledge graphscited by 27
- 2025Code Graph Model (CGM): A Graph-Integrated Large Language Model for Repository-Level Software Engineering Taskscited by 27
4 more
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approachescited by 23
- 2025cAST: Enhancing Code Retrieval-Augmented Generation with Structural Chunking via Abstract Syntax Treecited by 17
- 2025RANGER -- Repository-Level Agent for Graph-Enhanced Retrievalcited by 7
- 2025SemanticForge: Repository-Level Code Generation through Semantic Knowledge Graphs and Constraint Satisfactioncited by 1
Built on by
Citing papers per year: 2026: 6.
6 papers.
- 2026LARGER: Lexically Anchored Repository Graph Exploration and Retrievalcited by 2
- 2026ObjectGraph: From Document Injection to Knowledge Traversal -- A Native File Format for the Agentic Eracited by 1
- 2026ContextSniper: AntTrail's Token-Efficient Code Memory for Repository-Level Program Repaircited by 1
- 2026EA-Graph: Artifact-Anchored Verification Memory for Coding Agents under Upstream Driftcited by 1
- 2026Executable Code Knowledge: Code as a Native, Validation-Carrying Knowledge Representation for AI Coding Agentscited by 1
- 2026The Thousand-Graph Hypothesis: A Testable Hypothesis of Task-Conditioned Relation Materialization in Repository-Level Code Reasoningcited by 0
- 2026The Thousand-Graph Hypothesis: A Testable Hypothesis of Task-Conditioned Relation Materialization in Repository-Level Code Reasoning27 Aug 2026
- 2026Executable Code Knowledge: Code as a Native, Validation-Carrying Knowledge Representation for AI Coding Agents17 Aug 2026
- 2026EA-Graph: Artifact-Anchored Verification Memory for Coding Agents under Upstream Drift4 Aug 2026
- 2026ContextSniper: AntTrail's Token-Efficient Code Memory for Repository-Level Program Repair2 Jul 2026
- 2026LARGER: Lexically Anchored Repository Graph Exploration and Retrieval8 May 2026
- 2026ObjectGraph: From Document Injection to Knowledge Traversal -- A Native File Format for the Agentic Era30 Apr 2026
Similar, not cited
Close in wording, no citation either way
- 2026ByteRover: Agent-Native Memory Through LLM-Curated Hierarchical Context
- 2024CodeTree: Agent-guided Tree Search for Code Generation with Large Language Models
- 2025Prometheus: Towards Long-Horizon Codebase Navigation for Repository-Level Problem Solving
- 2025Chain-in-Tree: Back to Sequential Reasoning in LLM Tree Search
- 2026Enabling Knowledge Graph Understanding at Scale with the EXplore Your Graphs ENgine (EXYGEN)
- 2026Are you Synthesizing or Recalling? Evaluating LLMs on Algorithmic Code Retrieval
- 2026Reliable Graph-RAG for Codebases: AST-Derived Graphs vs LLM-Extracted Knowledge Graphs
- 2025Optimizing the Interface Between Knowledge Graphs and LLMs for Complex Reasoning