Works on My Machine is a newsletter where I share what I’m learning working with AI, demo videos and open source code, and thoughts about where all this is going. In this video, you’ll see a demo of taking a file that needs refactored, decomposing the refactoring into small tasks in Asana, which can then be turned in to PRs in a GitHub repository, using Gemini 2.0 Flash.
What It Does
You specify a file that you want to refactor, an asana project to store the tasks in, and a GitHub repo for the PRs
When you run `ruby refactoring_agent/refactor.rb` it generates an analysis of the file listing out all the places that could be made better
That analysis and code is then passed to an LLM again to generate a list of refactorings to do
Each of those refactorings are then used to create Asana tasks for a human to review, edit, and approve
Once approved, the agent monitoring the Asana board is sent the task and any relevant information to make the refactor and create a PR, again for a human to review, edit, and approve and merge.
Why It Matters
Parallelization is key if you want to take full advantage of AI. By breaking large problems into smaller pieces you not only simplify the problem for the LLM -increasing the success rate - but you also make the problem easier for the human-in-the-loop reviewing the output. No one likes reading a 1000 line PR, let alone one written by an LLM.
How To Get it
All the code for this is available at sublayerapp/property_refactoring_demo on GitHub. The folder that holds all the AI code can be found under the refactoring_agent/ directory. To use it you’ll need an Asana workspace and API keys along with GitHub access tokens for your repository which you can see are set up as environment variables. We also make heavy use of the Sublayer RubyGem for the Generators, Actions, and Agent in the video. If you’re looking for help or have any ideas, stop by the Sublayer Discord and say “hi”, I’ll usually be around and available to chat or to help out with what you’re building.
Share this post