I had really hoped that I’d bounded it enough to be relatively easy:
on each turn, the NPC checks to see if a monster has attacked me since the NPC’s last turn. Hopefully that is something can be determined.
If one or more monster has attacked, the NPC moves toward the closest, lowest move count square that allows the NPC to attack that monster, favoring squares that are adjacent to me. A little more complex but close enough.
I’d be fine with the NPC asking me to get out of the way (the way they already do) if I’m blocking a doorway and the monster is on the other side.
I guess I should go look into the NPC AI code.