Title: Hi HN! We’re William and Kevin, cofounders of Sweep (<a href="https:&#x2F;&#x2F;sweep.dev&#x2F;">https:&#x2F;&#x2F;sweep.dev&#x2F;</a>). Sweep is an open-source AI-powered junior developer. You describe a feature or bugfix in a GitHub issue and Sweep writes a pull request with code. You can see some examples here: <a href="https:&#x2F;&#x2F;docs.sweep.dev&#x2F;examples">https:&#x2F;&#x2F;docs.sweep.dev&#x2F;examples</a>.<p>Kevin and I met while working at Roblox. We talked to our friends who were junior developers and noticed a lot of them doing grunt work. We wanted to let them focus on important work. Copilot is great, but we realized some tasks could be completely offloaded to an AI (e.g. adding a banner to your webpage <a href="https:&#x2F;&#x2F;github.com&#x2F;sweepai&#x2F;landing-page&#x2F;issues&#x2F;225">https:&#x2F;&#x2F;github.com&#x2F;sweepai&#x2F;landing-page&#x2F;issues&#x2F;225</a>).<p>Sweep does this with a code search engine. We use code chunking, ranking, and formatting tricks to represent your codebase in a token-efficient manner for LLMs. You might have seen our blog on code chunking here: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=36948403">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=36948403</a>.<p>We take these fetched code snippets and come up with a plan to write the PR. We found that having the LLM provide structured information using XML tags is very robust, as it’s easy for us to parse with regex, has good support for multi-line answers and is hard for the LLM to mess up.<p>This is because XML is common in the LLM’s training data (the internet &#x2F; HTML), and the opening and closing tags rarely appear naturally in text and code, unlike the quotations, brackets, backticks and newlines used by JSON’s and markdown’s delimiters. Further, XML lets you skip the preamble (“This question has to do with xyz. Here is my answer:”) and handles multi-line answers like PR plans and code really well. For example, we ask the LLM for the new code in &lt;new_code&gt; tags and a final boolean answer by writing &lt;answer&gt;True&lt;&#x2F;answer&gt;.<p>We use this XML format to get the LLM to create a plan, generating a list of files to create and modify from the retrieved relevant files. We iterate through the file changes and edit&#x2F;create the necessary files. Finally, we push the commits to GitHub and create the PR.<p>We’ve been using Sweep to handle small issues in Sweep’s own repo (it recently passed 100 commits). We’ve become well acquainted with its limitations. For example, Sweep sometimes leave unimplemented functions with just “# rest of code” since it runs on GPT-4, a model tuned for chatting. Other times, there’s minor syntax errors or undefined variables. This is why we spend the other half of our time building self-recovery methods for Sweep to fix and test its PRs.<p>First, we invite the developer to review and add comments to Sweep’s pull request. This helps to a point, but Sweep’s code sometimes wouldn’t lint. This is table stakes. It’s frustrating to have to tell the bot to “add an import here” or “this variable is undefined”.
To make this better, we used GitHub Actions, which automatically runs the flow of “check the code → tell sweep → sweep fixes the code → check the code again”. We like this flow because you might already have GitHub Actions, and it’s fully configurable. Check out this blog to learn more <a href="https:&#x2F;&#x2F;docs.sweep.dev&#x2F;blogs&#x2F;giving-dev-tools">https:&#x2F;&#x2F;docs.sweep.dev&#x2F;blogs&#x2F;giving-dev-tools</a>.<p>So far, Sweep isn’t that fast, can’t handle massive problems yet, and doesn’t write hundreds of lines of code. We’re excited to work towards that. In the meantime, a lot of our users have been able to get useful results. For example, a user reported that an app was not working correctly on Windows, and Sweep wrote the PR at <a href="https:&#x2F;&#x2F;github.com&#x2F;sweepai&#x2F;sweep&#x2F;pull&#x2F;368&#x2F;files">https:&#x2F;&#x2F;github.com&#x2F;sweepai&#x2F;sweep&#x2F;pull&#x2F;368&#x2F;files</a>, replacing all occurrences of &quot;&#x2F;tmp&quot; with &quot;tempfile.gettempdir()&quot;. Other examples include adding a validation function for Github branch name (<a href="https:&#x2F;&#x2F;github.com&#x2F;sweepai&#x2F;sweep&#x2F;pull&#x2F;461">https:&#x2F;&#x2F;github.com&#x2F;sweepai&#x2F;sweep&#x2F;pull&#x2F;461</a>) and adding dynamically generated initials in the testimonials on our landing page (<a href="https:&#x2F;&#x2F;github.com&#x2F;wwzeng1&#x2F;landing-page&#x2F;issues&#x2F;28">https:&#x2F;&#x2F;github.com&#x2F;wwzeng1&#x2F;landing-page&#x2F;issues&#x2F;28</a>). For more examples, checkout <a href="https:&#x2F;&#x2F;docs.sweep.dev&#x2F;examples">https:&#x2F;&#x2F;docs.sweep.dev&#x2F;examples</a>.<p>Our focus is on finding ways that an AI dev can actually help and not just be a novelty. I think of my daily capacity to write good code as a stamina bar. There’s a fixed cost to opening an IDE, finding the right lines of code, and making changes. If you’re working on a big feature and have to context switch, the cost is higher. I’ve been leaving the small changes to Sweep, and my stamina bar stays full for longer.<p>Our repo is at <a href="https:&#x2F;&#x2F;github.com&#x2F;sweepai&#x2F;sweep">https:&#x2F;&#x2F;github.com&#x2F;sweepai&#x2F;sweep</a>, there’s a demo video at <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=WBVna_ow8vo">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=WBVna_ow8vo</a>, and you can install Sweep here: <a href="https:&#x2F;&#x2F;github.com&#x2F;apps&#x2F;sweep-ai">https:&#x2F;&#x2F;github.com&#x2F;apps&#x2F;sweep-ai</a>. We currently have a freemium model, with 5 GPT-4 PRs at the free tier, 120 GPT-4 PRs at the paid tier and unlimited at the enterprise tier.<p>We’re far from our vision of a full AI software engineer, but we’re excited to work on it with the community feedback :). Looking forward to hearing any of your thoughts!
Upvote: