All real processes, be they chemical, mechanical or electrical, are thermodynamically irreversible and therefore suffer from thermodynamic losses. Here, we report the design and operation of a chemical reactor capable of approaching thermodynamically reversible operation. The reactor was employed for hydrogen production via the water-gas shift reaction, an important route to 'green' hydrogen. The reactor avoids mixing reactant gases by transferring oxygen from the (oxidizing) water stream to the (reducing) carbon monoxide stream via a solid-state oxygen reservoir consisting of a perovskite phase (La0.6Sr0.4FeO3-δ). This reservoir is able to remain close to equilibrium with the reacting gas streams because of its variable degree of non-stoichiometry and thus develops a 'chemical memory' that we employ to approach reversibility. We demonstrate this memory using operando, spatially resolved, real-time, high-resolution X-ray powder diffraction on a working reactor. The design leads to a reactor unconstrained by overall chemical equilibrium limitations, which can produce essentially pure hydrogen and carbon dioxide as separate product streams.