The once fanciful idea that bacteria might have immunological memory became accepted fact with the discovery that the CRISPR–Cas gene loci evolve rapidly to acquire short phage sequences, or spacers, which then integrate between CRISPR repeats and constitute a record of phage infection. These spacers are transcribed into small CRISPR RNAs (crRNAs) that are used to target the DNA of invading viruses. Two papers published in this issue of Nature describe molecular details about how bacteria create a DNA memory of the invading virus. Jennifer Doudna and colleagues show that the purified Escherichia coli Cas1–Cas2 complex integrates oligonucleotide DNA substrates into acceptor DNA in a manner similar to retroviral integrases and DNA transposases. Cas1 is the catalytic subunit, while Cas2 increases integration activity; together they form the minimal machinery required for spacer acquisition. Luciano Marraffini and colleagues show that in the type II CRISPR–Cas system of Streptococcus pyogenes, the Cas9 nuclease that inactivates invading viral DNA using the crRNA as a guide is also required for the incorporation of new spacer sequences, by a yet to be determined mechanism.