But the thing which is "dirtier" is the wider universe, where the energy you used to do that sorting has higher entropy.
At the scale of atoms and molecules in a gas, you can also sort them into high-energy particles on one side of a barrier and low-energy particles on the other side, and now there's a heat difference you can run a heat engine. This is totally a thing you can do with the right devices — but those devices will necessarily consume more energy than you get from a heat engine running on that heat difference.
That’s because the box isn’t a closed system, you’ve interacted with in and you have spent energy sorting the bricks. It’s the same story with humans on earth, things get sorted because of the energy inout from the Sun.
But the thing which is "dirtier" is the wider universe, where the energy you used to do that sorting has higher entropy.
At the scale of atoms and molecules in a gas, you can also sort them into high-energy particles on one side of a barrier and low-energy particles on the other side, and now there's a heat difference you can run a heat engine. This is totally a thing you can do with the right devices — but those devices will necessarily consume more energy than you get from a heat engine running on that heat difference.
https://en.wikipedia.org/wiki/Maxwell%27s_demon