The regular flipping behavior can be easily analyzed with some basic trigonometry knowledge, such as the radius of the circle and the three main trigonometric functions. As many before me have already said that extracting a reliable twist over 180 degrees is impossible. you can try all day long, for years, it wont change math and physic core limitation…
The basic concept is something like the no flip option in a orient constraint, storing the previous values and make a delta difference. But to pull it through in a complex animation and workflow of multiple undos/tweaks without losing the accurate twist extraction, needs something more robust.
A good example is the QuatTwist by Braverabbit. Although the forearm twist doesn’t work greatly on this implementation. Additionally the undo sometimes breaks the twist.**But the UI is really intuitive!
The primary structure of this implementation was to draw forth a reliable angle difference. Firstly euler to quaternion then filtering the axis, find the orthonormal and make a matrix. Use the stored vector in order to calculate the angle between the current axis and some other conditions. Overall the node needs to store one vector only.

The secondary essential step was to make a counter measure for a previous value dependent node on the twist extraction and the undo method. finally a intuitive UI for the components ratio modification.
Here is a first look of this node:
Available for download: https://github.com/PaschalM/infiniteTwist