About BN slope detector: I just made few extra EPICS channels to do this. But acromag1 hasn't rebooted since for testing if it works. However, since the pre-cavity beat note frequency counter fails to update values sporadically, there would be glitches in this slope readout as well. Another way is to do this in python keeping track of past few pre-cavity beat note frequency recordings.
About BN sign checker: I was working on this more like a side hobby project so far. I had successfully implemented it before when I was trying that semi-smart temperature control. I'll take a look again at BNFreqSignUpdate.py which needs to be run in a tmux session for this to work.
This will be more a problem down at the 27 MHz point that we want to lock to. As the set point is so close to the BN flip across 0 Hz any disturbance can drive our loop into this runaway state. Its not clear how we reject these glitches or reliably sense the flip across 0 Hz. Filtering pre-cav BN for glitches seems bad as it will introduce poles that then affect the loop. Trying to sense a change in BN slope (I think anchal implemented this?) will be hard if the slope is very shallow as it crosses, this will give confusion about the sign if the noise dominates over the derivative value.