This is self-promotional, but https://github.com/nahco314/feed-llm has TUI to choose what to give to llm. There are many similar tools out there, but I think this approach is relatively effective for larger code bases.
You can ask Cursor to use information from specific folder (aka your 4M lines) and it would summarize it and use that.
Not a replacement for full 4M lines but it might work for some tasks/prompts