Extend hierarchical reinforcement learning model for multiple conditions

Ok, I found another post in this forum by @carinaufer that is concerned with a similar approach.
@Vanessa_Brown provided some sample code that I think does model a repeated measures design of a reinforcement learning model. Although I don’t completely understand this code I get the idea that I need to model covariance of subject level effects between repeated sessions. This makes perfectly sense to me when thinking of classical statistics where the same is done in e.g. mixed models to account repeated measurements within subject.
Unfortunately, I’m still not quite sure how to apply this to my model formulation.