This is not a complete answer, this is kind of just a gesture towards one. The actual complete answer will kind of depend on what's going on in your game, y'know? But I can point to a couple of things.
Here's some recent discussion of the sokoban example specifically: https://itch.io/post/16368974
And for the path module here's the card that has an example that gives a visual example of the forbidden color thing: https://beyondloom.com/decker/path.html#followeranim (click the checkbox at the bottom)
Some of the code for this is inside the module, not the deck's scripts but I believe it uses .hist to check parts of the movement grid for a specific color, and forbids movement onto that square of the grid if it finds any.
It should be possible to do something similar with a different kind of movement system too, if the path module itself doesn't have the kind of movement you had in mind.

