I use Amphetamine to keep my MBP from sleeping when the lid is closed and its connected to power (I don't use it in clamshell mode with an external display, I just want it to stay awake), and although it worked fine on my i9 with Big Sur, on the M1Max with Monterey it's very unpredictable – sometimes it will work as expected, but other times I come back to the computer, open it, and find it went to sleep (and disconnected my USB drives).