There would be no easy way to do this. At best you could use OnIdleNotify to wait until something occurs, and then write code that investigates the selection that just occurred, but this would be a very time-consuming endeavor.
The best way to record what the user is doing is to use the macro recorder.
Why do you need to know what buttons the user clicks?
I want to make an AI agent to teach people using Solidworks to make 3D model. Like the agent can interrupt people if it found a mistake happened during the sketching process. Therefore, I want to know is there any way to detect which button the user clicked and let the agent to figure out whether the clicked button is correct one.
I see. That would be very difficult to program, unfortunately. A simpler approach would be to wait until the user has created a body feature and then verify that the mass properties are correct.