I do not know if this will work or not. It may. If you want a script that toggles between two states you need to have a way to know the current state and if the is not possible to pick a state set that state and set some state indicator that you can test to know the current state. With a Photoshop scriptt it is possible to set a custom option or record the current state some how.
If you have the state indicator you also need to be able to switch states. As you have found some thing are not recorded. The scriptlistener does nothing when something can not be recorded. There may also be no DOM interface to switch the state or a standard menu item to switch states.
So what can one try? Often over look is the ability to set some none standard things. What do I mean? Before I get to that. There is a problem with what you want to do. For what you want to do in not possible in Photoshop. While there is a normal blend mode there is no "Clear" blend mode. You would need to write a Plug-in to implement a new feature for Photoshop. However I believe it would be possible to toggle between to blending mode that are possible. Often overlook are Presets. Preset you define/create can be use in Photoshop automation. The Automation will fail it these name preset have not been added to you Photoshop presets. You will see that selecting a preset will record in Actions and be recorded by the Scriptlistener. So you can create a two history brush presets. "Normal" and "Clear" and use these in your script. "Clear" would need to set some valid blending mode.