Aider is AI pair programming in your terminal

Just discovered Aider:

This is a Python program that you run in your terminal that makes changes to your code. You can use an OpenAI or Anthropic developer key, and then Aider uses API access to do its work.

I set up an Anthropic account and seeded it with $25, generated a key and gave it a try.

Initially, I tried to run in on SimpleIoT and it crashed right off

> add cmd/siot/main.go

cmd/siot/main.go
Add these files to the chat? y
 63%|█████████████████████████████████████████████████▉                             | 298/472 [00:00<00:00, 470.35it/s]
Traceback (most recent call last):
  File "/home/cbrake/pybrake/bin/aider", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/cbrake/pybrake/lib/python3.12/site-packages/aider/main.py", line 586, in main
    coder.run()
  File "/home/cbrake/pybrake/lib/python3.12/site-packages/aider/coders/base_coder.py", line 631, in run
    list(self.send_new_user_message(new_user_message))
  File "/home/cbrake/pybrake/lib/python3.12/site-packages/aider/coders/base_coder.py", line 841, in send_new_user_message
    messages = self.format_messages()
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cbrake/pybrake/lib/python3.12/site-packages/aider/coders/base_coder.py", line 797, in format_messages
    messages += self.get_files_messages()
                ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cbrake/pybrake/lib/python3.12/site-packages/aider/coders/base_coder.py", line 551, in get_files_messages
    repo_content = self.get_repo_map()
                   ^^^^^^^^^^^^^^^^^^^
  File "/home/cbrake/pybrake/lib/python3.12/site-packages/aider/coders/base_coder.py", line 523, in get_repo_map
    repo_content = self.repo_map.get_repo_map(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cbrake/pybrake/lib/python3.12/site-packages/aider/repomap.py", line 87, in get_repo_map
    files_listing = self.get_ranked_tags_map(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cbrake/pybrake/lib/python3.12/site-packages/aider/repomap.py", line 393, in get_ranked_tags_map
    ranked_tags = self.get_ranked_tags(
                  ^^^^^^^^^^^^^^^^^^^^^
  File "/home/cbrake/pybrake/lib/python3.12/site-packages/aider/repomap.py", line 280, in get_ranked_tags
    tags = list(self.get_tags(fname, rel_fname))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cbrake/pybrake/lib/python3.12/site-packages/aider/repomap.py", line 150, in get_tags
    data = list(self.get_tags_raw(fname, rel_fname))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cbrake/pybrake/lib/python3.12/site-packages/aider/repomap.py", line 183, in get_tags_raw
    query = language.query(query_scm)
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cbrake/pybrake/lib/python3.12/site-packages/tree_sitter/__init__.py", line 222, in query
    return _language_query(self.language_id, source)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Invalid syntax at offset 275

It seemed to work stand-alone, so I searched around a bit in the issues and found this:

It is a bug related to Elm source files and was fixed yesterday. After updating to the main branch fixes it – yay for living on main!

It seems very capable of things like adding a new command to the cmd/siot main function, etc.

I think asked it to move the node/modbus modules to the client directory and convert them to use the client model – something that needs done. It ran for perhaps 3 minutes, made a start, but did not get very far in the overall task.

It does make Git commits as it works:

        log
[cbrake@ceres go-clean]$ git whatchanged
commit 54315561eaf8dfaa64ede4cc9acae2d83c5af395 (HEAD -> master)
Author: Cliff Brake (aider) <cbrake@bec-systems.com>
Date:   Thu Jul 25 16:07:43 2024 -0400

    Understood. The SEARCH/REPLACE block has been updated to match the actual content of the `node/modbus.go` file. Here is the core

<truncated a very long commit message>

:100644 100644 804a1a08 586e761f M      node/modbus.go

commit 0d82a6132bcb1623e009f9d4aecff374a1198ba3
Author: Cliff Brake <cbrake@bec-systems.com>
Date:   Thu Jul 25 16:07:20 2024 -0400

    Added support for reading Modbus points of type 'uint16'.

:100644 100644 af2e3679 7205fdba M      client/modbus.go

commit 29a434928c6661321840097481207f00ba0cb472
Author: Cliff Brake <cbrake@bec-systems.com>
Date:   Thu Jul 25 16:06:51 2024 -0400

    Implemented a Modbus client with support for reading holding registers.

:000000 100644 00000000 af2e3679 A      client/modbus.go

commit f27d16edd424fb9f7d1cdd79f164ddf4973bc5f1
Author: Cliff Brake (aider) <cbrake@bec-systems.com>
Date:   Thu Jul 25 15:53:52 2024 -0400

    Added a new "test" command to the cmd/siot/main.go file.

:100644 100644 587b1344 1c7a532c M      cmd/siot/main.go

I then looked at usage in Anthropic:

It cost me $0.73 for my experiments today – not bad if it saved me some time, but it definitely is not free, and could add up if you were using it all day.

What I really like is that it runs outside my editor so I can still use Helix, but benefit from AI when I need it.

It appears the Claude models work best at this time.

Here are some videos that give an idea what you can do with Aider: