Aider helping je test a Torment Nexus Generator

Aider: The Terminal Pair Coder I Didn’t Know I Wanted

Aider-chat is a terminal based AI pair programmer that's easy to install, has some agency--but not too much, and done well--and that can precisely edit your code and also commits changes to Git for you.

By Daniel Detlaf

One-man flea circus, writer, sci-fi nerd, news junkie and AI tinkerer.

Pssst. Would you like a quick weekly dose of AI news, tools and tips to your inbox? Sign up for our newsletter, AIn't Got The Time.

If you’ve been head-down in your latest coding hobby, wrestling with whatever project has consumed your life recently, I’ve got something you might like – Aider.

It’s a terminal based AI pair programmer that’s easy to install, has some agency–but not too much, and done well–and that can precisely edit your code and also commits changes to Git for you.

Now, let’s set the expectations realistically. Is Aider about to blow your mind? Probably not. It’s the same models under the hood. But it’s fun, smart, and… let’s just say if ChatGPT and Git had a nerdy little offspring, it’d look a lot like Aider.

So, What Exactly Is This Aider thing?

Aider uses your git repo to understand the structure of your project. As you add files to the chat (/add <filename>) aider builds a map of the relevant parts of your code. It’s a clever condensed list of files and functions Aider uses to reason and to locate specific code implicated by your command in chat. You can view the current map with /map.

It then suggests edits or new code in response to your input, or simply carries out your commands, with varying degrees of confirmation before execution dependent on settings and the specific command. It commits file changes to the git with a description of changes automatically.

You always have the convenient `/undo` option if Aider… let’s say, gets a little *overconfident*.

Getting Started Is Stupidly Easy

Just a quick pip install and you’re in:

python -m pip install -U aider-chat
cd /to/your/git/repo

Like GPT-4o? Or maybe you’re team Claude 3.5 Sonnet? It works with any major LLM API keys.

export OPENAI_API_KEY=your-key-here   # or Claude API key
aider <file1> <file2> ...

I’d start with your main project file like app.py, etc. Aider does a good job condensing your code base so it can include the relevant code in the LLM’s context, but it’s best not to add too much anyway.

Use /ask to chat about your code and get suggested edits or advice. If aider thinks it needs code elsewhere in your codebase based on the file(s) in chat, it will prompt you to add them (by simply hitting Y).

Use /architect to ask for high level design and planning, and receive a list of instructions and prompts to execute commands.

What I Like

There are a couple neat things about Aider. The way it tracks all changes with Git automatically is a huge relief. That means you can ask it to fix something, see how it handles the situation, and then if it spirals out of control—as AI sometimes loves to do—you can just type `/undo` and it’ll backtrack through its over-the-top suggestions. Let’s face it, you probably don’t *really* need an imported library that it suddenly decided was the solution to everything, right?

Aider also manages context through the `/add` and `/drop` commands, so it’s easy enough to include only the files you want it to focus on, while keeping the rest of your project out of its AI-fueled reach. This helped keep things clean and prevented Aider from trying to refactor half my project when all I wanted was a single bug fix.

If you’re like me and appreciate a little auto-linting help, Aider does that. It’s necessary because the models often return code that has minor whitespace errors and the like. The kind of thing that could drive you crazy if you were copying and pasting yourself. All you need to do is hit `Y` to confirm when presented with linting trouble.

It’s a time saver, not a wallet saver (depending on how much you decide to lean on it). That said, if you’re already privy to API key costs, you probably won’t be surprised that smarter AIs come at a cost. I wouldn’t overstate either. A days programming cost me about$2.

Shell Butler

One of the things I ended up really enjoying was Aider’s ability to suggest and execute shell commands directly from chat. All it takes is a simple confirmation for suggested commands, or for you to prompt it.

You’ll want to read them carefully of course, but it didn’t suggest anything crazy and saved me a lot of command lookup.

Now, the Question: Is Aider Chat Worth It?

In short, **yeah**—but only if you’re the kind of coder who likes to experiment with new tools, or if you’re working on a project where pair programming with a somewhat decent API-bound assistant sounds… amusing.

Aider can absolutely make the coding process easier, but it’s not a one-click solution to all your coding woes. It’s a solid blend of fun and useful that complements your coding journey, especially for hobbyists like myself. It’s not going to suddenly transform you into a 10x coder, and it’s got quirks just like any other tool.

But if you’re okay with a bit of AI unpredictability now and then, and you don’t mind blowing through some tokens for the faster GPT-4o or Anthropic, it’s worth giving Aider a whirl.

With Aider automatically committing every change, you’re set to backtrack any AI-powered missteps along the way. You `/undo` the whole situation.

Happy debugging!

Create an amazing adventure with Storynest.ai. Try it free.  - Sponsored

Sponsored