Rotation of a toolhead based on wall direction

Hello Everyone,

I am attempting to make a CNC machine with a directional toolhead - This head has a blade that always needs to be on the inside of the design for the design to work. For that to work I need to rotate the toolhead (via a servo motor) based on the way the wall is angled (90-degree turns to angular curves). I feel like this has been done before but I am just not sure where to start. Any thoughts