CARA: An AI-Powered Code Review Companion

I found my happy place coding again over a recent break. I can't emphasize how good it feels to get knee-deep in code, in the zone, and using Go. But as much as I love solo coding, I've always missed having that second pair of eyes on my pull requests. So, I decided to build something to fill that gap - meet CARA, my Code Analysis and Review Assistant.

How CARA Came to Be

The idea for CARA actually came from a chat with my VC friend Zoe over at Dawn Capital. We were discussing the latest in fintech and B2B SaaS, aspart of my role in technology for Visa Innovation Europe. Zoe mentioned a trend of startups working on AI-powered code review tools. My immediate thought? "Well, that's super easy."

Famous last words, right?

I decided to put my money where my mouth was and build it myself. Turns out, it wasn't quite as trivial as I first thought (is it ever?), but after wrestling with a few unexpected hurdles, I managed to bring CARA to life.

What CARA Does

At its core, CARA is an AI sidekick for your coding journey. It automatically reviews your pull requests, looking at the changes you've made to the codebase. But it doesn't just look at the diff - it considers the context around your changes too.

Here's what CARA brings to the table:

  1. It gives you detailed insights into how you might improve your code.
  2. It provides a high-level overview of your changes.
  3. It suggests code snippets you can implement right away.
  4. And the best part? It works with any programming language.

The Tech Behind CARA

I built CARA's backend in Go (because of course I did). It integrates with GitHub's API, so once you install it as a GitHub app, it just works. Every time you open a pull request, CARA kicks into action.

For the AI integration, I started off using OpenAI's models but later switched to Anthropic. Their model right now is better, and you have to use the right tool for the job. After OpenAI's o1 release, I might integrate some of that functionality into deeper requirements.

To make sure CARA keeps running smoothly even if there are API hiccups, I implemented a queuing system. Your code reviews won't get lost - CARA will patiently wait and process all requests as soon as the service is back up.

Why CARA is cool

I've been using CARA for a while now and it's been awesome. There have been so many times where I've read CARA's comments and thought, "Oh wow, didn't think of that" or "That's a cool way to implement this".

Here's why CARA has become indispensable for me:

  • It saves a ton of time on code reviews.
  • It catches potential bugs before they sneak into the codebase.
  • It suggests optimisations I might not have considered.
  • It gives me that crucial "second pair of eyes" when I'm coding solo.
  • It's helping me become a better developer by pointing out best practices.

The Challenges and What's Next

Building CARA hasn't been without its challenges. One of the trickiest parts has been getting the code comments in exactly the right place. It's surprisingly complex - the comments need to be aligned correctly, proportional to the file, and take into account GitHub's display quirks. I'm over 90% accurate now, but there are still a few edge cases to iron out.

My next big plan for CARA is to make it even smarter. Right now, it looks at the context within a file. But imagine if it could understand your entire codebase - every function, class, and object. That's what I'm working towards by vectorizing entire codebases. It's ambitious, but the potential for truly insightful code reviews is huge. This also leads the way to doing more complex tasks, like automatically fixing issues of varying degrees of difficulty.

I'm also working on a dashboard to give users more control over CARA's operation. You'll be able to customise review parameters, see performance insights, and track code quality trends over time. I'll also be adding a feature list which everyone can submit ideas, vote on and then have implemented.

Want to Try CARA?

I've found CARA incredibly helpful in my day-to-day coding. It's made me a happier, more productive developer. And now, I'm looking for more people to try it out.

If you're interested in experiencing AI-powered code review:

  1. Head over to https://cara.codes
  2. Install CARA on your GitHub repositories
  3. Create a pull request and watch CARA work its magic

I'd love to hear your thoughts and feedback. This is useful to me and hopefully to others, really keen to hear what might make this a more useful tool.