Dear Emma L. and others,
I hope that you are well as you read this (and may your recovery be prompt if not.) First, it might help to make sure that I understand what the gist of your question is: that when entropy is created spontaneously it is often because of a barrier somewhere being removed, causing its contents (i.e. the 'stuff' of the system, whether thermal energy or something else) to escape into a larger space. If instead the barrier can somehow be deformed continuously until it eventually matches the boundary of the new space, then it is in fact possible to extract work from the expansion (using the natural tendency of systems to seek higher entropy states.)
The classic example of spontaneous entropy production is the free expansion of an ideal gas: starting from some initial volume V0 and pressure, a barrier is removed, allowing the gas to expand suddenly into a larger space V1. Whatever temperature the ideal gas had before the expansion is the same that it has after (why might that be? What else might be constant?) and the entropy increases by an amount NkBlog(V1/V0). To determine the work that could have been extracted, we have to look at how the same final state could have been reached in a reversible way.
Let's suppose that you have a giant container of thermal energy that happens to be at the same temperature 'T' as the gas, and that this 'heat bank' (or thermal reservoir) is large enough to bring essentially any other system smaller than the palm of your hand, say, into thermal equilibrium with itself without a noticeable change in temperature. The idea is to use the tendency of the gas to expand to convert some of this otherwise useless heat into useful (observable) work. There are several approaches that you might take, but it turns out that the best one can do, without causing additional irreversible changes elsewhere, is to keep the reservoir in contact with the gas, allowing the gas to expand slowly in order to stay in thermal equilibrium with the reservoir. It then turns out that the work extracted exactly matches TΔS, where ΔS is the change in entropy. Is there a way to anticipate this using one of the laws of thermodynamics? (Probably!)
It turns out that a similar result holds in the more general situation that you describe. Here, we know the temperature of the environment in which the process occurs is probably the same before and after the irreversible change takes place (if the environment is large enough), and we know something else is probably constant too. Again one of the laws of thermodynamics might be at play here: is there a closed system one might identify that contains the 230oK environment? With the answers to those questions in mind, if the process were carried out reversibly, how much work would need to have been performed in order to reach the same end state?