Brains at rest spontaneously generate dynamical activity that is not mere noise but highly structured in space and time. As our most vivid dreams exemplify, spontaneous brain activity can give rise to the most sophisticated cognition. We suggest that spontaneous brain activity as in rest, mind wandering, or dreaming, underlies top-down dynamics of the generative models used to engage in everyday tasks. However, these models have different functions during active tasks (online) and in the absence of overt behavior (offline). During active tasks, generative models provide top-down predictive signals to carry out perceptual, cognitive, and motor tasks. When stimuli are weak or absent as in dreaming or eyes closed rest, top-down dynamics support the optimization of the generative model for future interactions by maximizing the entropy of explanations and minimizing model complexity. Specifically, spontaneous fluctuations of correlated activity within and across brain regions may reflect transitions between "generic priors" of the generative model, which represent low dimensional latent variables and connectivity patterns of the most common perceptual, motor, cognitive, and interoceptive states. These states are not tied to any specific explanation but useful to code future interactions, both familiar and novel. Therefore, even at rest, brains are proactive and predictive.