I'm using Greptile, but I'm not sure it's really any smarter than ChatGPT, or that we can train it to be any smarter.Don't use ChatGPT. It's not smart. It can't do research or reasoning or logic or math with consistency. What it says in one statement will be contradicted in the next...
If you're posting output from ChatGPT then say so, so we can ignore it or at least not blame you for the incoherent ramblings of a chat bot.

Greptile
Greptile is an AI-expert on any codebase that can answer any questions about it, review PRs, and more
app.greptile.com
It's pretty cool tho and in time it may prove to be useful. It's free to use for one repository, and it is really good at scaring the code and looking for sections and explaining some basic functionality to someone like me that can't really code.
As far as the usefulness of the code it gives, I'm just not sure yet, but it seems to be broken code most of the time, so far.
It makes mistakes as you have seen, seems to make fundamental errors and then double down on them even when you have already tried to correct them. I asked it to help me write an xcoff loader and it completely forgot to tell me SLOF already has an xcoff loader.
If we correct it and it can learn from that and not double down on it's own mistakes it will in time become more useful, but it's already useful to me, even with it's errors because I'm actually learning a few things. I test and try, and I have you to tell me some things that are flawed, so thank you Joe, you are generous with your time and knowledge.
If nothing else it's very good at scanning large codebases like Apple's Xnu sources and finding specific things you ask it to find, like the parts of the code that need to be changed to support the Power9. So now I have some idea where to look and what needs to be done.