A novel protein folding mechanism in the endoplasmic reticulum is essential for long-term memory storage. This mechanism is impaired in tau-models of Alzheimer's disease, but restoring the protein folding mechanism reverses memory impairment associated with dementia.