How can one define contextuality within the circuit model?

It is in general believed that contextuality is one of the quantum resource that provides the quantum advantage. A context is usually defined in terms of a set of commuting observables. The quantum algorithms are usually describe employing the circuit model. I am curious how can one define contextuality in the within the circuit model?

To be concrete, we may consider Peres-Mermin Square and define a circuit representing each observable at each spot. I think the above definition of contextuality require some upgrading while combining all the gates to implement quantum contextuality for Peres-Mermin square. Please share any suggestion or any reference that can be help as a starting point.

Spekken (2005) generalizes the above definition of contextuality. Could we apply Spekken definition for a circuit model too?

Contextuality is related to properties of quantum theory that arise when one attempts to provide some sort of "more classical" explanation of quantum theory. The Peres-Mermin square you mention shows that one cannot associate the outcomes of commuting measurements of variables as corresponding to some "pre existing" value for every single variable. When one measures terms like $$X \otimes X$$, in the Peres-Mermin square fo rexample, one cannot associate this with reveal some variable in a deeper theory without knowing what else you are measuring (for example that could be $$Y \otimes Y$$ and $$Z \otimes Z$$, or it could be $$X \otimes I$$ or $$I \otimes X$$).
That being said, such a model has been considered in this paper and is called the $$C^*$$-circuit model.