CODESTRUCT: Code Agents over Structured Action Spaces
Myeongsoo Kim, Joe Hsu, Dingmin Wang, Shweta Garg, Varun Kumar, and Murali Krishna Ramanathan

TL;DR
This paper introduces CODESTRUCT, a structured approach for code agents that operates on AST entities rather than unstructured text, leading to improved accuracy and efficiency across multiple benchmarks.
Contribution
Reframes codebase interaction as structured actions on AST entities, providing syntax-validated transformations and demonstrating significant accuracy and cost improvements.
Findings
Improves Pass@1 accuracy by 1.2-5.0% on SWE-Bench.
Reduces token consumption by 12-38% for most models.
GPT-5-nano's valid patch rate increases by 20.8%, with fewer empty patches.
Abstract
LLM-based code agents treat repositories as unstructured text, applying edits through brittle string matching that frequently fails due to formatting drift or ambiguous patterns. We propose reframing the codebase as a structured action space where agents operate on named AST entities rather than text spans. Our framework, CODESTRUCT, provides readCode for retrieving complete syntactic units and editCode for applying syntax-validated transformations to semantic program elements. Evaluated on SWE-Bench Verified across six LLMs, CODESTRUCT improves Pass@1 accuracy by 1.2-5.0% while reducing token consumption by 12-38% for most models. Models that frequently fail to produce valid patches under text-based interfaces benefit most: GPT-5-nano improves by 20.8% as empty-patch failures drop from 46.6% to 7.2%. On CodeAssistBench, we observe consistent accuracy gains (+0.8-4.4%) with cost…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
