Genome-wide DNA rearrangements occur in many eukaryotes but are most exaggerated in ciliates, making them ideal model systems for epigenetic phenomena. During development of the somatic macronucleus, Oxytricha trifallax destroys 95% of its germ line, severely fragmenting its chromosomes, and then unscrambles hundreds of thousands of remaining fragments by permutation or inversion. Here we demonstrate that DNA or RNA templates can orchestrate these genome rearrangements in Oxytricha, supporting an epigenetic model for sequence-dependent comparison between germline and somatic genomes. A complete RNA cache of the maternal somatic genome may be available at a specific stage during development to provide a template for correct and precise DNA rearrangement. We show the existence of maternal RNA templates that could guide DNA assembly, and that disruption of specific RNA molecules disables rearrangement of the corresponding gene. Injection of artificial templates reprogrammes the DNA rearrangement pathway, suggesting that RNA molecules guide genome rearrangement.