Replay in the brain is not a simple recapitulation of recent experience, with awake replay often unrolling in reverse temporal order upon receipt of reward, in a manner dependent on reward magnitude. These findings have led to the proposal that replay is optimized for learning value-based predictions in accordance with reinforcement learning theories. However, other characteristics of replay are in tension with this proposal, leaving it unclear whether one set of principles governs all replay. We offer a parsimonious memory-focused account, suggesting that the brain associates experiences with the contexts in which they are encoded, at rates modulated by the salience of each experience. During periods of quiescence, replay emerges when contextual cues trigger a cascade of reactivations driven by the reinstatement of each memory's encoding context, which in turn facilitates memory consolidation. Our theory unifies numerous disparate replay phenomena, including findings that existing models fail to account for.