We present a mathematical investigation of the oscillatory boundary layer in a semi-infinite fluid bounded by an oscillating wall (the so-called 'Stokes problem'), when the fluid has a thixotropic or antithixotropic rheology. We obtain asymptotic solutions in the limit of small-amplitude oscillations, and we use numerical integration to validate the asymptotic solutions and to explore the behaviour of the system for larger-amplitude oscillations. The solutions that we obtain differ significantly from the classical solution for a Newtonian fluid. In particular, for antithixotropic fluids the velocity reaches zero at a finite distance from the wall, in contrast to the exponential decay for a thixotropic or a Newtonian fluid.For small amplitudes of oscillation, three regimes of behaviour are possible: the structure parameter may take values defined instantaneously by the shear rate, or by a long-term average; or it may behave hysteretically. The regime boundaries depend on the precise specification of structure build-up and breakdown rates in the rheological model, illustrating the subtleties of complex fluid models in non-rheometric settings. For larger amplitudes of oscillation the dominant behaviour is hysteretic. We discuss in particular the relationship between the shear stress and the shear rate at the oscillating wall. © 2012 Elsevier B.V.