You just kind of concatenate the entire codebase into one file, tell the model to do something and output the modified codebase into another file, diff the two and produce a patch automatically.
That codebase=>token stream=>codebase step feels like it could be lossy depending on how you encode things like file paths when concatenating everything, would be interesting to see in practice though!
or you might even be able to feed it individual files with their filenames, then ask it what modifications it would make as a diff for each of the files
I think there's ways but you might have to use pinecone db or something like lang chain to essentially give it a long term memory...
or another option is having one instance or chat order code page and one that basically just has an API index and knows which chat has the related things.