The code was written mostly by doing cut & paste on ChatGPT…
I am constantly shocked by how many people put up with such a painful workflow. OP is clearly an experienced engineer, not a novice using GPT to code above their knowledge. I assume OP usually cares about ergonomics and efficiency in their coding workflow and tools. But so many folks put up with cutting and pasting code back and forth between GPT and their local files.
This frustrating workflow was what initially led me to create aider. It lets you share your local git repo with GPT, so that new code and edits are applied directly into your files. Aider also shares related code context with GPT, so that it can write code that is integrated with your project. This lets GPT make more sophisticated contributions, not just isolated code that is easy to copy & paste.
The result is a seamless “pair programming” workflow, where you and GPT are editing the files together as you chat.
I like aider. But is there a way to use it to just chat about the code?
I use LLMs to chat about pros and cons of various approaches or rubber duck out problems. I need to copy code over for that, but I've not found aider good for these kinds of things, because it's all about applying changes.
I usually have several back and forths about the right way to do things and then maybe apply some change.
Glad to hear you're finding aider useful!
Sure, there's a few things you could keep in mind if you just want to chat about code (not modify it):
1. You can tell GPT that at the start of the chat. "I don't want you to change the code, just answer my questions during this conversation."
2. You can run `aider --dry-run` which will prevent any modification of your files. Even if GPT specifies edits, they will just be displayed in the chat and not applied to your files.
3. It's safe to interrupt GPT with CONTROL-C during the chat in aider. If you see GPT is going down a wrong path, or starting to specify an edit that you don't like... just stop it. The conversation history will reflect that you interrupted GPT with ^C, so it will get the implication that you stopped it.
4. You can use the `/undo` command inside the chat to revert the last changes that GPT made to your files. So if you decide it did something wrong, it's easy to undo.
5. You can work on a new git branch, allow GPT to muck with your files during the conversation and then simply discard the branch afterwards.
Can I recommend an additional option? I would enjoy being able to enable a “confirm required” mode which presents the patch that will be applied, and offers me the chance to accept/reject it, possibly with a comment explaining the rejection.
Awesome, these might help.
What I feel like I want is /chat where it still sends the context, but the prompt is maybe changed a little, to be closer to a chatgpt experience.
I haven't dug into the prompt aider is using though, so I could be wrong.
Great tool for refactoring changes though! Keep up the good work.
> OP is clearly an experienced engineer
You think? He's the creator of Redis.
For one thing the ChatGPT web interface is useful for much more than just programming. If you're already paying for a sub, it makes sense to cut and paste instead of making additional payments for the API. On top of that people have different thresholds for the efficiency gains that warrant becoming dependent on someone else's project, which is liable to become paid or abandoned.
Yeah, I can ask ChatGPT to "do some web research, and validate the approach/library/interface/whatever", which is a useful feature to me.
I really like the idea of aider but when I tried it, it didn't work. The first real life file I tried it on was too big and it just blew up. The second real life file I tried was still too big. I was surprised that aider doesn't seem to have the ability to break down a large file to fit into the token limit. GPT's token limit isn't a very big source file. If I have to both choose the files to operate on and do surgery on them so GPT doesn't barf, am I saving time vs. using Copilot in my IDE? Going into it, I had thought that coping with the "code size ≫ token limit" problem was aider's main contribution to the solution space but I seem to have been wrong about that.
I hope to try aider again but it's in the unfortunate category of "I have to find a problem and a codebase simple enough that aider can handle it" whereas Copilot and ChatGPT come to me where I am. Copilot and ChatGPT help me with my actual job on my real life codebase, warts and all, every day.
I'm sorry to hear you had a rough experience trying aider. Have you tried it since GPT-4 Turbo came out with the 128k context window? Running `aider --4-turbo` will use that and be able to handle larger individual source code files.
Aider helps a lot when your codebase is larger than the GPT context window, but the files that need to be edited do have to fit into the window. This is a fairly common situation, where your whole git repo is quite large but most/all of the individual files are reasonably sized.
Aider summarizes the relevant context of the whole repo [0] and shares it along with the files that need to be edited.
The plan is absolutely to solve the problem you describe, and allow GPT to work with individual files which won't fit into the context window. This is less pressing with 128k context now available in GPT 4 Turbo, but there are other benefits to not "over sharing" with GPT. Selective sharing will decrease token costs and likely help GPT focus on the task at hand and not become distracted/confused by a mountain of irrelevant code. Aider already does this sort of contextually aware selective sharing with the "repo map" [0], so the needed work is to extend that concept to a sub-file granularity.
[0] https://aider.chat/docs/repomap.html#using-a-repo-map-to-pro...
Try again since the token limit increased in November by a factor of 16 (128000 now for GPT-4 Turbo 1106 preview instead of 8000 for GPT 4).
Mind the cost though! A single request with a fully loaded 128k token context window to GPT-4 Turbo costs $1.28.
Like others, wanted to say thank you for writing Aider.
I think you've done a fantastic job of covering chat and confirmation use cases with the current features. Comments on here may not reflect the high satisfaction levels of most of your software users :)
Aider helps put into practice the use cases that antirez refers to in their article. Especially as someone get's better at "asking LLMs the right questions" as antirez refers to it.
I've given Aider and Mentat a go multiple times and for existing projects I've found those tools to easily make a mess of my code base (especially larger projects). Checkpoints aren't so useful if you have to keep rolling back and re-prompting, especially once it starts making massive (slow token output) changes. I'm always using `gpt-4` so I feel like there will need to be an upgrade to the model capabilities before it can be reliably useful. I have tried Bloop, Copilot, Cody, and Cursor (w/ a preference towards the latter two), but inevitably, I end up with a chat window open a fair amount - while I know things will get better, I also find that LLM code generation for me is currently most useful on very specific bounded tasks, and that the pain of giving `gpt-4` free-reign on my codebase is in practice, worse atm.
There is a bit of learning curve to figuring out the most effective ways to collaboratively code with GPT, either through aider or other UXs. My best piece of advice is taken from aider's tips list and applies broadly to coding with LLMs or solo:
Large changes are best performed as a sequence of thoughtful bite sized steps, where you plan out the approach and overall design. Walk GPT through changes like you might with a junior dev. Ask for a refactor to prepare, then ask for the actual change. Spend the time to ask for code quality/structure improvements.
https://github.com/paul-gauthier/aider#tips
Shameless plug: https://github.com/codespin-ai/codespin-cli
It's similar to aider (which is a great tool btw) in goals, but with a different recipe.
I currently use gptel which inserts into my buffer directly and has less friction than copy paste.
Aider seems super cool, will check it out. What kind if context from the git repo does it share?
Glad to hear you'll give aider a try. Here's some background on the "repo map" context that aider sends to GPT:
https://aider.chat/docs/repomap.html
If I was doing it all the time, I might care. As it is I don't really find that workflow painful. It reminds me of the arguments about how much it helps to be able to touch type or type very fast. Actually inputting code is a minor part of development IME.
I edit cell-sized code that uses Colab GPUs, asking a lot of questions to chatGPT l,so copying and pasting is not a problem for me.
Thanks for making aider. I use it all the time. It's amazing.