What's Sweep?

Sweep: AI-powered junior dev

Bug Reports & Feature Requests โŸถย  Code Changes

Sweep is an AI junior developer that transforms bug reports & feature requests into code changes.

Describe bugs, small features, and refactors like you would to a junior developer, and Sweep:

  1. ๐Ÿ” reads your codebase
  2. ๐Ÿ“ plans the changes
  3. โšกwrites a pull request with codeโšก

See highlights at https://docs.sweep.dev/about/examples (opens in a new tab).

๐Ÿš€ Install Sweep

Setting up Sweep is as simple as adding the GitHub bot to a repo, then creating an issue for the bot to address. We support all languages that GPT4 supports, such as Python, Typescript, Rust, Go, Java, C# and C++.

  1. Add the Sweep GitHub app (opens in a new tab) to your desired repos
  2. Create new issue in your repo, like "Sweep: Handle this feature on my backlog ....". If there's an existing issue, label it with the purple "Sweep" label.

๐Ÿ’ก How to Use Sweep

You can use Sweep to create pull requests - a set of code changes that can be independently tested and merged. Sweep can do this in a couple of ways.

Creating Pull Requests to handle an Issue

First, you can assign Sweep a task like squashing an old bug in your backlog. To do this, create or use an existing GitHub issue. This issue should be detailed enough for a junior engineer (Sweep) to find the correct files and make the appropriate code changes.

Assigning Sweep to an Existing Issue

To have Sweep create a PR for an existing issue, label the issue with the purple "Sweep" label (added to your repository when Sweep is installed).

How to label a GitHub issue with Sweep

Assigning Sweep to a New Issue

To have Sweep create a PR for a new issue, create a new issue with the title "Sweep: [title of issue]".

How to create a new GitHub issue with Sweep

Best Practices for Creating Issues

For harder problems, try to provide the same information a human would need.

  • Title: โ€œSweep: create a new search query filtering agent that will be used in ticket_utils.pyโ€

  • Description: โ€œWe have keyword search in lexical_search.py, and weโ€™d like to filter out unnecessary keywords using an agent and a prompt. Use the file name_agent.py as a referenceโ€

For simpler problems, providing a single line and a reference file should suffice.

  • Title: โ€œSweep: Add docstrings to main/api.pyโ€

  • Description: โ€œUse the file main/github_utils.py as a referenceโ€

Improving Sweep's PRs

Sweep wonโ€™t always get it right, as language models arenโ€™t as reliable for as weโ€™d like them to be.
Sweep has a couple of ways to deal with this though:

Running your GitHub Actions

Sweep defines and runs GitHub actions for you. After the PR is created, Sweep will work asynchronously until it fixes your CI. At this point, you can either try to fix it yourself or wait until Sweep completes it.

Having Sweep edit an existing PR

If you want Sweep to make an edit to it's previous change, you can leave a comment on it's PR. Sweep supports two types of comments - specific and general.

[!NOTE] All comments must be prefixed with "Sweep: "

Review Comments (Specific)

You can create a specific comment by making a review comment. This comment will only modify the file thatโ€™s been commented on.

Creating a review comment on GitHub for Sweep to handle

Issue Comments (General)

You can create a general comment by making an issue comment. This comment can perform codebase wide changes.

Creating a review comment on GitHub for Sweep to handle

Merge Conflict Resolution

When you create a pull request, Sweep will automatically resolve merge conflicts via a new pull request. The new pull request will contain the same changes as the original pull request, but with the merge conflicts resolved.

How Sweep resolves merge conflicts

๐Ÿค Contributing

Contributions are welcome and greatly appreciated! For detailed guidelines on how to contribute, please see the CONTRIBUTING.md file. For more detailed docs, see ๐Ÿš€ Quickstart (opens in a new tab).

๐Ÿ“˜ Story

We were frustrated by small issues, like simple bug fixes, annoying refactors, and small features. Each task required us to open our IDE to fix simple bugs. So we decided to leverage the capabilities of ChatGPT to address this directly in GitHub.



and, of course, Sweep!