Add state-machine design documentation