This paper analyzes notions and models of optimized cognition emerging at the intersections of psychology, neuroscience, and computing. What I somewhat polemically call the algorithms of mindfulness describes an ideal that determines algorithmic techniques of the self, geared at emotional resilience and creative cognition. A reframing of rest, exemplified in corporate mindfulness programs and the design of experimental artificial neural networks sits at the heart of this process. Mindfulness trainings provide cues as to this reframing, for they detail each in their own way how intermittent periods of rest are to be recruited to augment our cognitive capacities and combat the effects of stress and information overload. They typically rely on and co-opt neuroscience knowledge about what the brains of North Americans and Europeans do when we rest. Current designs for artificial neural networks draw on the same neuroscience research and incorporate coarse principles of cognition in brains to make machine learning systems more resilient and creative. These algorithmic techniques are primarily conceived to prevent psychopathologies where stress is considered the driving force of success. Against this backdrop, I ask how machine learning systems could be employed to unsettle the concept of pathological cognition itself.