2024-01-07 Co-Developer GPT Engine - creating a GPT that can work on your local files

#ChatGPT #AI #Productivity

Co-Developer GPT Engine - creating GPTs that can work on your local files

Developer and ChatGPT typing on one keyboard If you'd like to try what ChatGPT-4 can do for you when it is able to list, search, read and modify your local files and have it execute (e.g. build and test) actions locally to support you in your development processes - please go ahead! A while ago I wrote the Co-Developer GPT Engine, and with release 3.0 it can be used as actions from a GPT.

In contrast to many other approaches like AutoGPT this does not focus on being a fully autonomous agent using a lot of prompt engineering, but rather on giving you flexibility to direct the AI from the ChatGPT chat interface to do whatever task you need it to do at the moment, and to provide the basic functionality it needs to do what you want _on your local filesystem_, like analyzing or generating code and documentation and discuss your project with you while being able to actually look at it without you again and again copying code fragments into the chat. But of course you can have it create a plan to solve a task and then take the steps to execute it, though that has limits.

It can work as actions for a OpenAI GPT, or as a ChatGPT plugin (though that seems deprecated by OpenAI now). It is open source under the Apache 2.0 license - it's source is available on GitHub. The documentation website is quite extensive. There is a local tool - the actual Co-Developer GPT engine - which you can start in whatever directory your project is in, and you have to set up (once) a private GPT in ChatGPT that is able to communicate with the engine. The engine can be run read-only or with write access, if you like it to make changes.

Why the in-chat approach

I've chosen the approach to use ChatGPT via it's chat interface to work on my local files for a couple of reasons.

  1. Flexibility. I don't think AI is really able to autonomously create fully functioning, software, or non-to be a problem, no matter how much prompt engineering you throw at it. But it is already able to answer questions, create code fragments, help you with documenting things, help you with setting up your projects, and much more. So I found to use the chat interface of ChatGPT a quite natural thing to discuss things and give instructions what to do.
  2. Quick experimentation. I think if you have many quite similar tasks to do for which the current state of AI is able to support you, you might be able to create a dedicated workflow with auto GPT or something like that that will give you good support for that. But this is not what I am usually doing. But when I'm devloping software, I have many small quite dissimilar tasks to do for which I cannot optimize a workflow for complicated AI system. But I can easily call up the Co-Developer GPT and see whether ChatGPT can support me. If not, I will just do it myself.
  3. Several actions per message. The ChatGPT chat has an interesting advantage in comparison to the OpenAI chat completion API and similar APIs, even the new OpenAI assitants API. During answering a message ChatGPT can trigger several actions and react to the outcomes of these actions - all in one response. That often permits executing a whole task with several steps in one message, and is a bit more like human behavior.
  4. Pricing. If you are an AI enthusiast you probably have a ChatGPT subscription anyway, so that won't cost you extra. On the other hand, you will occasionally run into the message limit if you are using it often, so I'm sometimes wondering whether it makes sense to provide an alternative chat interface that is using the Chat API.

How I use it

I put the engine as an external Tool into my IntelliJ IDEA IDE with the working directory set to $FileDir$. Thus I can easily select any directory in the project and fire it up if I feel there is something ChatGPT can support me with.

When I'm having it make changes, I usually commit everything to Git, then let ChatGPT work. Thus I can easily roll it back and retry if I don't like the result. It has been able to do non-trivial tasks like implementing new classes drawing on other classes as example, like this and this, or create a configuration class from the specification. (In my newer software I tend to mark commits that have mostly been done with the Co-Developer GPT with ChatGPT:).

That said, writing code isn't yet what it's excelling at. ChatGPT is rather slow, so an experienced programmer, especially if supported by something like GitHub Copilot, is way faster. But I often enjoy pushing the limits there and let it work away on something while I'm doing something else.

For me, the major benefit of it is making communication about my code much simpler. I can just tell activity to have a look at this in that file and give me solutions to problems. That doesn't always work but it's always will try because occasionally it saves you a couple of hours.

So, I'm happy if you give it a try tell me about your experiences! Have fun!