As hippocampal neurons respond to diverse types of information1, a subset assembles into microcircuits representing a memory2. Those neurons typically undergo energy-intensive molecular adaptations, occasionally resulting in transient DNA damage3–5. Here we found discrete clusters of excitatory hippocampal CA1 neurons with persistent double-stranded DNA (dsDNA) breaks, nuclear envelope ruptures and perinuclear release of histone and dsDNA fragments hours after learning. Following these early events, some neurons acquired an inflammatory phenotype involving activation of TLR9 signalling and accumulation of centrosomal DNA damage repair complexes6. Neuron-specific knockdown of Tlr9 impaired memory while blunting contextual fear conditioning-induced changes of gene expression in specific clusters of excitatory CA1 neurons. Notably, TLR9 had an essential role in centrosome function, including DNA damage repair, ciliogenesis and build-up of perineuronal nets. We demonstrate a novel cascade of learning-induced molecular events in discrete neuronal clusters undergoing dsDNA damage and TLR9-mediated repair, resulting in their recruitment to memory circuits. With compromised TLR9 function, this fundamental memory mechanism becomes a gateway to genomic instability and cognitive impairments implicated in accelerated senescence, psychiatric disorders and neurodegenerative disorders. Maintaining the integrity of TLR9 inflammatory signalling thus emerges as a promising preventive strategy for neurocognitive deficits.