Hi All,
I have forked the OpenCat framework on GitHub and added a lot more comments, to explain to myself what each piece of the code is doing. I am not sure they are 100% accurate, but doing this helped me think through the logic. If you think this could be useful for you, please take a look: https://github.com/kaiaeberli/OpenCat.
Happy New Year!
Kai