Organisms can develop adaptive sequence-specific immunity by reexpressing pathogen-specific small RNAs that guide gene silencing. For example, the C. elegans PIWI-Argonaute/piwi-interacting RNA (piRNA) pathway recruits RNA-dependent RNA polymerase (RdRP) to foreign sequences to amplify a transgenerational small-RNA-induced epigenetic silencing signal (termed RNAe). Here, we provide evidence that, in addition to an adaptive memory of silenced sequences, C. elegans can also develop an opposing adaptive memory of expressed/self-mRNAs. We refer to this mechanism, which can prevent or reverse RNAe, as RNA-induced epigenetic gene activation (RNAa). We show that CSR-1, which engages RdRP-amplified small RNAs complementary to germline-expressed mRNAs, is required for RNAa. We show that a transgene with RNAa activity also exhibits accumulation of cognate CSR-1 small RNAs. Our findings suggest that C. elegans adaptively acquires and maintains a transgenerational CSR-1 memory that recognizes and protects self-mRNAs, allowing piRNAs to recognize foreign sequences innately, without the need for prior exposure