Abstract. Modification of behaviour in response to changes in the environment or ambient conditions, based on memory, is typical of the human and, possibly, many animal species.One obvious example of such adaptivity is, for instance, switching to a safer behaviour when in danger, from either a predator or an infectious disease. In human society such switching to safe behaviour is particularly apparent during epidemics. Mathematically, such changes of behaviour in response to changes in the ambient conditions can be described by models involving switching. In most cases, this switching is assumed to depend on the system state, and thus it disregards the history and, therefore, memory. Memory can be introduced into a mathematical model using a phenomenon known as hysteresis. We illustrate this idea using a simple SIR compartmental model that is applicable in epidemiology. Our goal is to show why and how hysteresis can arise in such a model, and how it may be applied to describe a variety of memory effects. Our other objective is to introduce a unified paradigm for mathematical modelling with memory effects in epidemiology and ecology. Our approach treats changing behaviour as an irreversible flow related to large ensembles of elementary exchange operations that recently has been successfully applied in a number of other areas, such as terrestrial hydrology, and macroeconomics. For the purposes of illustrating these ideas in an application to biology, we consider a rather simple case study and develop a model from first principles. We accompany the model with extensive numerical simulations which exhibit interesting qualitative effects.