AutoCodeRover - AST-Aware Autonomous Program Repair & SWE Agent

Vendor: nus-apr

AutoCodeRover is an autonomous program repair agent by National University of Singapore (NUS), pioneering Abstract Syntax Tree (AST)-aware code navigation and spectrum-based fault localization for precise bug resolution.

View Repository

Official Preview
AutoCodeRover - AST-Aware Autonomous Program Repair & SWE Agent

Technical Specifications

Repositorynus-apr/auto-code-rover
GitHub Stars★ 3.1k
Forks332 forks
Primary LanguagePython
LicenseNOASSERTION
Technical DomainAGENTS
4.8Overall
Functionality
4.9
Documentation
4.7
Activity
4.7
Ease of use
4.6

Quickstart & Installation

$ bash git clone https://github.com/nus-apr/auto-code-rover.git cd auto-code-rover conda create -n acr python=3.10 conda activate acr pip install -r requirements.txt

Comprehensive Review

AutoCodeRover (nus-apr/auto-code-rover) is an autonomous program repair and software engineering agent developed by the Automated Program Repair (APR) Lab at the National University of Singapore (NUS). The project represents a major technical leap by uniting frontier large language models with classical program analysis techniques—including Abstract Syntax Tree (AST) exploration, spectrum-based fault localization, and test-driven validation—to achieve unprecedented precision in automated software repair.

Architecturally, AutoCodeRover replaces inefficient plaintext keyword searching (grep/find) with an 'AST-Aware Code Navigation' layer. The agent is equipped with structural code exploration skills: it inspects class declarations (search_class), method implementations (search_method_in_class), and call hierarchies at the syntax symbol level. This allows the model to pinpoint root-cause bug locations while consuming minimal context tokens.

The autonomous repair pipeline operates in two structured phases: Phase 1 conducts AST-driven fault localization, while Phase 2 synthesizes targeted patches guided by dense context prompts and validates them against test suites in isolated sandbox environments. By marrying formal program analysis with LLM reasoning, AutoCodeRover achieves industry-leading patch efficacy on complex software engineering benchmarks like SWE-bench.

Project Background

AutoCodeRover was conceived by the NUS Automated Program Repair (APR) Lab to overcome the 'blind keyword exploration' bottleneck that plagues naive LLM agents. When given a complex bug report, conventional coding agents often spam grep commands across thousands of lines of unrelated files, burning excessive tokens while failing to understand class inheritance and call hierarchies, yielding brittle patches that introduce regressions.

The NUS research team integrated formal Abstract Syntax Tree (AST) parsers as the structural eyes of the agent. Instead of treating codebases as flat text files, the agent navigates code as a structured symbol graph, tracing method signatures and class hierarchies with surgical precision and pioneering the neuro-symbolic software engineering paradigm.

Theoretically, AutoCodeRover incorporates Spectrum-Based Fault Localization (SBFL). By contrasting execution coverage differences across failing and passing test paths on the AST, the agent focuses attention on the most suspicious code blocks, transforming bug triage from needle-in-a-haystack searching into targeted surgical repair.

Core Use Cases

In enterprise CI/CD triage pipelines, when automated test suites detect regressions, AutoCodeRover analyzes stack traces, navigates AST methods, and generates passing minimal patches.

In automated vulnerability remediation, AutoCodeRover follows static analysis taint paths along the AST to inject validation logic at vulnerable sinks.

In software engineering research, AutoCodeRover serves as a primary foundation platform for studying the fusion of classical program analysis with large language models.

In codebase exploration, its AST indexing engine constructs method dependency graphs to onboard engineers onto complex legacy systems.

Quickstart Guide

Clone the repository and set up dependencies:

bash
git clone https://github.com/nus-apr/auto-code-rover.git
cd auto-code-rover
conda create -n acr python=3.10
conda activate acr
pip install -r requirements.txt

Configure your LLM provider API credentials:

bash
export OPENAI_API_KEY="your-api-key"

Run AutoCodeRover to localize and resolve a bug report:

bash
python auto_code_rover.py \
  --model gpt-4o \
  --task-desc "Fix KeyError when serializing custom nested fields in marshmallow" \
  --repo-path ./marshmallow \
  --output-dir ./output

Upon completion, AutoCodeRover outputs a fault localization trace and a standard Git diff patch in ./output.

Practicality Assessment

In token efficiency and precision, AST-guided navigation retrieves only the exact function bodies and class signatures needed, reducing fault localization token spend by 70–80% compared to brute-force grep agents.

In operational practice, AutoCodeRover operates most effectively when accompanied by a reliable test suite to validate synthesized patches deterministically.

In cross-language support, the Tree-sitter-based AST parser extends cleanly across Python, Java, TypeScript, and Go.

Real-world Deployments

AutoCodeRover has been featured prominently across top software engineering venues (ICSE/FSE) and the open-source community as a hallmark neuro-symbolic coding agent.

Its AST navigation algorithms are actively studied and integrated by development tooling teams building autonomous code repair and PR review systems.

In a long-term deployment across active open-source repositories, AutoCodeRover autonomously resolved over 50 real-world defects with an 84% first-time human maintainer acceptance rate.

Core Strengths

  • Pioneered AST-aware structural code navigation skills, replacing brittle plaintext grep searches
  • Deep fusion of classical automated program repair (fault localization) with LLM reasoning
  • Two-stage repair pipeline (fault localization + patch verification) minimizing token bloat and hallucination
  • Demonstrated state-of-the-art patch correctness and minimal side-effects on the SWE-bench benchmark

Considerations & Limitations

  • Requires appropriate GPU memory planning and concurrency tuning for production.

Frequently Asked Questions (FAQ)

What is AutoCodeRover - AST-Aware Autonomous Program Repair & SWE Agent and what key challenges does it solve?

AutoCodeRover - AST-Aware Autonomous Program Repair & SWE Agent is an open-source AI project developed primarily in Python under the NOASSERTION license. AutoCodeRover is an autonomous program repair agent by National University of Singapore (NUS), pioneering Abstract Syntax Tree (AST)-aware code navigation and spectrum-based fault localization for precise bug resolution.. AutoCodeRover was conceived by the NUS Automated Program Repair (APR) Lab to overcome the 'blind keyword exploration' bottleneck that plagues naive LLM agents. When given a complex bug report, conventional coding agents often spam grep commands across thousands of lines of unrelated files, burning excessive tokens while failing to understand class inheritance and call hierarchies, yielding brittle patches that introduce regressions. The NUS research team integrated formal Abstract Syntax Tree (AST) parsers as the structural eyes of the agent. Instead of treating codebases as flat text files, the agent navigates code as a structured symbol graph, tracing method signatures and class hierarchies with surgical precision and pioneering the neuro-symbolic software engineering paradigm. Theoretically, AutoCodeRover incorporates Spectrum-Based Fault Localization (SBFL). By contrasting execution coverage differences across failing and passing test paths on the AST, the agent focuses attention on the most suspicious code blocks, transforming bug triage from needle-in-a-haystack searching into targeted surgical repair.

How can I quickly install and run AutoCodeRover - AST-Aware Autonomous Program Repair & SWE Agent locally?

Clone the repository and set up dependencies:

bash
git clone https://github.com/nus-apr/auto-code-rover.git
cd auto-code-rover
conda create -n acr python=3.10
conda activate acr
pip install -r requirements.txt

Configure your LLM provider API credentials:

bash
export OPENAI_API_KEY="your-api-key"

Run AutoCodeRover to localize and resolve a bug report:

bash
python auto_code_rover.py \
  --model gpt-4o \
  --task-desc "Fix KeyError when serializing custom nested fields in marshmallow" \
  --repo-path ./marshmallow \
  --output-dir ./output

Upon completion, AutoCodeRover outputs a fault localization trace and a standard Git diff patch in ./output.

What are the main use cases and strengths of AutoCodeRover - AST-Aware Autonomous Program Repair & SWE Agent?

AutoCodeRover - AST-Aware Autonomous Program Repair & SWE Agent is well-suited for Complex Codebase Automated Bug Repair, AST-Based Code Intelligence & Refactoring, Academic Automated Program Repair Research, CI/CD Defect Remediation Pipelines. With an overall rating of 4.8/5, it offers strong community activity, reliable performance, and easy integration with existing AI pipelines.

What limitations or architectural considerations should be kept in mind for AutoCodeRover - AST-Aware Autonomous Program Repair & SWE Agent?

In token efficiency and precision, AST-guided navigation retrieves only the exact function bodies and class signatures needed, reducing fault localization token spend by 70–80% compared to brute-force grep agents. In operational practice, AutoCodeRover operates most effectively when accompanied by a reliable test suite to validate synthesized patches deterministically. In cross-language support, the Tree-sitter-based AST parser extends cleanly across Python, Java, TypeScript, and Go.