So I reviewed the logic for approach to type up an explanation for everyone to be able to understand it, since I think it's in good shape now and...wow I didn't realize how insanely complex I made it.
It takes up more than 5,000 lines in the file even without counting City-States and special case approach updates - and it's by far the most complicated calculation related to AI behavior in the game.
Not to say that I think it's doing a bad job; I argue the complexity is necessary to produce an AI that behaves like a real/intelligent player rather than the vanilla robots. People seem generally happy with how diplomacy is behaving from the feedback I've seen.
I could use some help with this

...and I'm also not sure how easy it would be to understand even if I meticulously typed out how it works.