CodePlan: Repository-level Coding using LLMs and Planning
Software engineering activities such as package migration, fixing errors
reports from static analysis or testing, and adding type annotations or other
specifications to a codebase, involve pervasively editing the entire repository
of code. We formulate these activities as repository-level coding tasks.
  Recent tools like GitHub Copilot, which are powered by Large Language Models
(LLMs), have succeeded in offering high-quality solutions to localized coding
problems. Repository-level coding tasks are more involved and cannot be solved
directly using LLMs, since code within a repository is inter-dependent and the
entire repository may be too large to fit into the prompt. We frame
repository-level coding as a planning problem and present a task-agnostic
framework, called CodePlan to solve it. CodePlan synthesizes a multi-step chain
of edits (plan), where each step results in a call to an LLM on a code location
with context derived from the entire repository, previous code changes and
task-specific instructions. CodePlan is based on a novel combination of an
incremental dependency analysis, a change may-impact analysis and an adaptive
planning algorithm.
  We evaluate the effectiveness of CodePlan on two repository-level tasks:
package migration (C#) and temporal code edits (Python). Each task is evaluated
on multiple code repositories, each of which requires inter-dependent changes
to many files (between 2-97 files). Coding tasks of this level of complexity
have not been automated using LLMs before. Our results show that CodePlan has
better match with the ground truth compared to baselines. CodePlan is able to
get 5/6 repositories to pass the validity checks (e.g., to build without errors
and make correct code edits) whereas the baselines (without planning but with
the same type of contextual information as CodePlan) cannot get any of the
repositories to pass them.
6510e1dd11f3210cf7da75e4
Ramakrishna Bairi
extracted_confirmed
2023-09-25T12:37:24.824Z
65117dfad4556f9e65dd9589
/avatars/bbe19aae13b2125688ac57bd830128fd.svg
Ramakrishna B Bairi
user
rkbairi
6510e1dd11f3210cf7da75e5
Atharv Sonwane
admin_assigned
2023-09-25T10:54:17.381Z
64c7c14daf935d3927b99dba
/avatars/704e85446e9908ddb00aea160096b21b.svg
Atharv Sonwane
user
twm-as
6510e1dd11f3210cf7da75e6
Aditya Kanade
admin_assigned
2023-09-25T10:54:33.126Z
649e62e953777d8950749c72
https://cdn-avatars.huggingface.co/v1/production/uploads/649e62e953777d8950749c72/PHigcJ-TQ7HXwriZkBhLV.jpeg
AK
user
adityakanade
6510e1dd11f3210cf7da75e7
Vageesh D C
admin_assigned
2023-09-25T10:54:42.752Z
63916c4b239695d224083de6
/avatars/45f44cea1b313c01f2dec9bb625633c6.svg
.
user
Vageeshdc
6510e1dd11f3210cf7da75e8
Arun Iyer
admin_assigned
2023-09-25T10:54:50.263Z
6493172227ebd33660c65f3b
/avatars/eada49ee732b78b073d4fcae252bd875.svg
Arun Iyer
user
tenaliraman
6510e1dd11f3210cf7da75e9
Suresh Parthasarathy
6510e1dd11f3210cf7da75ea
Sriram Rajamani
extracted_confirmed
2025-04-23T00:40:43.753Z
63fb54480aab060792f71151
/avatars/97edbaed65e87a555bf05f770fa60b23.svg
Sriram Rajamani
user
sriramkr
6510e1dd11f3210cf7da75eb
B. Ashok
6510e1dd11f3210cf7da75ec
Shashank Shet
admin_assigned
2023-09-25T10:55:23.484Z
64c5f012589826641baf1f6f
/avatars/5b059e33d95a42ce219f03a00d11ee2a.svg
Shashank Shet
user
shashankshet
CodePlan: Repository-level Coding using LLMs and Planning
Software engineering activities such as package migration, fixing errors
reports from static analysis or testing, and adding type annotations or other
specifications to a codebase, involve pervasively editing the entire repository
of code. We formulate these activities as repository-level coding tasks.
  Recent tools like GitHub Copilot, which are powered by Large Language Models
(LLMs), have succeeded in offering high-quality solutions to localized coding
problems. Repository-level coding tasks are more involved and cannot be solved
directly using LLMs, since code within a repository is inter-dependent and the
entire repository may be too large to fit into the prompt. We frame
repository-level coding as a planning problem and present a task-agnostic
framework, called CodePlan to solve it. CodePlan synthesizes a multi-step chain
of edits (plan), where each step results in a call to an LLM on a code location
with context derived from the entire repository, previous code changes and
task-specific instructions. CodePlan is based on a novel combination of an
incremental dependency analysis, a change may-impact analysis and an adaptive
planning algorithm.
  We evaluate the effectiveness of CodePlan on two repository-level tasks:
package migration (C#) and temporal code edits (Python). Each task is evaluated
on multiple code repositories, each of which requires inter-dependent changes
to many files (between 2-97 files). Coding tasks of this level of complexity
have not been automated using LLMs before. Our results show that CodePlan has
better match with the ground truth compared to baselines. CodePlan is able to
get 5/6 repositories to pass the validity checks (e.g., to build without errors
and make correct code edits) whereas the baselines (without planning but with
the same type of contextual information as CodePlan) cannot get any of the
repositories to pass them.
CodePlan automates repository-level coding tasks, such as package migration and temporal code edits, using a planning framework that leverages LLMs with context derived from code repositories and change analysis.
Large Language Models LLMs repository-level coding tasks GitHub Copilot incremental dependency analysis change may-impact analysis adaptive planning algorithm