Not OP but Aider provides a repo map to the LLM as context, which consists of the directory tree, filenames, and important symbols in each file. It can use the popular LLMs as well as Ollama.
https://aider.chat/docs/repomap.html
Aider hosts a leaderboard that rates LLMs on performance, including a section on refactoring.
https://aider.chat/docs/leaderboards/refactor.html