cs.SEMar 28, 2026

Codebase-Memory: Tree-Sitter-Based Knowledge Graphs for LLM Code Exploration via MCP

Authors: Martin Vogel, Falk Meyer-Eschenbach, Severin Kohler, Elias Grünewald, Felix Balzer

Organizations: Independent Researcher, Berlin, Germany · Institute of Medical Informatics, Charité – Universitätsmedizin Berlin, Berlin, Germany · Clinical Study Center, Berlin Institute of Health, Berlin, Germany · Institute of Informatics, Humboldt University, Berlin, Germany · 

Abstract

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.

Figures & tables

Explore similar work

CardsList
  1. CodeGrep: An RL-Trained Retrieval Agent for LLM Coding Agents

    Aug 6, 2026Wuya Chen, Yihao yang, Yang Cao +1AI Coding AgentsLLM Agent Workflow Optimization

  2. ReCUBE: Evaluating Repository-Level Context Utilization in Code Generation

    Mar 26, 2026Jiseung Hong, Benjamin G. Ascoli, Jinho D. ChoiRepository-Level Code GenerationCode Generation Evaluation