[en] We assume that Markovian dynamics on a finite graph enjoys a gauge symmetry under local scalings of the probability density, derive the transformation law for the transition rates and interpret the thermodynamic force as a gauge potential. A widely accepted expression for the total entropy production of a system arises as the simplest gauge-invariant completion of the time derivative of Gibbs's entropy. We show that transition rates can be given a simple physical characterization in terms of locally detailed balanced heat reservoirs. It follows that Clausius's measure of irreversibility along a cyclic transformation is a geometric phase. In this picture, the gauge symmetry arises as the arbitrariness in the choice of a prior probability. Thermostatics depends on the information that is disposable to an observer; thermodynamics does not.