CODESTRUCT: Code Agents over Structured Action Spaces
Summary: arXiv:2604.05407v1
Announce Type: New
Introduction
In the rapidly evolving landscape of artificial intelligence, a breakthrough has been proposed in the realm of code generation and manipulation with the introduction of CODESTRUCT. Traditional Large Language Model (LLM)-based code agents have primarily treated code repositories as unstructured text. This approach has its limitations, notably in the form of brittle string matching which often leads to failures due to formatting drift and ambiguous patterns.
Reframing Code Repositories
CODESTRUCT aims to transform how code agents interact with repositories by reframing the codebase as a structured action space. Instead of focusing on raw text spans, agents operate on named Abstract Syntax Tree (AST) entities. This shift not only enhances the reliability of code manipulations but also improves the overall accuracy of code generation tasks.
Framework Components
The CODESTRUCT framework consists of two primary components:
- readCode: This component retrieves complete syntactic units from code, ensuring that the context is preserved and more accurately understood by the agent.
- editCode: This allows for applying syntax-validated transformations to semantic program elements, thereby minimizing errors associated with text-based editing.
Evaluation and Results
To evaluate its effectiveness, CODESTRUCT was tested on SWE-Bench, a comprehensive benchmark in software engineering. The framework showed significant improvements across six different LLMs:
- Pass@1 accuracy improved by 1.2-5.0%.
- Token consumption was reduced by 12-38% for most models.
- GPT-5-nano, in particular, exhibited a remarkable 20.8% improvement, with empty-patch failures dropping from 46.6% to 7.2%.
Furthermore, on the CodeAssistBench, CODESTRUCT demonstrated consistent accuracy gains ranging from 0.8-4.4%, along with cost reductions of up to 33%. These results underscore the potential of structure-aware interfaces in providing a more reliable foundation for code agents.
Conclusion
The introduction of CODESTRUCT marks a significant advancement in the field of AI-driven code generation and manipulation. By prioritizing structured action spaces over unstructured text, the framework enhances the capabilities of code agents, making them more robust and efficient. As the demand for intelligent code assistants grows, innovations like CODESTRUCT will play a critical role in shaping the future of software development.
