arXiv(opens in a new tab)cs.SEAug 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2608.24221

DeepRepoQA: Code Repository Question Answering with Deep Agent Exploration

Weihan Peng, Yuling Shi, Yingwei Ma, Longfei Yun, Beijun Shen, Xiaodong Gu

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original. This text is shared under the same licence.

Abstract

Answering developer questions about a software repository is a critical yet under-explored problem in software engineering. While existing repository understanding methods have advanced the field, they predominantly rely on surface-level code retrieval and lack the ability for deep reasoning over multiple files, complex software architectures, and grounding answers in long-range code dependencies. To address these limitations, we propose DEEPREPOQA, a novel question answering (QA) framework for repository-level code understanding. DEEPREPOQA builds on the agentic framework where LLM agents find answers through a systematic tree search over the repository structure. A Monte-Carlo Tree Search (MCTS) mechanism is employed to empower agents to dynamically search, navigate, and inspect code, enabling effective multi-hop reasoning over long-range code dependencies. Comprehensive experiments on the SWE-QA benchmark demonstrate substantial performance gains over strong baselines, validating the effectiveness of systematic MCTS-guided exploration for multi-hop repository reasoning.

1 Introduction

Answering questions about a software repository is an underexplored yet critical problem (Liu and Wan, 2021; Peng et al., 2026; Chen et al., 2025a). To accomplish a function or resolve an issue, developers frequently need to navigate large, interconnected codebases, trace dependencies across multiple files, and synthesize architectural knowledge in order to answer complex questions (Jimenez et al., 2024; Zhang et al., 2023; Ouyang et al., 2024). With the rapid advancement of LLMs (Yao et al., 2023; Yang et al., 2024), there is growing interest in repository-aware assistants that can provide end-to-end support for such tasks.

Despite rapid progress, existing repository understanding methods often operate at the function level (Huang et al., 2021; Liu and Wan, 2021; Lee et al., 2022; Li et al., 2024; Sahu et al., 2024) or rely on basic retrieval-augmented generation (RAG) that surfaces local fragments of code (Zhang et al., 2023). These approaches are ill-suited to deep repository reasoning, where answers require following call chains across files, combining dispersed evidence, and articulating architectural intent (Ouyang et al., 2024). ReAct-style agents (Yao et al., 2022), such as OpenHands (Wang et al., 2025b), address some of these limitations by introducing single-path, reasoning-augmented interaction, allowing models to interleave action execution and reasoning for multi-step question answering. While they enable basic planning and verification, their single-path design still constrains exploration: important evidence may be missed if it lies outside the chosen trajectory, and reasoning depth is limited by sequential execution. Moreover, balancing exploration and exploitation remains challenging, which can result in retrieval bias or incomplete synthesis of cross-file dependencies.

To address these limitations, we propose DEEP-REPOQA 1^{1}, a novel agentic question answering (QA) framework for repository-level deep understanding. Unlike flat retrieval pipelines (Zhang et al., 2023), DEEPREPOQA casts QA as a deep search-and-verify process over the repository structure, enabling LLM agents to systematically explore repositories and synthesize evidence before producing answers. The framework defines a compact, semantically meaningful action space spanning semantic search, structural navigation, and targeted code inspection. Given a question, the agent initializes a search tree and iteratively (i) perceives the current state and reasoning trajectory, (ii) plans the next step, (iii) executes the action

✉ Corresponding author

1^{1}https://github.com/peng-weihan/DeepRepoQA

Figure

Figure 1: Overview of the DEEPREPOQA framework.

over an index-backed representation to gather verifiable evidence, and (iv) evaluates utility to steer future exploration. Collected evidence is curated and appended to a memory path from the root to the current node; this path structures prompts, stabilizes reasoning, and, once sufficient evidence is collected, enables synthesis of a final answer grounded in cited code spans. Compared to single-path ReAct-style agents (Peng et al., 2026), our approach introduces two key innovations: (1) an iterative search-and-verify process via MCTS for multi-hop repository reasoning, and (2) learned priors/values from LLM feedback that reduce search depth and drift. Together, these elements transform repository QA from ad-hoc retrieval to systematic search with consistent, evidence-based answers.

We evaluate DEEPREPOQA on the SWE-QA benchmark (Peng et al., 2026) across multiple LLM backbones, including Kimi K2, GLM-4.6, Qwen3-Coder-480B-A35B-Instruct and GPT-5.1. DEEPREPOQA achieves consistent improvements over strong baselines. On all models, DEEPREPOQA outperforms existing state-of-the-art ReAct-style agents, with the largest gain of 7.08 points over SWE-agent on Qwen3-Coder-480B-A35B-Instruct. DEEPREPOQA also surpasses or matches leading commercial tools such as Cursor and Tongyi Lingma when using GPT-5.1 and Kimi K2.

Ablations highlight the critical importance of MCTS, while semantic search, Evaluation Agent, and Perception Agent further enhance stability and efficiency. Efficiency analysis demonstrates that DEEPREPOQA achieves strong performance in both computational cost and answer quality. Furthermore, a case study shows that our MCTS-guided, verification-centric exploration mitigates retrieval bias by grounding answers in cross-file evidence.

Our contributions are as follows:

• We propose an agentic QA framework for repository understanding, enabling structured, verifiable multi-hop reasoning over long-range code dependencies.

• We introduce MCTS-guided exploration with LLM feedback and memory for efficient, repository-grounded search.

• We conduct a comprehensive evaluation on SWE-QA, demonstrating consistent improvements over state-of-the-art baselines.

References (3)

  • If you want to scale target variables, you would need to:
  • The agent is responsible for identifying and modifying the correct file(s) in response to the problem statement
  • Verify that the correct sections of code are being modified, regardless of their current line numbers